@ Override public Object preInvokeORBDispatch ( Object object , String operation ) { final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && tc . isDebugEnabled ( ) ) { // toString of 'object' can be quite large and can really bloat the // trace.... so just trace the class name; usually the tie name or // class loader name. The IOR or classpath is not traced. d133384 String objStr = null ; if ( object != null ) objStr = object . getClass ( ) . getName ( ) ; Tr . debug ( tc , "preInvokeORBDispatch(" + objStr + ", " + operation + ")" ) ; } EJBThreadData threadData = null ; if ( object instanceof javax . rmi . CORBA . Tie ) { object = ( ( javax . rmi . CORBA . Tie ) object ) . getTarget ( ) ; if ( object instanceof EJSWrapperBase ) { final EJSWrapperBase wrapper = ( EJSWrapperBase ) object ; BeanMetaData bmd = wrapper . bmd ; // null if EJBFactory if ( bmd != null ) { threadData = svThreadData . get ( ) ; // d153263 // push the old class loader to the ORB dispatch stack so that the wrapper classloader // can be popped off the "stack" before the marshalling the return object in the stub. // See any generated stub with input param and return to see the problem described in defect // // There are 2 paths need to be taken care of: // 1. in the normal case, the wrapper classloader is popped off when from container.postinvoke(). // 2. after the object resolver preInvoke is performed and exception takes place before // wrapper.postInvoke() has a chance to clean up. threadData . pushClassLoader ( bmd ) ; } } } // d646139.2 - For performance, return the EJBThreadData as the cookie to // avoid needing to look it up again in postInvokeORBDispatch. // d717291 - Return null to indicate a non-EJB request. return threadData ; // d646139.2 }
This method is driven when dispatch is called upon a server request . It should return a cookie Object which uniquely identifies this preinvoke . This cookie should be passed as a paramater when the corresponding postinvoke is called .