james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject svn commit: r756425 - in /james/server/trunk/avalon-socket-library/src/main/java/org/apache/james/socket: AbstractJamesService.java DelegatingJamesHandler.java
Date Fri, 20 Mar 2009 11:55:14 GMT
Author: rdonkin
Date: Fri Mar 20 11:55:14 2009
New Revision: 756425

URL: http://svn.apache.org/viewvc?rev=756425&view=rev
Log:
Added name for use in contextual logging JAMES-896 https://issues.apache.org/jira/browse/JAMES-896

Modified:
    james/server/trunk/avalon-socket-library/src/main/java/org/apache/james/socket/AbstractJamesService.java
    james/server/trunk/avalon-socket-library/src/main/java/org/apache/james/socket/DelegatingJamesHandler.java

Modified: james/server/trunk/avalon-socket-library/src/main/java/org/apache/james/socket/AbstractJamesService.java
URL: http://svn.apache.org/viewvc/james/server/trunk/avalon-socket-library/src/main/java/org/apache/james/socket/AbstractJamesService.java?rev=756425&r1=756424&r2=756425&view=diff
==============================================================================
--- james/server/trunk/avalon-socket-library/src/main/java/org/apache/james/socket/AbstractJamesService.java
(original)
+++ james/server/trunk/avalon-socket-library/src/main/java/org/apache/james/socket/AbstractJamesService.java
Fri Mar 20 11:55:14 2009
@@ -54,6 +54,7 @@
 import java.net.UnknownHostException;
 import java.security.Provider;
 import java.security.Security;
+import java.util.concurrent.atomic.AtomicLong;
 
 /**
  * Server which creates connection handlers. All new James service must
@@ -121,7 +122,7 @@
      */
     protected InetAddress bindTo = null;
 
-    /*
+    /**
      * The server socket associated with this service
      */
     protected ServerSocket serverSocket;
@@ -185,6 +186,13 @@
      */
     private DNSService dnsServer = null;
     
+    /**
+     * Counts the number of handler instances created.
+     * This allows a unique identity to be assigned to each for
+     * context sensitive logging.
+     */
+    private AtomicLong handlerCount = new AtomicLong(0);
+    
     private boolean connPerIPConfigured = false;
     private int connPerIP = 0;
 
@@ -788,7 +796,9 @@
      * @see org.apache.avalon.excalibur.pool.ObjectFactory#newInstance()
      */
     public Object newInstance() throws Exception {
-        return new DelegatingJamesHandler(newProtocolHandlerInstance());
+        final AbstractJamesHandler delegatingJamesHandler = new DelegatingJamesHandler(newProtocolHandlerInstance());
+        delegatingJamesHandler.setName("Handler-" + handlerCount.getAndAdd(1));
+        return delegatingJamesHandler;
     }
     
     protected abstract ProtocolHandler newProtocolHandlerInstance();

Modified: james/server/trunk/avalon-socket-library/src/main/java/org/apache/james/socket/DelegatingJamesHandler.java
URL: http://svn.apache.org/viewvc/james/server/trunk/avalon-socket-library/src/main/java/org/apache/james/socket/DelegatingJamesHandler.java?rev=756425&r1=756424&r2=756425&view=diff
==============================================================================
--- james/server/trunk/avalon-socket-library/src/main/java/org/apache/james/socket/DelegatingJamesHandler.java
(original)
+++ james/server/trunk/avalon-socket-library/src/main/java/org/apache/james/socket/DelegatingJamesHandler.java
Fri Mar 20 11:55:14 2009
@@ -139,11 +139,10 @@
         return theWatchdog;
     }
 
-		/**
-		 * @see org.apache.james.socket.ProtocolHandlerHelper#getSocket()
-		 */
-		public Socket getSocket() {
-			return socket;
-		}
-
+    /**
+     * @see org.apache.james.socket.ProtocolHandlerHelper#getSocket()
+     */
+    public Socket getSocket() {
+        return socket;
+    }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message