本文整理汇总了Java中javax.annotation.PreDestroy类的典型用法代码示例。如果您正苦于以下问题:Java PreDestroy类的具体用法?Java PreDestroy怎么用?Java PreDestroy使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PreDestroy类属于javax.annotation包,在下文中一共展示了PreDestroy类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: dataSourceDestroy
import javax.annotation.PreDestroy; //导入依赖的package包/类
/**
* DataSource PreDestroy call-back
* @throws SQLException
*/
@PreDestroy()
public void dataSourceDestroy() throws SQLException {
// SQLException sqlException = null;
//
// try {
// applicationContext.getBean(DataSource.class)
// .getConnection()
// .close();
// } catch (SQLException e){
// sqlException = e;
// e.printStackTrace();
// }
if (database != null) {
database.shutdown();
}
// if(sqlException != null){
// throw sqlException;
// }
}
示例2: dispose
import javax.annotation.PreDestroy; //导入依赖的package包/类
public synchronized void dispose() {
if (disposed) {
return;
}
disposed = true;
masterTubeline.preDestroy();
for (Handler handler : binding.getHandlerChain()) {
for (Method method : handler.getClass().getMethods()) {
if (method.getAnnotation(PreDestroy.class) == null) {
continue;
}
try {
method.invoke(handler);
} catch (Exception e) {
logger.log(Level.WARNING, HandlerMessages.HANDLER_PREDESTROY_IGNORE(e.getMessage()), e);
}
break;
}
}
closeManagedObjectManager();
LazyMOMProvider.INSTANCE.unregisterEndpoint(this);
}
示例3: destroy
import javax.annotation.PreDestroy; //导入依赖的package包/类
@PreDestroy
public void destroy() {
P6SpyProperties p6spy = dataSourceDecoratorProperties.getP6spy();
if (!initialP6SpyOptions.containsKey("modulelist")) {
System.clearProperty("p6spy.config.modulelist");
}
if (!initialP6SpyOptions.containsKey("logMessageFormat")) {
if (p6spy.getLogFormat() != null) {
System.clearProperty("p6spy.config.logMessageFormat");
System.clearProperty("p6spy.config.customLogMessageFormat");
}
else if (p6spy.isMultiline()) {
System.clearProperty("p6spy.config.logMessageFormat");
}
}
if (!initialP6SpyOptions.containsKey("appender")) {
System.clearProperty("p6spy.config.appender");
}
if (!initialP6SpyOptions.containsKey("logfile")) {
System.clearProperty("p6spy.config.logfile");
}
P6ModuleManager.getInstance().reload();
}
示例4: close
import javax.annotation.PreDestroy; //导入依赖的package包/类
/**
* Spring容器关闭前先停止ID生成器的工作,并关闭ZK管理器
*/
@Override
@PreDestroy
public void close() throws IOException {
log.info("close zkManager before shutdown...");
suspend();
CloseableUtils.closeQuietly(zkManager);
}
示例5: dataSourceDestroy
import javax.annotation.PreDestroy; //导入依赖的package包/类
/**
* DataSource PreDestroy call-back
* @throws SQLException
*/
@PreDestroy()
public void dataSourceDestroy() throws SQLException {
if (database != null) {
database.shutdown();
}
}
示例6: shutdown
import javax.annotation.PreDestroy; //导入依赖的package包/类
@PreDestroy
private void shutdown() {
if (reporter == null) {
return;
}
reporter.stop();
reporter = null;
}
示例7: release
import javax.annotation.PreDestroy; //导入依赖的package包/类
@PreDestroy
public void release() {
databases.values().forEach(dbName -> {
try {
dropDB(dbName);
} catch (final RuntimeException e) {
// Don't stop dropping DBs if one of them fails. Notify the user, though.
LOG.error("Failed to cleanup PostgreSQL database {}", dbName, e);
}
});
}
示例8: release
import javax.annotation.PreDestroy; //导入依赖的package包/类
@PreDestroy
public void release() {
dbNames.forEach(dbName -> execute(
() -> {
LOG.debug("Cleaning up H2 database: {}", dbName);
connect(dbName, 0).close();
return null;
},
e -> "Failed to close H2 database"
));
}
示例9: shutdown
import javax.annotation.PreDestroy; //导入依赖的package包/类
@PreDestroy
public void shutdown() {
LOG.debug("Shutting down transactional context");
if (ejbContainer != null) {
ejbContainer.shutdown();
}
if (realm != null) {
realm.shutdown();
}
}
示例10: dataSourceDestroy
import javax.annotation.PreDestroy; //导入依赖的package包/类
/**
* DataSource PreDestroy call-back
* @throws SQLException
*/
@PreDestroy()
public void dataSourceDestroy() throws SQLException {
if (database != null) {
database.shutdown();
}
}
示例11: destroy
import javax.annotation.PreDestroy; //导入依赖的package包/类
/**
* Destroy.
*/
@PreDestroy
public void destroy() {
if (this.executorService != null) {
this.executorService.shutdownNow();
this.executorService = null;
}
}
示例12: stop
import javax.annotation.PreDestroy; //导入依赖的package包/类
@Override
@PreDestroy
public void stop() {
if (clientWebSocket != null && clientWebSocket.isOpen()) {
clientWebSocket.disconnect();
}
}
示例13: destroyApplication
import javax.annotation.PreDestroy; //导入依赖的package包/类
@PreDestroy
public void destroyApplication() {
log.info("\n----------------------------------------------------------\n\t"
+ "Application {} is closing"
+ "\n----------------------------------------------------------",
env.getProperty("spring.application.name"));
}
示例14: destroy
import javax.annotation.PreDestroy; //导入依赖的package包/类
/**
* Stops the couchbase client and cancels the initialization task if uncompleted.
*/
@PreDestroy
public void destroy() {
try {
couchbase.shutdown();
} catch (final Exception e) {
throw new RuntimeException(e);
}
}
示例15: destroy
import javax.annotation.PreDestroy; //导入依赖的package包/类
/**
* Destroy the client and shut down.
*/
@PreDestroy
public void destroy() {
if (this.client == null) {
return;
}
this.client.shutdown();
}