hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r543890 - in /jakarta/httpcomponents/httpcore/trunk: contrib/src/main/java/org/apache/http/contrib/logging/ contrib/src/main/java/org/apache/http/contrib/spring/ module-nio/src/main/java/org/apache/http/impl/nio/reactor/
Date Sun, 03 Jun 2007 13:42:56 GMT
Author: olegk
Date: Sun Jun  3 06:42:55 2007
New Revision: 543890

URL: http://svn.apache.org/viewvc?view=rev&rev=543890
Log:
Improved NIO event logging; Removed outdated Spring integration demo

Added:
    jakarta/httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/logging/LoggingNHttpClientConnection.java
  (with props)
    jakarta/httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/logging/LoggingNHttpServerConnection.java
  (with props)
Removed:
    jakarta/httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/spring/
Modified:
    jakarta/httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/logging/LoggingClientIOEventDispatch.java
    jakarta/httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/logging/LoggingIOSession.java
    jakarta/httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/logging/LoggingNHttpClientHandler.java
    jakarta/httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/logging/LoggingNHttpServiceHandler.java
    jakarta/httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/logging/LoggingServerIOEventDispatch.java
    jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/reactor/IOSessionImpl.java

Modified: jakarta/httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/logging/LoggingClientIOEventDispatch.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/logging/LoggingClientIOEventDispatch.java?view=diff&rev=543890&r1=543889&r2=543890
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/logging/LoggingClientIOEventDispatch.java
(original)
+++ jakarta/httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/logging/LoggingClientIOEventDispatch.java
Sun Jun  3 06:42:55 2007
@@ -32,7 +32,6 @@
 package org.apache.http.contrib.logging;
 
 import org.apache.http.impl.DefaultHttpResponseFactory;
-import org.apache.http.impl.nio.DefaultNHttpClientConnection;
 import org.apache.http.nio.NHttpClientHandler;
 import org.apache.http.nio.reactor.IOEventDispatch;
 import org.apache.http.nio.reactor.IOSession;
