/** Invokes all cleanups registered with {@link #add}. */ public static void cleanup() { final List cleanups; synchronized (_cleanups) { cleanups = new ArrayList(_cleanups); } for (Iterator it = cleanups.iterator(); it.hasNext(); ) { final Cleanup cleanup = (Cleanup) it.next(); try { cleanup.cleanup(); } catch (Throwable ex) { log.error("Failed to invoke " + cleanup); } } }
@Override public void close() throws Exception { cleanup.cleanup(); }