/** * Stops the cached component instance * {@inheritDoc} */ public void stop(PicoContainer container) { if ( delegateHasLifecylce ){ if (disposed) throw new IllegalStateException("Already disposed"); if (!started) throw new IllegalStateException("Not started"); stop(getComponentInstance(container)); started = false; } }
/** * 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); }