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);
}
}
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);
}
}
}
}
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();
}
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());
}
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);
}
}
Aggregations