Commit 41deff1b authored by akwizgran's avatar akwizgran

Suppress redundant enabled/disabled events.

parent 1ec3fa3a
...@@ -250,6 +250,7 @@ class PluginManagerImpl implements PluginManager, Service { ...@@ -250,6 +250,7 @@ class PluginManagerImpl implements PluginManager, Service {
private class Callback implements PluginCallback { private class Callback implements PluginCallback {
private final TransportId id; private final TransportId id;
private final AtomicBoolean enabled = new AtomicBoolean(false);
private Callback(TransportId id) { private Callback(TransportId id) {
this.id = id; this.id = id;
...@@ -295,12 +296,14 @@ class PluginManagerImpl implements PluginManager, Service { ...@@ -295,12 +296,14 @@ class PluginManagerImpl implements PluginManager, Service {
@Override @Override
public void transportEnabled() { public void transportEnabled() {
eventBus.broadcast(new TransportEnabledEvent(id)); if (!enabled.getAndSet(true))
eventBus.broadcast(new TransportEnabledEvent(id));
} }
@Override @Override
public void transportDisabled() { public void transportDisabled() {
eventBus.broadcast(new TransportDisabledEvent(id)); if (enabled.getAndSet(false))
eventBus.broadcast(new TransportDisabledEvent(id));
} }
@Override @Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment