@@ -48,10 +48,9 @@ public IoSessionResponder(IoSession session, boolean synchronousWrites, long syn
4848 @ Override
4949 public boolean send (String data ) {
5050 // Check for and disconnect slow consumers.
51- Session qfjSession = (Session ) ioSession .getAttribute (SessionConnector .QF_SESSION );
5251 if (maxScheduledWriteRequests > 0 && ioSession .getScheduledWriteMessages () >= maxScheduledWriteRequests ) {
5352 try {
54- qfjSession .disconnect ("Slow consumer" , true );
53+ getQFJSession () .disconnect ("Slow consumer" , true );
5554 } catch (IOException e ) {
5655 }
5756 return false ;
@@ -62,11 +61,11 @@ public boolean send(String data) {
6261 if (synchronousWrites ) {
6362 try {
6463 if (!future .awaitUninterruptibly (synchronousWriteTimeout )) {
65- qfjSession .getLog ().onErrorEvent ("Synchronous write timed out after " + synchronousWriteTimeout + "ms." );
64+ getQFJSession () .getLog ().onErrorEvent ("Synchronous write timed out after " + synchronousWriteTimeout + "ms." );
6665 return false ;
6766 }
6867 } catch (RuntimeException e ) {
69- LogUtil .logThrowable (qfjSession .getSessionID (), "Synchronous write failed." , e );
68+ LogUtil .logThrowable (getQFJSession () .getSessionID (), "Synchronous write failed." , e );
7069 return false ;
7170 }
7271 }
@@ -79,7 +78,7 @@ public void disconnect() {
7978 // by the following call. We are using a minimal
8079 // threading model and calling join will prevent the
8180 // close event from being processed by this thread (if
82- // this thread is the MINA IO processor thread.
81+ // this thread is the MINA IO processor thread) .
8382 ioSession .closeOnFlush ();
8483 ioSession .setAttribute (SessionConnector .QFJ_RESET_IO_CONNECTOR , Boolean .TRUE );
8584 }
@@ -93,7 +92,8 @@ public String getRemoteAddress() {
9392 return null ;
9493 }
9594
96- IoSession getIoSession () {
97- return ioSession ;
95+ private Session getQFJSession () {
96+ return ( Session ) ioSession . getAttribute ( SessionConnector . QF_SESSION ) ;
9897 }
98+
9999}
0 commit comments