/** * Handle the exception we got. * * @param session The session we got the exception on * @param cause The exception cause * @throws Exception If we have had another exception */ @Override public void exceptionCaught( IoSession session, Throwable cause ) throws Exception { if ( LOG.isWarnEnabled() ) { LOG.warn( cause.getMessage(), cause ); } session.setAttribute( EXCEPTION_KEY, cause ); if ( cause instanceof ProtocolEncoderException ) { Throwable realCause = ( ( ProtocolEncoderException ) cause ).getCause(); if ( realCause instanceof MessageEncoderException ) { int messageId = ( ( MessageEncoderException ) realCause ).getMessageId(); ResponseFuture<?> response = futureMap.get( messageId ); response.cancel( true ); response.setCause( realCause ); } } session.closeNow(); }
throw new MessageEncoderException( message.getMessageId(), ee.getMessage(), ee );
throw new MessageEncoderException( message.getMessageId(), ee.getMessage(), ee );
/** * Handle the exception we got. * * @param session The session we got the exception on * @param cause The exception cause * @throws Exception If we have had another exception */ @Override public void exceptionCaught( IoSession session, Throwable cause ) throws Exception { if ( LOG.isWarnEnabled() ) { LOG.warn( cause.getMessage(), cause ); } session.setAttribute( EXCEPTION_KEY, cause ); if ( cause instanceof ProtocolEncoderException ) { Throwable realCause = ( ( ProtocolEncoderException ) cause ).getCause(); if ( realCause instanceof MessageEncoderException ) { int messageId = ( ( MessageEncoderException ) realCause ).getMessageId(); ResponseFuture<?> response = futureMap.get( messageId ); response.cancel( true ); response.setCause( realCause ); } } session.closeNow(); }
throw new MessageEncoderException( message.getMessageId(), ee.getMessage(), ee );
/** * Handle the exception we got. * * @param session The session we got the exception on * @param cause The exception cause * @throws Exception If we have had another exception */ @Override public void exceptionCaught( IoSession session, Throwable cause ) throws Exception { if ( LOG.isWarnEnabled() ) { LOG.warn( cause.getMessage(), cause ); } session.setAttribute( EXCEPTION_KEY, cause ); if ( cause instanceof ProtocolEncoderException ) { Throwable realCause = ( ( ProtocolEncoderException ) cause ).getCause(); if ( realCause instanceof MessageEncoderException ) { int messageId = ( ( MessageEncoderException ) realCause ).getMessageId(); ResponseFuture<?> response = futureMap.get( messageId ); response.cancel( true ); response.setCause( realCause ); } } session.closeNow(); }