try { Object[] parameters = getConstructorArguments(guardedContainer, constructor); componentMonitor.instantiating(constructor); long startTime = System.currentTimeMillis(); Object inst = newInstance(constructor, parameters); componentMonitor.instantiated(constructor, System.currentTimeMillis() - startTime); return inst; } catch (InvocationTargetException e) { componentMonitor.instantiationFailed(constructor, e); if (e.getTargetException() instanceof RuntimeException) { throw (RuntimeException) e.getTargetException(); componentMonitor.instantiationFailed(constructor, e); throw new PicoInitializationException("Should never get here"); componentMonitor.instantiationFailed(constructor, e); throw new PicoInitializationException(e);
public void invocationFailed(Method method, Object instance, Exception cause) { delegate.invocationFailed(method, instance, cause); }
public void invoked(Method method, Object instance, long duration) { delegate.invoked(method, instance, duration); }
try { long startTime = System.currentTimeMillis(); componentMonitor.instantiating(constructor); componentInstance = newInstance(constructor, null); componentMonitor.instantiated(constructor, System.currentTimeMillis() - startTime); } catch (InvocationTargetException e) { componentMonitor.instantiationFailed(constructor, e); if (e.getTargetException() instanceof RuntimeException) { throw (RuntimeException) e.getTargetException(); componentMonitor.instantiationFailed(constructor, e); throw new PicoInitializationException("Should never get here"); componentMonitor.instantiationFailed(constructor, e); throw new PicoInitializationException(e); for (int i = 0; i < setters.size(); i++) { setter = (Method) setters.get(i); componentMonitor.invoking(setter, componentInstance); long startTime = System.currentTimeMillis(); setter.invoke(componentInstance, new Object[]{matchingParameters[i].resolveInstance(guardedContainer, SetterInjectionComponentAdapter.this, setterTypes[i])}); componentMonitor.invoked(setter, componentInstance, System.currentTimeMillis() - startTime); componentMonitor.invocationFailed(setter, componentInstance, e); if (e.getTargetException() instanceof RuntimeException) { throw (RuntimeException) e.getTargetException(); componentMonitor.invocationFailed(setter, componentInstance, e); throw new PicoInvocationTargetInitializationException(e);
public void dispose(Object component) { if (component != null && component instanceof Disposable) { long str = System.currentTimeMillis(); currentMonitor().invoking(dispose, component); try { ((Disposable) component).dispose(); currentMonitor().invoked(dispose, component, System.currentTimeMillis() - str); } catch (RuntimeException cause) { currentMonitor().lifecycleInvocationFailed(dispose, component, cause); // may re-throw } } }
protected Object invoke(final Object target) { final Method method = getMethod(); try { componentMonitor.invoking(method, target); final long startTime = System.currentTimeMillis(); super.invoke(target); componentMonitor.invoked(method, target, System.currentTimeMillis() - startTime); } catch (final PicoIntrospectionException e) { componentMonitor.invocationFailed(method, target, (Exception)e.getCause()); throw e; } return Void.TYPE; }
public void instantiationFailed(Constructor constructor, Exception cause) { delegate.instantiationFailed(constructor, cause); }
public void instantiating(Constructor constructor) { delegate.instantiating(constructor); }
public void instantiated(Constructor constructor, long duration) { delegate.instantiated(constructor, duration); }
public void invoking(Method method, Object instance) { delegate.invoking(method, instance); }
public void lifecycleInvocationFailed(Method method, Object instance, RuntimeException cause) { delegate.lifecycleInvocationFailed(method,instance, cause); }
/** {@inheritDoc} **/ public Behavior newBehavior(Behavior behavior) { return delegate.newBehavior(behavior); }
public void start(Object component) { if (component != null && component instanceof Startable) { long str = System.currentTimeMillis(); currentMonitor().invoking(start, component); try { ((Startable) component).start(); currentMonitor().invoked(start, component, System.currentTimeMillis() - str); } catch (RuntimeException cause) { currentMonitor().lifecycleInvocationFailed(start, component, cause); // may re-throw } } }
public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable { Object componentInstance = getDelegate().getComponentInstance(container); ComponentMonitor componentMonitor = currentMonitor(); try { componentMonitor.invoking(method, componentInstance); long startTime = System.currentTimeMillis(); Object object = method.invoke(componentInstance, args); componentMonitor.invoked(method, componentInstance, System.currentTimeMillis() - startTime); return object; } catch (final InvocationTargetException ite) { componentMonitor.invocationFailed(method, componentInstance, ite); throw ite.getTargetException(); } } });
public void instantiationFailed(Constructor constructor, Exception e) { delegate.instantiationFailed(constructor, e); }
public void instantiating(Constructor constructor) { delegate.instantiating(constructor); }
public void instantiated(Constructor constructor, long duration) { delegate.instantiated(constructor, duration); }
public void invoking(Method method, Object instance) { delegate.invoking(method, instance); }
public void lifecycleInvocationFailed(Method method, Object instance, RuntimeException cause) { lifecycleFailures.add(cause); delegate.lifecycleInvocationFailed(method, instance, cause); }
/** {@inheritDoc} **/ public Behavior newBehavior(Behavior behavior) { return delegate.newBehavior(behavior); }