@@ -105,6 +105,7 @@ public boolean isStartup() {
105105 return _isStartup ;
106106 }
107107
108+ @ Override
108109 public void run () {
109110 synchronized (_thread ) {
110111 try {
@@ -238,7 +239,7 @@ protected void read(SelectionKey key) throws IOException {
238239 Task task = _factory .create (Task .Type .DATA , link , data );
239240 _executor .execute (task );
240241 } catch (Exception e ) {
241- logTrace (e , key , 1 );
242+ logDebug (e , key , 1 );
242243 terminate (key );
243244 }
244245 }
@@ -257,6 +258,20 @@ protected void logTrace(Exception e, SelectionKey key, int loc) {
257258 }
258259 }
259260
261+ protected void logDebug (Exception e , SelectionKey key , int loc ) {
262+ if (s_logger .isDebugEnabled ()) {
263+ Socket socket = null ;
264+ if (key != null ) {
265+ SocketChannel ch = (SocketChannel )key .channel ();
266+ if (ch != null ) {
267+ socket = ch .socket ();
268+ }
269+ }
270+
271+ s_logger .debug ("Location " + loc + ": Socket " + socket + " closed on read. Probably -1 returned: " + e .getMessage ());
272+ }
273+ }
274+
260275 protected void processTodos () {
261276 List <ChangeRequest > todos ;
262277 if (_todos .size () == 0 ) {
@@ -338,8 +353,8 @@ protected void connect(SelectionKey key) throws IOException {
338353 if (!socket .getKeepAlive ()) {
339354 socket .setKeepAlive (true );
340355 }
341- if (s_logger .isTraceEnabled ()) {
342- s_logger .trace ("Connected to " + socket );
356+ if (s_logger .isDebugEnabled ()) {
357+ s_logger .debug ("Connected to " + socket );
343358 }
344359 Link link = new Link ((InetSocketAddress )socket .getRemoteSocketAddress (), this );
345360 link .setKey (key );
@@ -370,7 +385,7 @@ protected void write(SelectionKey key) throws IOException {
370385 key .interestOps (SelectionKey .OP_READ );
371386 }
372387 } catch (Exception e ) {
373- logTrace (e , key , 3 );
388+ logDebug (e , key , 3 );
374389 terminate (key );
375390 }
376391 }
@@ -381,8 +396,8 @@ protected void closeConnection(SelectionKey key) {
381396 key .cancel ();
382397 try {
383398 if (channel != null ) {
384- if (s_logger .isTraceEnabled ()) {
385- s_logger .trace ("Closing socket " + channel .socket ());
399+ if (s_logger .isDebugEnabled ()) {
400+ s_logger .debug ("Closing socket " + channel .socket ());
386401 }
387402 channel .close ();
388403 }
0 commit comments