@ Override public Object invoke ( Object self , Method method , Method proceed , Object [ ] args ) throws Throwable { if ( "destroy" . equals ( method . getName ( ) ) && Marker . isMarker ( 0 , method , args ) ) { if ( bean . getEjbDescriptor ( ) . isStateful ( ) ) { if ( ! reference . isRemoved ( ) ) { reference . remove ( ) ; } } return null ; } if ( ! bean . isClientCanCallRemoveMethods ( ) && isRemoveMethod ( method ) ) { throw BeanLogger . LOG . invalidRemoveMethodInvocation ( method ) ; } Class < ? > businessInterface = getBusinessInterface ( method ) ; if ( reference . isRemoved ( ) && isToStringMethod ( method ) ) { return businessInterface . getName ( ) + " [REMOVED]" ; } Object proxiedInstance = reference . getBusinessObject ( businessInterface ) ; if ( ! Modifier . isPublic ( method . getModifiers ( ) ) ) { throw new EJBException ( "Not a business method " + method . toString ( ) + ". Do not call non-public methods on EJB's." ) ; } Object returnValue = Reflections . invokeAndUnwrap ( proxiedInstance , method , args ) ; BeanLogger . LOG . callProxiedMethod ( method , proxiedInstance , args , returnValue ) ; return returnValue ; }
Looks up the EJB in the container and executes the method on it