Search in sources :

Example 6 with LifecycleStop

use of org.apache.druid.java.util.common.lifecycle.LifecycleStop in project druid by druid-io.

the class K8sDruidNodeDiscoveryProvider method stop.

@LifecycleStop
public void stop() {
    if (!lifecycleLock.canStop()) {
        throw new ISE("can't stop.");
    }
    LOGGER.info("stopping");
    for (NodeRoleWatcher watcher : nodeTypeWatchers.values()) {
        watcher.stop();
    }
    listenerExecutor.shutdownNow();
    LOGGER.info("stopped");
}
Also used : BaseNodeRoleWatcher(org.apache.druid.discovery.BaseNodeRoleWatcher) ISE(org.apache.druid.java.util.common.ISE) LifecycleStop(org.apache.druid.java.util.common.lifecycle.LifecycleStop)

Example 7 with LifecycleStop

use of org.apache.druid.java.util.common.lifecycle.LifecycleStop in project druid by druid-io.

the class RemoteTaskRunner method stop.

@Override
@LifecycleStop
public void stop() {
    if (!lifecycleLock.canStop()) {
        return;
    }
    try {
        log.info("Stopping RemoteTaskRunner...");
        provisioningService.close();
        Closer closer = Closer.create();
        for (ZkWorker zkWorker : zkWorkers.values()) {
            closer.register(zkWorker);
        }
        closer.register(workerPathCache);
        try {
            closer.close();
        } finally {
            workerStatusPathChildrenCacheExecutor.shutdown();
        }
        if (runPendingTasksExec != null) {
            runPendingTasksExec.shutdown();
        }
        if (cleanupExec != null) {
            cleanupExec.shutdown();
        }
    } catch (Exception e) {
        throw new RuntimeException(e);
    } finally {
        lifecycleLock.exitStop();
    }
}
Also used : Closer(org.apache.druid.java.util.common.io.Closer) TimeoutException(java.util.concurrent.TimeoutException) KeeperException(org.apache.zookeeper.KeeperException) IOException(java.io.IOException) ExecutionException(java.util.concurrent.ExecutionException) LifecycleStop(org.apache.druid.java.util.common.lifecycle.LifecycleStop)

Example 8 with LifecycleStop

use of org.apache.druid.java.util.common.lifecycle.LifecycleStop in project druid by druid-io.

the class HttpRemoteTaskRunner method stop.

@Override
@LifecycleStop
public void stop() {
    if (!lifecycleLock.canStop()) {
        throw new ISE("can't stop.");
    }
    try {
        log.info("Stopping...");
        if (provisioningService != null) {
            provisioningService.close();
        }
        pendingTasksExec.shutdownNow();
        workersSyncExec.shutdownNow();
        cleanupExec.shutdown();
        log.info("Removing listener");
        DruidNodeDiscovery druidNodeDiscovery = druidNodeDiscoveryProvider.getForService(WorkerNodeService.DISCOVERY_SERVICE_KEY);
        druidNodeDiscovery.removeListener(nodeDiscoveryListener);
        log.info("Stopping worker holders");
        synchronized (workers) {
            workers.values().forEach(w -> {
                try {
                    w.stop();
                } catch (Exception e) {
                    log.error(e, e.getMessage());
                }
            });
        }
    } finally {
        lifecycleLock.exitStop();
    }
    log.info("Stopped.");
}
Also used : DruidNodeDiscovery(org.apache.druid.discovery.DruidNodeDiscovery) ISE(org.apache.druid.java.util.common.ISE) KeeperException(org.apache.zookeeper.KeeperException) IOException(java.io.IOException) ExecutionException(java.util.concurrent.ExecutionException) LifecycleStop(org.apache.druid.java.util.common.lifecycle.LifecycleStop)

Aggregations

LifecycleStop (org.apache.druid.java.util.common.lifecycle.LifecycleStop)8 ISE (org.apache.druid.java.util.common.ISE)4 IOException (java.io.IOException)3 ExecutionException (java.util.concurrent.ExecutionException)3 Closer (org.apache.druid.java.util.common.io.Closer)2 KeeperException (org.apache.zookeeper.KeeperException)2 Interval (org.joda.time.Interval)2 ImmutableMap (com.google.common.collect.ImmutableMap)1 AbstractMap (java.util.AbstractMap)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 TimeoutException (java.util.concurrent.TimeoutException)1 BaseNodeRoleWatcher (org.apache.druid.discovery.BaseNodeRoleWatcher)1 DruidNodeDiscovery (org.apache.druid.discovery.DruidNodeDiscovery)1 TaskStatus (org.apache.druid.indexer.TaskStatus)1 Task (org.apache.druid.indexing.common.task.Task)1 SupervisorTaskAutoScaler (org.apache.druid.indexing.overlord.supervisor.autoscaler.SupervisorTaskAutoScaler)1 ServiceMetricEvent (org.apache.druid.java.util.emitter.service.ServiceMetricEvent)1 DateTime (org.joda.time.DateTime)1