Search in sources :

Example 26 with PreDestroy

use of javax.annotation.PreDestroy in project che by eclipse.

the class ServerInitializerImpl method shutdown.

@PreDestroy
protected void shutdown() {
    for (LanguageServer server : serversToInitResult.keySet()) {
        server.shutdown();
        server.exit();
    }
}
Also used : LanguageServer(io.typefox.lsapi.services.LanguageServer) PreDestroy(javax.annotation.PreDestroy)

Example 27 with PreDestroy

use of javax.annotation.PreDestroy in project che by eclipse.

the class CheEnvironmentEngine method cleanup.

/**
     * Removes all descriptors from the in-memory storage, while
     * {@link MachineProcessManager#cleanup()} is responsible for machines destroying.
     */
@PreDestroy
@VisibleForTesting
@SuppressWarnings("unused")
void cleanup() {
    isPreDestroyInvoked = true;
    final java.io.File[] files = machineLogsDir.listFiles();
    if (files != null && files.length > 0) {
        for (java.io.File f : files) {
            if (!IoUtil.deleteRecursive(f)) {
                LOG.warn("Failed delete {}", f);
            }
        }
    }
}
Also used : File(java.io.File) File(java.io.File) VisibleForTesting(com.google.common.annotations.VisibleForTesting) PreDestroy(javax.annotation.PreDestroy)

Example 28 with PreDestroy

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

the class SqlQueryManager method stop.

@PreDestroy
public void stop() {
    boolean queryCancelled = false;
    for (QueryExecution queryExecution : queries.values()) {
        if (queryExecution.getState().isDone()) {
            continue;
        }
        log.info("Server shutting down. Query %s has been cancelled", queryExecution.getQueryId());
        queryExecution.fail(new PrestoException(SERVER_SHUTTING_DOWN, "Server is shutting down. Query " + queryExecution.getQueryId() + " has been cancelled"));
        queryCancelled = true;
    }
    if (queryCancelled) {
        try {
            TimeUnit.SECONDS.sleep(5);
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
        }
    }
    queryManagementExecutor.shutdownNow();
    queryExecutor.shutdownNow();
}
Also used : PrestoException(com.facebook.presto.spi.PrestoException) PreDestroy(javax.annotation.PreDestroy)

Example 29 with PreDestroy

use of javax.annotation.PreDestroy in project rocketmq-externals by apache.

the class TestRocketMQServer method shutdown.

@PreDestroy
private void shutdown() {
    brokerController.shutdown();
    namesrvController.shutdown();
    deleteFile(new File(TEST_FILE_ROOT_DIR));
}
Also used : File(java.io.File) PreDestroy(javax.annotation.PreDestroy)

Example 30 with PreDestroy

use of javax.annotation.PreDestroy in project PublicCMS-preview by sanluan.

the class CacheComponent method clear.

/**
 */
@PreDestroy
public void clear() {
    for (Cache cache : cacheableList) {
        cache.clear();
    }
    clearViewCache();
    hqlService.clear();
}
Also used : Cache(com.publiccms.common.api.Cache) 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