use of org.apache.samza.metrics.JmxServer in project samza by apache.
the class ClusterBasedJobCoordinator method run.
/**
* Starts the JobCoordinator.
*
*/
public void run() {
if (!isStarted.compareAndSet(false, true)) {
log.info("Attempting to start an already started job coordinator. ");
return;
}
// set up JmxServer (if jmx is enabled)
if (isJmxEnabled) {
jmxServer = new JmxServer();
state.jmxUrl = jmxServer.getJmxUrl();
state.jmxTunnelingUrl = jmxServer.getTunnelingJmxUrl();
} else {
jmxServer = null;
}
try {
//initialize JobCoordinator state
log.info("Starting Cluster Based Job Coordinator");
containerProcessManager.start();
boolean isInterrupted = false;
while (!containerProcessManager.shouldShutdown() && !isInterrupted) {
try {
Thread.sleep(jobCoordinatorSleepInterval);
} catch (InterruptedException e) {
isInterrupted = true;
log.error("Interrupted in job coordinator loop {} ", e);
Thread.currentThread().interrupt();
}
}
} catch (Throwable e) {
log.error("Exception thrown in the JobCoordinator loop {} ", e);
throw new SamzaException(e);
} finally {
onShutDown();
}
}
Aggregations