This commit is contained in:
Justin Bertram 2017-09-28 13:42:06 -05:00
commit 341ecd4d1a
2 changed files with 11 additions and 9 deletions

View File

@ -64,7 +64,7 @@ public class CriticalAnalyzerImpl implements CriticalAnalyzer {
@Override
public CriticalAnalyzer setCheckTime(long timeout, TimeUnit unit) {
this.checkTimeNanoSeconds = timeout;
this.checkTimeNanoSeconds = unit.toNanos(timeout);
return this;
}
@ -147,6 +147,7 @@ public class CriticalAnalyzerImpl implements CriticalAnalyzer {
// this means that the server has been stopped as we could acquire the semaphore... returning now
break;
}
logger.trace("Checking critical analyzer");
check();
}
} catch (InterruptedException interrupted) {

View File

@ -322,8 +322,7 @@ public class ActiveMQServerImpl implements ActiveMQServer {
private final ActiveMQServer parentServer;
private final CriticalAnalyzer analyzer;
private CriticalAnalyzer analyzer;
//todo think about moving this to the activation
private final List<SimpleString> scaledDownNodeIDs = new ArrayList<>();
@ -435,12 +434,6 @@ public class ActiveMQServerImpl implements ActiveMQServer {
this.parentServer = parentServer;
this.serviceRegistry = serviceRegistry == null ? new ServiceRegistryImpl() : serviceRegistry;
if (configuration.isCriticalAnalyzer()) {
this.analyzer = new CriticalAnalyzerImpl();
} else {
this.analyzer = EmptyCriticalAnalyzer.getInstance();
}
}
@Override
@ -573,6 +566,14 @@ public class ActiveMQServerImpl implements ActiveMQServer {
}
private void initializeCriticalAnalyzer() throws Exception {
if (analyzer == null) {
if (configuration.isCriticalAnalyzer()) {
this.analyzer = new CriticalAnalyzerImpl();
} else {
this.analyzer = EmptyCriticalAnalyzer.getInstance();
}
}
/** Calling this for cases where the server was stopped and now is being restarted... failback, etc...*/
this.analyzer.clear();