public void messageReceived ( MessageEvent event ) { if ( _msghandlers != null ) { MessageHandler handler = _msghandlers . get ( event . getName ( ) ) ; if ( handler != null ) { handler . handleEvent ( event , this ) ; } } // If the message is directed at us, see if it's a request for a method invocation if ( event . isPrivate ( ) ) { // aka if (event instanceof ServerMessageEvent) // the first argument should be the client object of the caller or null if it is // a server-originated event int srcoid = event . getSourceOid ( ) ; DObject source = ( srcoid <= 0 ) ? null : _omgr . getObject ( srcoid ) ; String method = event . getName ( ) ; Object [ ] args = event . getArgs ( ) , nargs ; // validate that this call is allowed if ( ! allowManagerCall ( method ) ) { log . warning ( "Client tried to invoke forbidden manager call!" , "source" , source , "method" , method , "args" , args ) ; return ; } if ( args == null ) { nargs = new Object [ ] { source } ; } else { nargs = new Object [ args . length + 1 ] ; nargs [ 0 ] = source ; System . arraycopy ( args , 0 , nargs , 1 , args . length ) ; } // Lazily create our dispatcher now that it's actually getting a message if ( _dispatcher == null ) { Class < ? > clazz = getClass ( ) ; MethodFinder finder = _dispatcherFinders . get ( clazz ) ; if ( finder == null ) { finder = new MethodFinder ( clazz ) ; _dispatcherFinders . put ( clazz , finder ) ; } _dispatcher = new DynamicListener < DSet . Entry > ( this , finder ) ; } _dispatcher . dispatchMethod ( method , nargs ) ; } }
from interface MessageListener