protected void dispatchRequest ( int clientOid , int invCode , int methodId , Object [ ] args , Transport transport ) { // make sure the client is still around ClientObject source = ( ClientObject ) _omgr . getObject ( clientOid ) ; if ( source == null ) { log . info ( "Client no longer around for invocation request" , "clientOid" , clientOid , "code" , invCode , "methId" , methodId , "args" , args ) ; return ; } // look up the dispatcher Dispatcher disp = _dispatchers . get ( invCode ) ; if ( disp == null ) { log . info ( "Received invocation request but dispatcher registration was already cleared" , "code" , invCode , "methId" , methodId , "args" , args , "marsh" , _recentRegServices . get ( Integer . valueOf ( invCode ) ) ) ; return ; } // scan the args, initializing any listeners and keeping track of the "primary" listener ListenerMarshaller rlist = null ; int acount = args . length ; for ( int ii = 0 ; ii < acount ; ii ++ ) { Object arg = args [ ii ] ; if ( arg instanceof ListenerMarshaller ) { ListenerMarshaller list = ( ListenerMarshaller ) arg ; list . callerOid = clientOid ; list . omgr = _omgr ; list . transport = transport ; // keep track of the listener we'll inform if anything // goes horribly awry if ( rlist == null ) { rlist = list ; } } } log . debug ( "Dispatching invreq" , "caller" , source . who ( ) , "provider" , disp . getProvider ( ) , "methId" , methodId , "args" , args ) ; // dispatch the request try { if ( rlist != null ) { rlist . setInvocationId ( StringUtil . shortClassName ( disp . getProvider ( ) ) + ", methodId=" + methodId ) ; } disp . dispatchRequest ( source , methodId , args ) ; } catch ( InvocationException ie ) { if ( rlist != null ) { rlist . requestFailed ( ie . getMessage ( ) ) ; } else { log . warning ( "Service request failed but we've got no listener to inform of " + "the failure" , "caller" , source . who ( ) , "code" , invCode , "provider" , disp . getProvider ( ) , "methodId" , methodId , "args" , args , "error" , ie ) ; } } catch ( Throwable t ) { log . warning ( "Dispatcher choked" , "provider" , disp . getProvider ( ) , "caller" , source . who ( ) , "methId" , methodId , "args" , args , t ) ; // avoid logging an error when the listener notices that it's been ignored. if ( rlist != null ) { rlist . setNoResponse ( ) ; } } }
Called when we receive an invocation request message . Dispatches the request to the appropriate invocation provider via the registered invocation dispatcher .