/** * Stops the cleaner thread. Calling this method is recommended in all long running applications * with custom class loaders (e.g., web applications). */ public void exit() { // try to stop it gracefully synchronized (this) { referenceQueue = null; } this.interrupt(); try { this.join(500); } catch (InterruptedException e) { } // last resort tentative to kill the cleaner thread if (this.isAlive()) this.stop(); } }
/** * Stops the cleaner thread. Calling this method is recommended in all long running applications * with custom class loaders (e.g., web applications). */ public void exit() { // try to stop it gracefully synchronized (this) { referenceQueue = null; } this.interrupt(); try { this.join(500); } catch (InterruptedException e) { } // last resort tentative to kill the cleaner thread if (this.isAlive()) this.stop(); } }