@@ -58,7 +57,7 @@
     }
     
     public void connected(final IOSession session) {
-        DefaultNHttpClientConnection conn = new DefaultNHttpClientConnection(
+        LoggingNHttpClientConnection conn = new LoggingNHttpClientConnection(
                 new LoggingIOSession(session), 
                 new DefaultHttpResponseFactory(),
                 this.params); 
@@ -69,25 +68,25 @@
     }
 
     public void disconnected(final IOSession session) {
-        DefaultNHttpClientConnection conn = (DefaultNHttpClientConnection) session.getAttribute(
+        LoggingNHttpClientConnection conn = (LoggingNHttpClientConnection) session.getAttribute(
                 NHTTP_CONN);
         this.handler.closed(conn);
     }
 
     public void inputReady(final IOSession session) {
-        DefaultNHttpClientConnection conn = (DefaultNHttpClientConnection) session.getAttribute(
+        LoggingNHttpClientConnection conn = (LoggingNHttpClientConnection) session.getAttribute(
                 NHTTP_CONN);
         conn.consumeInput(this.handler);
     }
 
     public void outputReady(final IOSession session) {
-        DefaultNHttpClientConnection conn = (DefaultNHttpClientConnection) session.getAttribute(
+        LoggingNHttpClientConnection conn = (LoggingNHttpClientConnection) session.getAttribute(
                 NHTTP_CONN);
         conn.produceOutput(this.handler);
     }
 
     public void timeout(final IOSession session) {
-        DefaultNHttpClientConnection conn = (DefaultNHttpClientConnection) session.getAttribute(
+        LoggingNHttpClientConnection conn = (LoggingNHttpClientConnection) session.getAttribute(
                 NHTTP_CONN);
         this.handler.timeout(conn);
     }

Modified: jakarta/httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/logging/LoggingIOSession.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/logging/LoggingIOSession.java?view=diff&rev=543890&r1=543889&r2=543890
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/logging/LoggingIOSession.java
(original)
+++ jakarta/httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/logging/LoggingIOSession.java
Sun Jun  3 06:42:55 2007
@@ -35,6 +35,7 @@
 import java.net.SocketAddress;
 import java.nio.ByteBuffer;
 import java.nio.channels.ByteChannel;
+import java.nio.channels.SelectionKey;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -83,10 +84,29 @@
         return this.session.getEventMask();
     }
 
+    private static String formatOps(int ops) {
+        StringBuffer buffer = new StringBuffer(6);
+        buffer.append('[');
+        if ((ops & SelectionKey.OP_READ) > 0) {
+            buffer.append('r');
+        }
+        if ((ops & SelectionKey.OP_WRITE) > 0) {
+            buffer.append('w');
+        }
+        if ((ops & SelectionKey.OP_ACCEPT) > 0) {
+            buffer.append('a');
+        }
+        if ((ops & SelectionKey.OP_CONNECT) > 0) {
+            buffer.append('c');
+        }
+        buffer.append(']');
+        return buffer.toString();
+    }
+    
     public void setEventMask(int ops) {
         if (this.log.isDebugEnabled()) {
             this.log.debug("I/O session " + this.id + " " + this.session + ": Set event mask
" 
-                    + ops);
+                    + formatOps(ops));
         }
         this.session.setEventMask(ops);
     }
@@ -94,7 +114,7 @@
     public void setEvent(int op) {
         if (this.log.isDebugEnabled()) {
             this.log.debug("I/O session " + this.id + " " + this.session + ": Set event "

-                    + op);
+                    + formatOps(op));
         }
         this.session.setEvent(op);
     }
@@ -102,7 +122,7 @@
     public void clearEvent(int op) {
         if (this.log.isDebugEnabled()) {
             this.log.debug("I/O session " + this.id + " " + this.session + ": Clear event
" 
-                    + op);
+                    + formatOps(op));
         }
         this.session.clearEvent(op);
     }

Added: jakarta/httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/logging/LoggingNHttpClientConnection.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/logging/LoggingNHttpClientConnection.java?view=auto&rev=543890
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/logging/LoggingNHttpClientConnection.java
(added)
+++ jakarta/httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/logging/LoggingNHttpClientConnection.java
Sun Jun  3 06:42:55 2007
@@ -0,0 +1,74 @@
+/*
+ * $HeadURL$
+ * $Revision$
+ * $Date$
+ *
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+
+package org.apache.http.contrib.logging;
+
+import java.io.IOException;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.http.Header;
+import org.apache.http.HttpException;
+import org.apache.http.HttpRequest;
+import org.apache.http.HttpResponseFactory;
+import org.apache.http.impl.nio.DefaultNHttpClientConnection;
+import org.apache.http.nio.reactor.IOSession;
+import org.apache.http.params.HttpParams;
+
+public class LoggingNHttpClientConnection extends DefaultNHttpClientConnection {
+
+    private final Log log;
+    private final Log headerlog;
+    
+    public LoggingNHttpClientConnection(
+            final IOSession session,
+            final HttpResponseFactory responseFactory,
+            final HttpParams params) {
+        super(session, responseFactory, params);
+        this.log = LogFactory.getLog(DefaultNHttpClientConnection.class);
+        this.headerlog = LogFactory.getLog("org.apache.http.headers");
+    }
+
+    public void submitRequest(final HttpRequest request) throws IOException, HttpException
{
+        if (this.log.isDebugEnabled()) {
+            this.log.debug("HTTP connection " + this + ": "  + request.getRequestLine().toString());
+        }
+        super.submitRequest(request);
+        if (this.headerlog.isDebugEnabled()) {
+            this.headerlog.debug(">> " + request.getRequestLine().toString());
+            Header[] headers = request.getAllHeaders();
+            for (int i = 0; i < headers.length; i++) {
+                this.headerlog.debug(">> " + headers[i].toString());
+            }
+        }
+    }
+    
+}
\ No newline at end of file

Propchange: jakarta/httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/logging/LoggingNHttpClientConnection.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/logging/LoggingNHttpClientConnection.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: jakarta/httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/logging/LoggingNHttpClientConnection.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: jakarta/httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/logging/LoggingNHttpClientHandler.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/logging/LoggingNHttpClientHandler.java?view=diff&rev=543890&r1=543889&r2=543890
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/logging/LoggingNHttpClientHandler.java
(original)
+++ jakarta/httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/logging/LoggingNHttpClientHandler.java
Sun Jun  3 06:42:55 2007
@@ -35,6 +35,7 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.http.Header;
 import org.apache.http.HttpException;
 import org.apache.http.HttpResponse;
 import org.apache.http.nio.ContentDecoder;
@@ -51,6 +52,7 @@
 public class LoggingNHttpClientHandler implements NHttpClientHandler {
 
     private final Log log;
+    private final Log headerlog;
     private final NHttpClientHandler handler;
     
     public LoggingNHttpClientHandler(final NHttpClientHandler handler) {
@@ -60,6 +62,7 @@
         }
         this.handler = handler;
         this.log = LogFactory.getLog(handler.getClass());
+        this.headerlog = LogFactory.getLog("org.apache.http.headers");
     }
     
     public void connected(final NHttpClientConnection conn, final Object attachment) {
@@ -109,6 +112,14 @@
             this.log.debug("HTTP connection " + conn + ": " + response.getStatusLine());
         }
         this.handler.responseReceived(conn);
+        if (this.headerlog.isDebugEnabled()) {
+            HttpResponse response = conn.getHttpResponse();
+            this.headerlog.debug("<< " + response.getStatusLine().toString());
+            Header[] headers = response.getAllHeaders();
+            for (int i = 0; i < headers.length; i++) {
+                this.headerlog.debug("<< " + headers[i].toString());
+            }
+        }
     }
 
     public void inputReady(final NHttpClientConnection conn, final ContentDecoder decoder)
{

Added: jakarta/httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/logging/LoggingNHttpServerConnection.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/logging/LoggingNHttpServerConnection.java?view=auto&rev=543890
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/logging/LoggingNHttpServerConnection.java
(added)
+++ jakarta/httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/logging/LoggingNHttpServerConnection.java
Sun Jun  3 06:42:55 2007
@@ -0,0 +1,74 @@
+/*
+ * $HeadURL$
+ * $Revision$
+ * $Date$
+ *
+ * ====================================================================
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ *
+ */
+
+package org.apache.http.contrib.logging;
+
+import java.io.IOException;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.http.Header;
+import org.apache.http.HttpException;
+import org.apache.http.HttpRequestFactory;
+import org.apache.http.HttpResponse;
+import org.apache.http.impl.nio.DefaultNHttpServerConnection;
+import org.apache.http.nio.reactor.IOSession;
+import org.apache.http.params.HttpParams;
+
+public class LoggingNHttpServerConnection extends DefaultNHttpServerConnection {
+
+    private final Log log;
+    private final Log headerlog;
+    
+    public LoggingNHttpServerConnection(
+            final IOSession session,
+            final HttpRequestFactory requestFactory,
+            final HttpParams params) {
+        super(session, requestFactory, params);
+        this.log = LogFactory.getLog(DefaultNHttpServerConnection.class);
+        this.headerlog = LogFactory.getLog("org.apache.http.headers");
+    }
+
+    public void submitResponse(final HttpResponse response) throws IOException, HttpException
{
+        if (this.log.isDebugEnabled()) {
+            this.log.debug("HTTP connection " + this + ": "  + response.getStatusLine().toString());
+        }
+        super.submitResponse(response);
+        if (this.headerlog.isDebugEnabled()) {
+            this.headerlog.debug("<< " + response.getStatusLine().toString());
+            Header[] headers = response.getAllHeaders();
+            for (int i = 0; i < headers.length; i++) {
+                this.headerlog.debug("<< " + headers[i].toString());
+            }
+        }
+    }
+    
+}
\ No newline at end of file

Propchange: jakarta/httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/logging/LoggingNHttpServerConnection.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: jakarta/httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/logging/LoggingNHttpServerConnection.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: jakarta/httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/logging/LoggingNHttpServerConnection.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: jakarta/httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/logging/LoggingNHttpServiceHandler.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/logging/LoggingNHttpServiceHandler.java?view=diff&rev=543890&r1=543889&r2=543890
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/logging/LoggingNHttpServiceHandler.java
(original)
+++ jakarta/httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/logging/LoggingNHttpServiceHandler.java
Sun Jun  3 06:42:55 2007
@@ -35,6 +35,7 @@
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.http.Header;
 import org.apache.http.HttpException;
 import org.apache.http.HttpRequest;
 import org.apache.http.nio.ContentDecoder;
@@ -51,6 +52,7 @@
 public class LoggingNHttpServiceHandler implements NHttpServiceHandler {
 
     private final Log log;
+    private final Log headerlog;
     private final NHttpServiceHandler handler;
     
     public LoggingNHttpServiceHandler(final NHttpServiceHandler handler) {
@@ -60,6 +62,7 @@
         }
         this.handler = handler;
         this.log = LogFactory.getLog(handler.getClass());
+        this.headerlog = LogFactory.getLog("org.apache.http.headers");
     }
     
     public void connected(final NHttpServerConnection conn) {
@@ -92,6 +95,14 @@
             this.log.debug("HTTP connection " + conn + ": " + request.getRequestLine());
         }
         this.handler.requestReceived(conn);
+        if (this.headerlog.isDebugEnabled()) {
+            HttpRequest request = conn.getHttpRequest();
+            this.headerlog.debug(">> " + request.getRequestLine().toString());
+            Header[] headers = request.getAllHeaders();
+            for (int i = 0; i < headers.length; i++) {
+                this.headerlog.debug(">> " + headers[i].toString());
+            }
+        }
     }
 
     public void outputReady(final NHttpServerConnection conn, final ContentEncoder encoder)
{

Modified: jakarta/httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/logging/LoggingServerIOEventDispatch.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/logging/LoggingServerIOEventDispatch.java?view=diff&rev=543890&r1=543889&r2=543890
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/logging/LoggingServerIOEventDispatch.java
(original)
+++ jakarta/httpcomponents/httpcore/trunk/contrib/src/main/java/org/apache/http/contrib/logging/LoggingServerIOEventDispatch.java
Sun Jun  3 06:42:55 2007
@@ -32,7 +32,6 @@
 package org.apache.http.contrib.logging;
 
 import org.apache.http.impl.DefaultHttpRequestFactory;
-import org.apache.http.impl.nio.DefaultNHttpServerConnection;
 import org.apache.http.nio.NHttpServiceHandler;
 import org.apache.http.nio.reactor.IOEventDispatch;
 import org.apache.http.nio.reactor.IOSession;
@@ -58,7 +57,7 @@
     }
     
     public void connected(final IOSession session) {
-        DefaultNHttpServerConnection conn = new DefaultNHttpServerConnection(
+        LoggingNHttpServerConnection conn = new LoggingNHttpServerConnection(
                 new LoggingIOSession(session), 
                 new DefaultHttpRequestFactory(),
                 this.params); 
@@ -67,25 +66,25 @@
     }
 
     public void disconnected(final IOSession session) {
-        DefaultNHttpServerConnection conn = (DefaultNHttpServerConnection) session.getAttribute(
+        LoggingNHttpServerConnection conn = (LoggingNHttpServerConnection) session.getAttribute(
                 NHTTP_CONN);
         this.handler.closed(conn);
     }
 
     public void inputReady(final IOSession session) {
-        DefaultNHttpServerConnection conn = (DefaultNHttpServerConnection) session.getAttribute(
+        LoggingNHttpServerConnection conn = (LoggingNHttpServerConnection) session.getAttribute(
                 NHTTP_CONN);
         conn.consumeInput(this.handler);
     }
 
     public void outputReady(final IOSession session) {
-        DefaultNHttpServerConnection conn = (DefaultNHttpServerConnection) session.getAttribute(
+        LoggingNHttpServerConnection conn = (LoggingNHttpServerConnection) session.getAttribute(
                 NHTTP_CONN);
         conn.produceOutput(this.handler);
     }
 
     public void timeout(final IOSession session) {
-        DefaultNHttpServerConnection conn = (DefaultNHttpServerConnection) session.getAttribute(
+        LoggingNHttpServerConnection conn = (LoggingNHttpServerConnection) session.getAttribute(
                 NHTTP_CONN);
         this.handler.timeout(conn);
     }

Modified: jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/reactor/IOSessionImpl.java
URL: http://svn.apache.org/viewvc/jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/reactor/IOSessionImpl.java?view=diff&rev=543890&r1=543889&r2=543890
==============================================================================
--- jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/reactor/IOSessionImpl.java
(original)
+++ jakarta/httpcomponents/httpcore/trunk/module-nio/src/main/java/org/apache/http/impl/nio/reactor/IOSessionImpl.java
Sun Jun  3 06:42:55 2007
@@ -184,14 +184,31 @@
         this.attributes.put(name, obj);
     }
 
+    private static void formatOps(final StringBuffer buffer, int ops) {
+        buffer.append('[');
+        if ((ops & SelectionKey.OP_READ) > 0) {
+            buffer.append('r');
+        }
+        if ((ops & SelectionKey.OP_WRITE) > 0) {
+            buffer.append('w');
+        }
+        if ((ops & SelectionKey.OP_ACCEPT) > 0) {
+            buffer.append('a');
+        }
+        if ((ops & SelectionKey.OP_CONNECT) > 0) {
+            buffer.append('c');
+        }
+        buffer.append(']');
+    }
+    
     public String toString() {
         StringBuffer buffer = new StringBuffer();
         buffer.append("[");
         if (this.key.isValid()) {
-            buffer.append("event mask: ");
-            buffer.append(this.key.interestOps());
+            buffer.append("interested ops: ");
+            formatOps(buffer, this.key.interestOps());
             buffer.append("; ready ops: ");
-            buffer.append(this.key.readyOps());
+            formatOps(buffer, this.key.readyOps());
         } else {
             buffer.append("invalid");
         }



Mime
View raw message