@Override public T getComponentInstance(final PicoContainer container, final Type into) throws PicoCompositionException { final Constructor<?> constructor = getConstructor(); boolean iInstantiated = false; T result; try { if (instantiationGuard == null) { iInstantiated = true; instantiationGuard = new ThreadLocalCyclicDependencyGuard<T>() { @Override public T run(final Object instance) { final ParameterToAccessibleObjectPair[] matchingParameters = getMatchingParameterListForMembers(guardedContainer); Object componentInstance = makeInstance(container, constructor, currentMonitor()); return decorateComponentInstance(matchingParameters, currentMonitor(), componentInstance, container, guardedContainer, into, null); } }; } instantiationGuard.setGuardedContainer(container); result = instantiationGuard.observe(getComponentImplementation(), null); } finally { if (iInstantiated) { instantiationGuard.remove(); instantiationGuard = null; } } return result; }
@Override public T getComponentInstance(final PicoContainer container, final Type into) throws PicoCompositionException { final Constructor<?> constructor = getConstructor(); boolean iInstantiated = false; T result; try { if (instantiationGuard == null) { iInstantiated = true; instantiationGuard = new ThreadLocalCyclicDependencyGuard<T>() { @Override public T run(final Object instance) { final ParameterToAccessibleObjectPair[] matchingParameters = getMatchingParameterListForMembers(guardedContainer); Object componentInstance = makeInstance(container, constructor, currentMonitor()); return decorateComponentInstance(matchingParameters, currentMonitor(), componentInstance, container, guardedContainer, into, null); } }; } instantiationGuard.setGuardedContainer(container); result = instantiationGuard.observe(getComponentImplementation(), null); } finally { if (iInstantiated) { instantiationGuard.remove(); instantiationGuard = null; } } return result; }