From 6e4e6b37818d00e685863c0eb3e40d47e6c7de90 Mon Sep 17 00:00:00 2001 From: Decebal Suiu Date: Tue, 6 Feb 2024 01:37:52 +0200 Subject: [PATCH] Ignore fire plugin state event without state change --- pf4j/src/main/java/org/pf4j/AbstractPluginManager.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pf4j/src/main/java/org/pf4j/AbstractPluginManager.java b/pf4j/src/main/java/org/pf4j/AbstractPluginManager.java index af7c106..2f0d210 100644 --- a/pf4j/src/main/java/org/pf4j/AbstractPluginManager.java +++ b/pf4j/src/main/java/org/pf4j/AbstractPluginManager.java @@ -861,6 +861,11 @@ public abstract class AbstractPluginManager implements PluginManager { * @param event the plugin state event */ protected synchronized void firePluginStateEvent(PluginStateEvent event) { + if (event.getPluginState() == event.getOldState()) { + // ignore events without state change + return; + } + for (PluginStateListener listener : pluginStateListeners) { log.trace("Fire '{}' to '{}'", event, listener); listener.pluginStateChanged(event);