ee/src/main/java/org/jboss/as/ee/component/ManagedReferenceLifecycleMethodInterceptor.java
public Object processInvocation(final InterceptorContext context) throws Exception {
        final ManagedReference reference = (ManagedReference) context.getPrivateData(ComponentInstance.class).getInstanceData(contextKey);
        final Object instance = reference.getInstance();
        try {
            final Method method = this.method;
            if (withContext) {
                final Method oldMethod = context.getMethod();
                try {
                    if (this.lifecycleMethod) {
                        // because InvocationContext#getMethod() is expected to return null for lifecycle methods
                        context.setMethod(null);
                        return method.invoke(instance, context.getInvocationContext());
                    } else if (this.changeMethod) {
                        context.setMethod(method);
                        return method.invoke(instance, context.getInvocationContext());
                    } else {
                        return method.invoke(instance, context.getInvocationContext());
                    }
                } finally {
                    // reset any changed method on the interceptor context
                    context.setMethod(oldMethod);
                }
            } else {
                method.invoke(instance);
                return context.proceed();
            }
        } catch (IllegalAccessException e) {
            final IllegalAccessError n = new IllegalAccessError(e.getMessage());
            n.setStackTrace(e.getStackTrace());
            throw n;
        } catch (InvocationTargetException e) {
            throw Interceptors.rethrow(e.getCause());
        }
    }
public Object processInvocation(final InterceptorContext context) throws Exception {
        final ManagedReference reference = (ManagedReference) context.getPrivateData(ComponentInstance.class).getInstanceData(contextKey);
        final Object instance = reference.getInstance();
        try {
            final Method method = this.method;
            if (withContext) {
                final Method oldMethod = context.getMethod();
                try {
                    if (this.lifecycleMethod) {
                        // because InvocationContext#getMethod() is expected to return null for lifecycle methods
                        context.setMethod(null);
                        return method.invoke(instance, context.getInvocationContext());
                    } else if (this.changeMethod) {
                        context.setMethod(method);
                        return method.invoke(instance, context.getInvocationContext());
                    } else {
                        return method.invoke(instance, context.getInvocationContext());
                    }
                } finally {
                    // reset any changed method on the interceptor context
                    context.setMethod(oldMethod);
                }
            } else {
                method.invoke(instance);
                return context.proceed();
            }
        } catch (IllegalAccessException e) {
            final IllegalAccessError n = new IllegalAccessError(e.getMessage());
            n.setStackTrace(e.getStackTrace());
            throw n;
        } catch (InvocationTargetException e) {
            throw Interceptors.rethrow(e.getCause());
        }
    }
{@inheritDoc}