/** {@inheritDoc} */
 public Object processInvocation(final InterceptorContext context) throws Exception {
   Object target = targetReference.get().getInstance();
   if (target == null) {
     throw new IllegalStateException("No injection target found");
   }
   // if it's an optional injection and the injection source isn't available, then just proceed by
   // skipping the injection
   if (this.factory == null && this.optionalInjection) {
     return context.proceed();
   }
   ManagedReference reference = factory.getReference();
   boolean ok = false;
   try {
     valueReference.set(reference);
     method.invoke(target, reference.getInstance());
     Object result = context.proceed();
     ok = true;
     return result;
   } finally {
     if (!ok) {
       valueReference.set(null);
       reference.release();
     }
   }
 }