qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rob...@apache.org
Subject svn commit: r1346169 - in /qpid/trunk/qpid/java: client/src/main/java/org/apache/qpid/client/ common/src/main/java/org/apache/qpid/transport/
Date Mon, 04 Jun 2012 21:40:10 GMT
Author: robbie
Date: Mon Jun  4 21:40:09 2012
New Revision: 1346169

URL: http://svn.apache.org/viewvc?rev=1346169&view=rev
Log:
QPID-4038: log the Connection number and its local and remote addresses after each [re]connection

Modified:
    qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java
    qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_0_10.java
    qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_8_0.java
    qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/transport/Connection.java

Modified: qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java?rev=1346169&r1=1346168&r2=1346169&view=diff
==============================================================================
--- qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java (original)
+++ qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnection.java Mon
Jun  4 21:40:09 2012
@@ -69,6 +69,7 @@ import javax.naming.StringRefAddr;
 import java.io.IOException;
 import java.lang.reflect.InvocationTargetException;
 import java.net.ConnectException;
+import java.net.SocketAddress;
 import java.net.UnknownHostException;
 import java.nio.channels.UnresolvedAddressException;
 import java.util.ArrayList;
@@ -1529,4 +1530,13 @@ public class AMQConnection extends Close
     {
         return _connectionNumber;
     }
+
+    protected void logConnected(SocketAddress localAddress, SocketAddress remoteAddress)
+    {
+        if(_logger.isInfoEnabled())
+        {
+            _logger.info("Connection " + _connectionNumber + " now connected from "
+                         + localAddress + " to " + remoteAddress);
+        }
+    }
 }

Modified: qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_0_10.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_0_10.java?rev=1346169&r1=1346168&r2=1346169&view=diff
==============================================================================
--- qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_0_10.java
(original)
+++ qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_0_10.java
Mon Jun  4 21:40:09 2012
@@ -222,6 +222,7 @@ public class AMQConnectionDelegate_0_10 
             _conn.setUsername(_qpidConnection.getUserID());
             _conn.setMaximumChannelCount(_qpidConnection.getChannelMax());
             _conn.getFailoverPolicy().attainedConnection();
+            _conn.logConnected(_qpidConnection.getLocalAddress(), _qpidConnection.getRemoteAddress());
         }
         catch (ProtocolVersionException pe)
         {

Modified: qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_8_0.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_8_0.java?rev=1346169&r1=1346168&r2=1346169&view=diff
==============================================================================
--- qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_8_0.java
(original)
+++ qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionDelegate_8_0.java
Mon Jun  4 21:40:09 2012
@@ -24,13 +24,11 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import org.apache.qpid.AMQException;
-import org.apache.qpid.AMQTimeoutException;
 import org.apache.qpid.client.failover.FailoverException;
 import org.apache.qpid.client.failover.FailoverProtectedOperation;
 import org.apache.qpid.client.failover.FailoverRetrySupport;
 import org.apache.qpid.client.protocol.AMQProtocolSession;
 import org.apache.qpid.client.state.AMQState;
-import org.apache.qpid.client.state.AMQStateManager;
 import org.apache.qpid.client.state.StateWaiter;
 import org.apache.qpid.common.ServerPropertyNames;
 import org.apache.qpid.framing.BasicQosBody;
@@ -68,7 +66,6 @@ public class AMQConnectionDelegate_8_0 i
     private static final Logger _logger = LoggerFactory.getLogger(AMQConnectionDelegate_8_0.class);
     private final AMQConnection _conn;
 
-
     public void closeConnection(long timeout) throws JMSException, AMQException
     {
         _conn.getProtocolHandler().closeConnection(timeout);
@@ -139,6 +136,7 @@ public class AMQConnectionDelegate_8_0 i
         {
             _conn.getFailoverPolicy().attainedConnection();
             _conn.setConnected(true);
+            _conn.logConnected(network.getLocalAddress(), network.getRemoteAddress());
             return null;
         }
         else

Modified: qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/transport/Connection.java
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/transport/Connection.java?rev=1346169&r1=1346168&r2=1346169&view=diff
==============================================================================
--- qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/transport/Connection.java (original)
+++ qpid/trunk/qpid/java/common/src/main/java/org/apache/qpid/transport/Connection.java Mon
Jun  4 21:40:09 2012
@@ -41,6 +41,8 @@ import static org.apache.qpid.transport.
 
 import javax.security.sasl.SaslClient;
 import javax.security.sasl.SaslServer;
+
+import java.net.SocketAddress;
 import java.nio.ByteBuffer;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -127,6 +129,9 @@ public class Connection extends Connecti
 
     private final AtomicBoolean connectionLost = new AtomicBoolean(false);
 
+    private SocketAddress _remoteAddress;
+    private SocketAddress _localAddress;
+
     public Connection() {}
 
     public void setConnectionDelegate(ConnectionDelegate delegate)
@@ -228,6 +233,9 @@ public class Connection extends Connecti
             }
 
             NetworkConnection network = transport.connect(settings, secureReceiver, null);
+            _remoteAddress = network.getRemoteAddress();
+            _localAddress = network.getLocalAddress();
+
             final Sender<ByteBuffer> secureSender = securityLayer.sender(network.getSender());
             if(secureSender instanceof ConnectionListener)
             {
@@ -701,4 +709,14 @@ public class Connection extends Connecti
             ssn.notifyFailoverRequired();
         }
     }
+
+    public SocketAddress getRemoteAddress()
+    {
+        return _remoteAddress;
+    }
+
+    public SocketAddress getLocalAddress()
+    {
+        return _localAddress;
+    }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message