fixed usage of AtomicBoolean

This commit is contained in:
Spencer Gibb
2015-08-28 14:40:50 -06:00
parent 1a317a5ac9
commit 794cf98c53

View File

@@ -175,13 +175,12 @@ public abstract class AbstractDiscoveryLifecycle implements DiscoveryLifecycle,
@Override
public void stop() {
if (isEnabled()) {
if (this.running.compareAndSet(true, false) && isEnabled()) {
deregister();
if (shouldRegisterManagement()) {
deregisterManagement();
}
}
this.running.compareAndSet(true, false);
}
@PreDestroy