Search in sources :

Example 1 with ContainerHeartbeatMonitor

use of org.apache.samza.container.ContainerHeartbeatMonitor in project samza by apache.

the class LocalContainerRunner method startContainerHeartbeatMonitor.

private void startContainerHeartbeatMonitor() {
    String coordinatorUrl = System.getenv(ShellCommandConfig.ENV_COORDINATOR_URL());
    String executionEnvContainerId = System.getenv(ShellCommandConfig.ENV_EXECUTION_ENV_CONTAINER_ID());
    if (executionEnvContainerId != null) {
        log.info("Got execution environment container id: {}", executionEnvContainerId);
        containerHeartbeatMonitor = new ContainerHeartbeatMonitor(() -> {
            container.shutdown();
            containerRunnerException = new SamzaException("Container shutdown due to expired heartbeat");
        }, new ContainerHeartbeatClient(coordinatorUrl, executionEnvContainerId));
        containerHeartbeatMonitor.start();
    } else {
        containerHeartbeatMonitor = null;
        log.warn("executionEnvContainerId not set. Container heartbeat monitor will not be started");
    }
}
Also used : ContainerHeartbeatClient(org.apache.samza.container.ContainerHeartbeatClient) ContainerHeartbeatMonitor(org.apache.samza.container.ContainerHeartbeatMonitor) SamzaException(org.apache.samza.SamzaException)

Aggregations

SamzaException (org.apache.samza.SamzaException)1 ContainerHeartbeatClient (org.apache.samza.container.ContainerHeartbeatClient)1 ContainerHeartbeatMonitor (org.apache.samza.container.ContainerHeartbeatMonitor)1