public void mdbMethodPostInvoke ( ) throws Throwable { // If there is a registered message endpoint collaborator, call it for postInvoke processing. Map < String , Object > meContext = ivEJSDeployedSupport . getMessageEndpointContext ( ) ; if ( meContext != null ) { MessageEndpointCollaborator meCollaborator = container . getEJBRuntime ( ) . getMessageEndpointCollaborator ( this . bmd ) ; if ( meCollaborator != null ) { try { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Invoking MECollaborator " + meCollaborator + " for postInvoke processing with the following context data: " + meContext ) ; } meCollaborator . postInvoke ( meContext ) ; } finally { ivEJSDeployedSupport . setMessageEndpointContext ( null ) ; } } } // Since checkState method in this class preceeded the call // to this method, we know we are running in the correct // thread and the correct Proxy instance is using this // MessageEndpointBase. Therefore, we can safely examine // ivState outside of a synchronization block. However, // to change the state, we do need to make change inside a // synchronization block. This is necessary to ensure the // checkState method throws IllegalStateException if some other // thread tries to use this InvocationHandler instance while // this thread is using the instance. This should never happen, but // JCA 1.5 requires us to throw IllegalStateException if it does happen. // If it does happen, then resource adapter does not comply with // JCA 1.5 specification (or there is a bug in this class). if ( ivState == IN_METHOD_OPTION_B_STATE ) { // Option B message delivery was used. So // change the state to afterDelivery is pending. // postInvoke processing is deferred until the // afterDelivery method is invoked by RA. // Necessary since we are required to leave // transaction active until afterDelivery occurs. synchronized ( this ) { ivState = AFTER_DELIVERY_PENDING_STATE ; } } else { // OPTION A message delivery was used, // so do the postInvoke processing now and // enter the READY_STATE. try { if ( ivEJSDeployedSupport != null ) { // Preinvoke did occur, so do post invoke processing. container . postInvoke ( this , ivMethodId , ivEJSDeployedSupport ) ; } } catch ( EJBException e ) { //FFDCFilter.processException(e, CLASS_NAME + "mdbMethodPostInvoke", "589", this); throw e ; } catch ( Throwable e ) { FFDCFilter . processException ( e , CLASS_NAME + ".mdbMethodPostInvoke" , "1106" , this ) ; if ( ivEJSDeployedSupport != null ) { ivEJSDeployedSupport . setUncheckedLocalException ( e ) ; } // if we get this far, then setUncheckedLocalException // for some reason did not throw an exception. If that // happens, we will throw an EJBException since that is // what EJB spec requires for MDB. EJBException ejbex = new EJBException ( ) ; ejbex . initCause ( e ) ; throw e ; } finally { // Release objects no longer needed. ivEJSDeployedSupport = null ; ivMDB = null ; // Option A message processing completed, so re-enter the ready state // to indicate we are ready to handle the next message. synchronized ( this ) { ivState = READY_STATE ; ivThread = null ; } } } }
Must be called when MDB method completes so that internal state is updated to reflect the completion of MDB method invocation .