/** * Disposes the cached component instance * {@inheritDoc} */ public void dispose(PicoContainer container) { if ( delegateHasLifecylce ){ if (disposed) throw new IllegalStateException("Already disposed"); dispose(getComponentInstance(container)); disposed = true; } }
/** * Flushes the cache. * If the component instance is started is will stop and dispose it before * flushing the cache. */ public void flush() { Object instance = instanceReference.get(); if ( instance != null && delegateHasLifecylce && started ) { stop(instance); dispose(instance); } instanceReference.set(null); }