use of javax.annotation.PreDestroy in project metacat by Netflix.
the class DataSourceManager method close.
/**
* Closes all the data sources stored in the manager.
*/
@PreDestroy
public void close() {
final Iterator<DataSource> iter = dataSources.values().iterator();
while (iter.hasNext()) {
final DataSourceProxy dataSource = (DataSourceProxy) iter.next();
if (dataSource != null) {
dataSource.close();
}
iter.remove();
}
}
use of javax.annotation.PreDestroy in project cxf by apache.
the class ServerRegistryImpl method preShutdown.
@PreDestroy
public void preShutdown() {
// Shutdown the service.
// To avoid the CurrentModificationException, do not use serversList directly
Object[] servers = serversList.toArray();
for (int i = 0; i < servers.length; i++) {
Server server = (Server) servers[i];
server.destroy();
}
}
use of javax.annotation.PreDestroy in project cxf by apache.
the class RMManager method shutdown.
@PreDestroy
public void shutdown() {
// shutdown remaining endpoints
if (!reliableEndpoints.isEmpty()) {
LOG.log(Level.FINE, "Shutting down RMManager with {0} remaining endpoints.", new Object[] { Integer.valueOf(reliableEndpoints.size()) });
for (RMEndpoint rme : reliableEndpoints.values()) {
rme.shutdown();
}
}
// remove references to timer tasks cancelled above to make them
// eligible for garbage collection
Timer t = getTimer(false);
if (t != null) {
t.purge();
t.cancel();
}
// unregistring of this managed bean from the server is done by the bus itself
}
use of javax.annotation.PreDestroy in project flow by vaadin.
the class DestroyBean method preDestroy.
@PreDestroy
public void preDestroy() {
UI ui = UI.getCurrent();
Div info = new Div();
info.setText("Bean is destroyed");
info.addClassName("info");
ui.add(info);
}
use of javax.annotation.PreDestroy in project Payara by payara.
the class AbstractJMSContextManager method cleanup.
// Close and remove the JMSContext instances
@PreDestroy
public synchronized void cleanup() {
ServiceLocator serviceLocator = Globals.get(ServiceLocator.class);
InvocationManager invMgr = serviceLocator.getService(InvocationManager.class);
ComponentInvocation currentInv = invMgr.getCurrentInvocation();
for (Entry<String, JMSContextEntry> entry : contexts.entrySet()) {
JMSContextEntry contextEntry = entry.getValue();
String ipId = contextEntry.getInjectionPointId();
JMSContext context = contextEntry.getCtx();
if (context != null) {
ComponentInvocation inv = contextEntry.getComponentInvocation();
if (inv != null && currentInv != inv)
invMgr.preInvoke(inv);
try {
context.close();
if (logger.isLoggable(Level.FINE)) {
logger.log(Level.FINE, localStrings.getLocalString("JMSContext.impl.close", "Closed JMSContext instance associated with id {0}: {1}.", ipId, context.toString()));
}
} catch (Exception e) {
logger.log(Level.SEVERE, localStrings.getLocalString("JMSContext.impl.close.failure", "Failed to close JMSContext instance associated with id {0}: {1}.", ipId, context.toString()), e);
} finally {
if (inv != null && currentInv != inv)
invMgr.postInvoke(inv);
}
}
}
contexts.clear();
}
Aggregations