@Override public void destroy() { if (destroyed.getAndSet(true)) throw new RuntimeException("Already destroyed"); mirror.shutdown(); orb.transport().shutdown().join(); }
/** * Sets the destroyed flag to true. The very first time this method is called, it cleans up all its dependencies. * Even if you retain a reference to this object, all of its content is allowed to be garbage collected. * * @return True if content existed and was destroyed. */ public boolean destroy() { if (!destroyed.getAndSet(true)) { if (slobroksConfig != null) { slobroksConfig.shutdown(); } register.shutdown(); mirror.shutdown(); listener.shutdown().join(); orb.transport().shutdown().join(); targetPool.flushTargets(true); executor.shutdown(); return true; } return false; }