public void messageReceived(GenericIoWriter writer,
Message msg) throws Exception {
systemEventListener.debug( "Message receieved : " + msg );
MessageResponseHandler responseHandler = (MessageResponseHandler) responseHandlers.remove( msg.getResponseId() );
if ( responseHandler != null ) {
Object payload = msg.getPayload();
if (payload instanceof Command && ((Command)msg.getPayload()).getArguments().size() > 0 &&
((Command)msg.getPayload()).getArguments().get(0) instanceof RuntimeException)
payload = ((Command)msg.getPayload()).getArguments().get(0);
if (( payload != null && payload instanceof RuntimeException )) {
responseHandler.setError( (RuntimeException) payload );
} else {
responseHandler.receive( msg );
}
} else if ( handler != null ) {
this.handler.messageReceived( writer,
msg );
} else {