protected void injectInstance ( ManagedObject < ? > managedObject , Object instance , InjectionTargetContext injectionContext ) throws EJBException { final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "injectInstance : " + Util . identity ( managedObject ) + ", " + injectionContext ) ; // Its valid to just check the InjectionTargets visible to the bean itself, // because any InjectionTargets visible to the interceptors were already // processed when the interceptors were created. BeanMetaData bmd = home . beanMetaData ; if ( bmd . ivBeanInjectionTargets != null ) { try { //if CDI is enabled then there will be a managedObject and it should be used for injection, otherwise go directly to the injection enging if ( managedObject != null ) { managedObject . inject ( bmd . ivBeanInjectionTargets , injectionContext ) ; } else { InjectionEngine injectionEngine = getInjectionEngine ( ) ; for ( InjectionTarget injectionTarget : bmd . ivBeanInjectionTargets ) { injectionEngine . inject ( ivEjbInstance , injectionTarget , injectionContext ) ; } } } catch ( Throwable t ) { if ( ! ( t instanceof ManagedObjectException ) ) { FFDCFilter . processException ( t , CLASS_NAME + ".injectInstance" , "151" , this ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "injectInstance : Injection failure" , t ) ; throw ExceptionUtil . EJBException ( "Injection failure" , t ) ; } else { Throwable cause = t . getCause ( ) ; FFDCFilter . processException ( cause , CLASS_NAME + ".injectInstance" , "157" , this ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "injectInstance : Injection failure" , cause ) ; throw ExceptionUtil . EJBException ( "Injection failure" , cause ) ; } } } if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "injectInstance" ) ; }
Performs resource injection for the managed object instance .