use of javax.annotation.PreDestroy in project wildfly by wildfly.
the class DatabaseCreatorBean method dropTables.
@PreDestroy
public void dropTables() {
try {
final Connection conn = ds.getConnection();
executeUpdate(conn, "DROP TABLE " + TABLE_NAME_ROLES);
executeUpdate(conn, "DROP TABLE " + TABLE_NAME_USERS);
conn.close();
} catch (SQLException e) {
LOGGER.error("Dropping tables failed", e);
}
}
use of javax.annotation.PreDestroy in project midpoint by Evolveum.
the class TaskManagerQuartzImpl method shutdown.
@PreDestroy
public void shutdown() {
OperationResult result = createOperationResult("shutdown");
LOGGER.info("Task Manager shutdown starting");
if (executionManager.getQuartzScheduler() != null) {
executionManager.stopScheduler(getNodeId(), result);
executionManager.stopAllTasksOnThisNodeAndWait(0L, result);
if (configuration.isTestMode()) {
LOGGER.info("Quartz scheduler will NOT be shutdown. It stays in paused mode.");
} else {
try {
executionManager.shutdownLocalScheduler();
} catch (TaskManagerException e) {
LoggingUtils.logUnexpectedException(LOGGER, "Cannot shutdown Quartz scheduler, continuing with node shutdown", e);
}
}
}
clusterManager.stopClusterManagerThread(0L, result);
clusterManager.recordNodeShutdown(result);
if (configuration.isJdbcJobStore() && configuration.isDatabaseIsEmbedded()) {
LOGGER.trace("Waiting {} msecs to give Quartz thread pool a chance to shutdown.", WAIT_ON_SHUTDOWN);
try {
Thread.sleep(WAIT_ON_SHUTDOWN);
} catch (InterruptedException e) {
// safe to ignore
}
}
LOGGER.info("Task Manager shutdown finished");
}
use of javax.annotation.PreDestroy in project cas by apereo.
the class MongoDbAuthenticationHandler method close.
@PreDestroy
@Override
public void close() {
try {
final MongoProfileService service = MongoProfileService.class.cast(authenticator);
service.getMongoClient().close();
} catch (final Exception e) {
LOGGER.error(e.getMessage(), e);
}
}
use of javax.annotation.PreDestroy in project netvirt by opendaylight.
the class BgpAlarmBroadcaster method close.
@Override
@PreDestroy
public void close() {
try {
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
ObjectName objectName = objectName();
if (mbs.isRegistered(objectName)) {
mbs.unregisterMBean(objectName);
}
} catch (JMException e) {
LOG.error("Error unregistering MXBean", e);
}
}
use of javax.annotation.PreDestroy in project cf-java-client by cloudfoundry.
the class _DefaultConnectionContext method dispose.
/**
* Disposes resources created to service this connection context
*/
@PreDestroy
public final void dispose() {
getConnectionPool().ifPresent(PoolResources::dispose);
getThreadPool().dispose();
try {
ObjectName name = getByteBufAllocatorObjectName();
if (ManagementFactory.getPlatformMBeanServer().isRegistered(name)) {
ManagementFactory.getPlatformMBeanServer().unregisterMBean(name);
}
} catch (JMException e) {
this.logger.error("Unable to register ByteBufAllocator MBean", e);
}
}
Aggregations