/** * 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; // } }
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); }
@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(); }
/** * Spring容器关闭前先停止ID生成器的工作,并关闭ZK管理器 */ @Override @PreDestroy public void close() throws IOException { log.info("close zkManager before shutdown..."); suspend(); CloseableUtils.closeQuietly(zkManager); }
/** * DataSource PreDestroy call-back * @throws SQLException */ @PreDestroy() public void dataSourceDestroy() throws SQLException { if (database != null) { database.shutdown(); } }
@PreDestroy public void destroy() { log.info("Stopping Kafka Producer...."); try { this.producer.close(); } catch (Exception e) { log.error("Failed to close producer during destroy()", e); throw new RuntimeException(e); } log.info("Kafka Producer is stopped now...."); }
@PreDestroy private void shutdown() { if (reporter == null) { return; } reporter.stop(); reporter = null; }
@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); } }); }
@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" )); }
@PreDestroy public void shutdown() { LOG.debug("Shutting down transactional context"); if (ejbContainer != null) { ejbContainer.shutdown(); } if (realm != null) { realm.shutdown(); } }
/** * Destroy. */ @PreDestroy public void destroy() { if (this.executorService != null) { this.executorService.shutdownNow(); this.executorService = null; } }
@Override @PreDestroy public void stop() { if (clientWebSocket != null && clientWebSocket.isOpen()) { clientWebSocket.disconnect(); } }
@PreDestroy public void destroyApplication() { log.info("\n----------------------------------------------------------\n\t" + "Application {} is closing" + "\n----------------------------------------------------------", env.getProperty("spring.application.name")); }
/** * Stops the couchbase client. */ @PreDestroy public void destroy() { try { couchbase.shutdown(); } catch (final Exception e) { throw new RuntimeException(e); } }
/** * 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); } }
/** * Destroy the client and shut down. */ @PreDestroy public void destroy() { if (this.client == null) { return; } this.client.shutdown(); }
@Override @PreDestroy public void close() { LOGGER.debug("Shutting down LDAP server..."); this.directoryServer.closeAllConnections(true); this.directoryServer.shutDown(true); LOGGER.debug("Shut down LDAP server."); }
@Override @PreDestroy public void onUnload() { // close down thread synchronized (this) { open = false; notifyAll(); } }
/** * Close connection pull and shut down the executor. */ @PreDestroy public void destroy() { logger.debug("Shutting down connection pools..."); for (final PooledConnectionFactory factory : connectionPoolMap.values()) { factory.getConnectionPool().close(); } }
@PreDestroy public void shutdown() throws InterruptedException { log.info("Stopping MQTT transport!"); try { serverChannel.close().sync(); } finally { bossGroup.shutdownGracefully(); workerGroup.shutdownGracefully(); } log.info("MQTT transport stopped!"); }
@PreDestroy public void destroy() { log.info("Remove Cache Manager metrics"); SortedSet<String> names = metricRegistry.getNames(); names.forEach(metricRegistry::remove); log.info("Closing Cache Manager"); cacheManager.shutdown(); }
/** * Pre-Destroy TearDown of Container. * Here we Destroy our SecretKey and JWS Signer. */ @PreDestroy public void shutdown() { /** * Shutdown Component */ LOGGER.info("{}YourMicroserviceToken Component Shutdown commencing...", LOGGING_HEADER); secretKey = null; jwsSigner = null; LOGGER.info("{}YourMicroserviceToken Component Shutdown Completed, ready for Bean Removal.", LOGGING_HEADER); }
@PreDestroy public void done() { Thread t = connectionHandler; if (t != null) t.interrupt(); }
private <T> List<InvokableLifecycleMethod> findPreDestroyMethods(T injectee, Class<?> type) { List<InvokableLifecycleMethod> preDestroyMethods = new ArrayList<InvokableLifecycleMethod>(); for (Method method : getAllMethods(type)) { if (method.isAnnotationPresent(PreDestroy.class)) { preDestroyMethods.add(new InvokableLifecycleMethodImpl(injectee, method, PreDestroy.class)); } } return preDestroyMethods; }
/** * This method will be called when Spring app is destroyed */ @PreDestroy public void removeSystemTray() { if (trayIcon != null) { final SystemTray tray = SystemTray.getSystemTray(); tray.remove(trayIcon); } }
@PreDestroy public void destroy() { JobOperator jo = BatchRuntime.getJobOperator(); stashList.stream() .map(HashMap::keySet) .flatMap(Collection::stream) // join multiple sets together .forEach(jo::stop); // signal every job that we are going down and they should stop }
@PreDestroy public void destory() { monitorDataCenterPool.clear(); zkUtils.destory(); }
@PreDestroy public void shutdown() { log.info("Stopping CoAP transport!"); this.server.destroy(); log.info("CoAP transport stopped!"); }
@PreDestroy private void cleanup() { if (cacheManager != null) cacheManager.stop(); }
@PreDestroy protected void preDestroy() { result = "preDestroy()"; }
@PreDestroy public void free(){ broadcaster.close(); System.out.println("broadcaster closed"); }
@PreDestroy public void preDestroy() { if (brokers != null) { brokers.forEach(FileMonitor::stop); } }
@PreDestroy public void close() { eventConsumer.stop(); }
@PreDestroy public void stop() { log.info("****** Stopping SMTP Server for domain " + smtpServer.getHostName() + " on port " + smtpServer.getPort()); smtpServer.stop(); }
@PreDestroy public void destroy() { log.info("Closing Cache Manager"); Hazelcast.shutdownAll(); }
@PreDestroy protected void destroy() throws IOException { FileUtils.deleteDirectory(folder.toFile()); }