Search in sources :

Example 11 with PreDestroy

use of javax.annotation.PreDestroy in project thingsboard by thingsboard.

the class DefaultActorService method stopActorSystem.

@PreDestroy
public void stopActorSystem() {
    Future<Terminated> status = system.terminate();
    try {
        Terminated terminated = Await.result(status, Duration.Inf());
        log.info("Actor system terminated: {}", terminated);
    } catch (Exception e) {
        log.error("Failed to terminate actor system.", e);
    }
}
Also used : Terminated(akka.actor.Terminated) PreDestroy(javax.annotation.PreDestroy)

Example 12 with PreDestroy

use of javax.annotation.PreDestroy in project atlas by apache.

the class Services method stop.

@PreDestroy
public void stop() {
    if (configuration.getBoolean("atlas.services.enabled", true)) {
        for (int idx = services.size() - 1; idx >= 0; idx--) {
            Service service = services.get(idx);
            LOG.info("Stopping service {}", service.getClass().getName());
            try {
                service.stop();
            } catch (Throwable e) {
                LOG.warn("Error stopping service {}", service.getClass().getName(), e);
            }
        }
    }
}
Also used : AtlasService(org.apache.atlas.annotation.AtlasService) PreDestroy(javax.annotation.PreDestroy)

Example 13 with PreDestroy

use of javax.annotation.PreDestroy in project presto by prestodb.

the class SqlTaskManager method close.

@Override
@PreDestroy
public void close() {
    boolean taskCanceled = false;
    for (SqlTask task : tasks.asMap().values()) {
        if (task.getTaskStatus().getState().isDone()) {
            continue;
        }
        task.failed(new PrestoException(SERVER_SHUTTING_DOWN, format("Server is shutting down. Task %s has been canceled", task.getTaskId())));
        taskCanceled = true;
    }
    if (taskCanceled) {
        try {
            TimeUnit.SECONDS.sleep(5);
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
        }
    }
    taskNotificationExecutor.shutdownNow();
}
Also used : SqlTask.createSqlTask(com.facebook.presto.execution.SqlTask.createSqlTask) PrestoException(com.facebook.presto.spi.PrestoException) PreDestroy(javax.annotation.PreDestroy)

Example 14 with PreDestroy

use of javax.annotation.PreDestroy in project pinpoint by naver.

the class FlinkClusterService method tearDown.

@PreDestroy
public void tearDown() {
    if (!config.isFlinkClusterEnable()) {
        logger.info("flink cluster disable.");
        return;
    }
    if (!(this.serviceState.changeStateDestroying())) {
        CommonState state = this.serviceState.getCurrentState();
        logger.info("{} already {}.", this.getClass().getSimpleName(), state.toString());
        return;
    }
    logger.info("{} destroying started.", this.getClass().getSimpleName());
    if (this.zookeeperClusterManager != null) {
        zookeeperClusterManager.stop();
    }
    if (client != null) {
        client.close();
    }
    this.serviceState.changeStateStopped();
    logger.info("{} destroying completed.", this.getClass().getSimpleName());
}
Also used : CommonState(com.navercorp.pinpoint.common.server.cluster.zookeeper.util.CommonState) PreDestroy(javax.annotation.PreDestroy)

Example 15 with PreDestroy

use of javax.annotation.PreDestroy in project wildfly by wildfly.

the class BeanOne method preDestroy.

@PreDestroy
public void preDestroy() {
    try {
        new InitialContext().lookup(TestResults.SHARED_BINDING_NAME_ONE);
        new InitialContext().lookup(TestResults.SHARED_BINDING_NAME_TWO);
        testResults.setPreDestroyOne(true);
    } catch (Throwable e) {
        e.printStackTrace();
        testResults.setPreDestroyOne(false);
    }
}
Also used : InitialContext(javax.naming.InitialContext) PreDestroy(javax.annotation.PreDestroy)

Aggregations

PreDestroy (javax.annotation.PreDestroy)45 ServiceDescriptor (org.opendaylight.infrautils.diagstatus.ServiceDescriptor)4 File (java.io.File)3 ObjectName (javax.management.ObjectName)3 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)2 PrestoException (com.facebook.presto.spi.PrestoException)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 Method (java.lang.reflect.Method)2 Principal (java.security.Principal)2 JMException (javax.management.JMException)2 MBeanServer (javax.management.MBeanServer)2 InitialContext (javax.naming.InitialContext)2 Terminated (akka.actor.Terminated)1 DruidDataSource (com.alibaba.druid.pool.DruidDataSource)1 SqlTask.createSqlTask (com.facebook.presto.execution.SqlTask.createSqlTask)1 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 IAtomicLong (com.hazelcast.cp.IAtomicLong)1 CollectorManager (com.navercorp.pinpoint.collector.manage.CollectorManager)1 CommonState (com.navercorp.pinpoint.common.server.cluster.zookeeper.util.CommonState)1 Cache (com.publiccms.common.api.Cache)1