Search in sources :

Example 1 with JmxServer

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();
    }
}
Also used : JmxServer(org.apache.samza.metrics.JmxServer) SamzaException(org.apache.samza.SamzaException)

Aggregations

SamzaException (org.apache.samza.SamzaException)1 JmxServer (org.apache.samza.metrics.JmxServer)1