本文整理匯總了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();
}