@Override public void close() { if (isClosed()) { throw new ClosedInjectorException(this); } for (Key<?> key : delegate.getAllBindings().keySet()) { try { com.google.inject.Binding<?> binding = delegate.getExistingBinding(key); if (!Scopes.isSingleton(binding)) { continue; } invokeAnnotatedMethod(binding.getProvider().get(), PreDestroy.class); } catch (ProvisionException pe) { if (!(pe.getCause() instanceof TypeNotFoundException)) { pe.printStackTrace(); } } } synchronized (lock) { closed = true; } }