qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kw...@apache.org
Subject svn commit: r1730065 - in /qpid/java/branches/6.0.x: ./ broker-core/src/main/java/org/apache/qpid/server/logging/messages/ broker-core/src/main/java/org/apache/qpid/server/transport/ broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/serve...
Date Fri, 12 Feb 2016 16:39:32 GMT
Author: kwall
Date: Fri Feb 12 16:39:31 2016
New Revision: 1730065

URL: http://svn.apache.org/viewvc?rev=1730065&view=rev
Log:
QPID-7058: [Java Client] Log the current connection state when connection establishment times
out

Merged with command:

svn merge -c 1729841    ^/qpid/java/trunk


Modified:
    qpid/java/branches/6.0.x/   (props changed)
    qpid/java/branches/6.0.x/broker-core/src/main/java/org/apache/qpid/server/logging/messages/ConnectionMessages.java
    qpid/java/branches/6.0.x/broker-core/src/main/java/org/apache/qpid/server/logging/messages/Connection_logmessages.properties
    qpid/java/branches/6.0.x/broker-core/src/main/java/org/apache/qpid/server/transport/AbstractAMQPConnection.java
    qpid/java/branches/6.0.x/broker-core/src/main/java/org/apache/qpid/server/transport/MultiVersionProtocolEngine.java
    qpid/java/branches/6.0.x/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/AMQPConnection_0_10.java
    qpid/java/branches/6.0.x/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQPConnection_0_8.java
    qpid/java/branches/6.0.x/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/AMQPConnection_1_0.java
    qpid/java/branches/6.0.x/client/src/main/java/org/apache/qpid/client/state/AMQState.java
    qpid/java/branches/6.0.x/client/src/main/java/org/apache/qpid/client/state/StateWaiter.java

Propchange: qpid/java/branches/6.0.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Feb 12 16:39:31 2016
@@ -9,5 +9,5 @@
 /qpid/branches/java-broker-vhost-refactor/java:1493674-1494547
 /qpid/branches/java-network-refactor/qpid/java:805429-821809
 /qpid/branches/qpid-2935/qpid/java:1061302-1072333
-/qpid/java/trunk:1715445-1715447,1715586,1715940,1716086-1716087,1716127-1716128,1716141,1716153,1716155,1716194,1716204,1716209,1716227,1716277,1716357,1716368,1716370,1716374,1716432,1716444-1716445,1716455,1716461,1716474,1716489,1716497,1716515,1716555,1716602,1716606-1716610,1716619,1716636,1717269,1717299,1717401,1717446,1717449,1717626,1717691,1717735,1717780,1718744,1718889,1718893,1718918,1718922,1719026,1719028,1719033,1719037,1719047,1719051,1720340,1720664,1721151,1721198,1722019-1722020,1722246,1722339,1722416,1722674,1722678,1722683,1722711,1723064,1723194,1723563,1724216,1724251,1724257,1724292,1724375,1724397,1724432,1724582,1724603,1724780,1724843-1724844,1725295,1725569,1725760,1726176,1726244-1726246,1726249,1726358,1726436,1726449,1726456,1726646,1726653,1726755,1726778,1727532,1727555,1727608,1727951,1728089,1728167,1728302,1728497,1728524,1728639,1728772,1729297,1729347,1729356,1729638,1729828,1729832,1729851,1729973
+/qpid/java/trunk:1715445-1715447,1715586,1715940,1716086-1716087,1716127-1716128,1716141,1716153,1716155,1716194,1716204,1716209,1716227,1716277,1716357,1716368,1716370,1716374,1716432,1716444-1716445,1716455,1716461,1716474,1716489,1716497,1716515,1716555,1716602,1716606-1716610,1716619,1716636,1717269,1717299,1717401,1717446,1717449,1717626,1717691,1717735,1717780,1718744,1718889,1718893,1718918,1718922,1719026,1719028,1719033,1719037,1719047,1719051,1720340,1720664,1721151,1721198,1722019-1722020,1722246,1722339,1722416,1722674,1722678,1722683,1722711,1723064,1723194,1723563,1724216,1724251,1724257,1724292,1724375,1724397,1724432,1724582,1724603,1724780,1724843-1724844,1725295,1725569,1725760,1726176,1726244-1726246,1726249,1726358,1726436,1726449,1726456,1726646,1726653,1726755,1726778,1727532,1727555,1727608,1727951,1728089,1728167,1728302,1728497,1728524,1728639,1728772,1729297,1729347,1729356,1729638,1729828,1729832,1729841,1729851,1729973
 /qpid/trunk/qpid:796646-796653

Modified: qpid/java/branches/6.0.x/broker-core/src/main/java/org/apache/qpid/server/logging/messages/ConnectionMessages.java
URL: http://svn.apache.org/viewvc/qpid/java/branches/6.0.x/broker-core/src/main/java/org/apache/qpid/server/logging/messages/ConnectionMessages.java?rev=1730065&r1=1730064&r2=1730065&view=diff
==============================================================================
--- qpid/java/branches/6.0.x/broker-core/src/main/java/org/apache/qpid/server/logging/messages/ConnectionMessages.java
(original)
+++ qpid/java/branches/6.0.x/broker-core/src/main/java/org/apache/qpid/server/logging/messages/ConnectionMessages.java
Fri Feb 12 16:39:31 2016
@@ -69,7 +69,7 @@ public class ConnectionMessages
 
     /**
      * Log a Connection message of the Format:
-     * <pre>CON-1001 : Open : Port : {0}({1}) Protocol Version {2}[ : SSL][ : Client
ID : {3}][ : Client Version : {4}][ : Client Product : {5}]</pre>
+     * <pre>CON-1001 : Open : Destination : {0}({1}) : Protocol Version : {2}[ : SSL][
: Client ID : {3}][ : Client Version : {4}][ : Client Product : {5}]</pre>
      * Optional values are contained in [square brackets] and are numbered
      * sequentially in the method call.
      *
@@ -349,16 +349,44 @@ public class ConnectionMessages
 
     /**
      * Log a Connection message of the Format:
-     * <pre>CON-1003 : Closed due to inactivity</pre>
+     * <pre>CON-1003 : Closed due to inactivity [: {0}]</pre>
      * Optional values are contained in [square brackets] and are numbered
      * sequentially in the method call.
      *
      */
-    public static LogMessage IDLE_CLOSE()
+    public static LogMessage IDLE_CLOSE(String param1, boolean opt1)
     {
         String rawMessage = _messages.getString("IDLE_CLOSE");
+        StringBuffer msg = new StringBuffer();
 
-        final String message = rawMessage;
+        // Split the formatted message up on the option values so we can
+        // rebuild the message based on the configured options.
+        String[] parts = rawMessage.split("\\[");
+        msg.append(parts[0]);
+
+        int end;
+        if (parts.length > 1)
+        {
+
+            // Add Option : : {0}.
+            end = parts[1].indexOf(']');
+            if (opt1)
+            {
+                msg.append(parts[1].substring(0, end));
+            }
+
+            // Use 'end + 1' to remove the ']' from the output
+            msg.append(parts[1].substring(end + 1));
+        }
+
+        rawMessage = msg.toString();
+
+        final Object[] messageArguments = {param1};
+        // Create a new MessageFormat to ensure thread safety.
+        // Sharing a MessageFormat and using applyPattern is not thread safe
+        MessageFormat formatter = new MessageFormat(rawMessage, _currentLocale);
+
+        final String message = formatter.format(messageArguments);
 
         return new LogMessage()
         {

Modified: qpid/java/branches/6.0.x/broker-core/src/main/java/org/apache/qpid/server/logging/messages/Connection_logmessages.properties
URL: http://svn.apache.org/viewvc/qpid/java/branches/6.0.x/broker-core/src/main/java/org/apache/qpid/server/logging/messages/Connection_logmessages.properties?rev=1730065&r1=1730064&r2=1730065&view=diff
==============================================================================
--- qpid/java/branches/6.0.x/broker-core/src/main/java/org/apache/qpid/server/logging/messages/Connection_logmessages.properties
(original)
+++ qpid/java/branches/6.0.x/broker-core/src/main/java/org/apache/qpid/server/logging/messages/Connection_logmessages.properties
Fri Feb 12 16:39:31 2016
@@ -20,7 +20,7 @@
 
 OPEN = CON-1001 : Open : Destination : {0}({1}) : Protocol Version : {2}[ : SSL][ : Client
ID : {3}][ : Client Version : {4}][ : Client Product : {5}]
 CLOSE = CON-1002 : Close
-IDLE_CLOSE = CON-1003 : Closed due to inactivity
+IDLE_CLOSE = CON-1003 : Closed due to inactivity [: {0}]
 DROPPED_CONNECTION = CON-1004 : Connection dropped
 CLIENT_VERSION_LOG = CON-1005 : Client version "{0}" logged by validation
 CLIENT_VERSION_REJECT = CON-1006 : Client version "{0}" rejected by validation

Modified: qpid/java/branches/6.0.x/broker-core/src/main/java/org/apache/qpid/server/transport/AbstractAMQPConnection.java
URL: http://svn.apache.org/viewvc/qpid/java/branches/6.0.x/broker-core/src/main/java/org/apache/qpid/server/transport/AbstractAMQPConnection.java?rev=1730065&r1=1730064&r2=1730065&view=diff
==============================================================================
--- qpid/java/branches/6.0.x/broker-core/src/main/java/org/apache/qpid/server/transport/AbstractAMQPConnection.java
(original)
+++ qpid/java/branches/6.0.x/broker-core/src/main/java/org/apache/qpid/server/transport/AbstractAMQPConnection.java
Fri Feb 12 16:39:31 2016
@@ -699,7 +699,7 @@ public abstract class AbstractAMQPConnec
                 {
                     _logger.warn("Connection has taken more than {} ms to establish identity.
 Closing as possible DoS.",
                                  _allowedTime);
-                    getEventLogger().message(ConnectionMessages.IDLE_CLOSE());
+                    getEventLogger().message(ConnectionMessages.IDLE_CLOSE("Protocol authentication
not established within timeout period", true));
                     _network.close();
                 }
                 else

Modified: qpid/java/branches/6.0.x/broker-core/src/main/java/org/apache/qpid/server/transport/MultiVersionProtocolEngine.java
URL: http://svn.apache.org/viewvc/qpid/java/branches/6.0.x/broker-core/src/main/java/org/apache/qpid/server/transport/MultiVersionProtocolEngine.java?rev=1730065&r1=1730064&r2=1730065&view=diff
==============================================================================
--- qpid/java/branches/6.0.x/broker-core/src/main/java/org/apache/qpid/server/transport/MultiVersionProtocolEngine.java
(original)
+++ qpid/java/branches/6.0.x/broker-core/src/main/java/org/apache/qpid/server/transport/MultiVersionProtocolEngine.java
Fri Feb 12 16:39:31 2016
@@ -592,7 +592,7 @@ public class MultiVersionProtocolEngine
         @Override
         public void readerIdle()
         {
-            _broker.getEventLogger().message(ConnectionMessages.IDLE_CLOSE());
+            _broker.getEventLogger().message(ConnectionMessages.IDLE_CLOSE("Protocol header
not sent within timeout period", true));
             _network.close();
         }
 

Modified: qpid/java/branches/6.0.x/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/AMQPConnection_0_10.java
URL: http://svn.apache.org/viewvc/qpid/java/branches/6.0.x/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/AMQPConnection_0_10.java?rev=1730065&r1=1730064&r2=1730065&view=diff
==============================================================================
--- qpid/java/branches/6.0.x/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/AMQPConnection_0_10.java
(original)
+++ qpid/java/branches/6.0.x/broker-plugins/amqp-0-10-protocol/src/main/java/org/apache/qpid/server/protocol/v0_10/AMQPConnection_0_10.java
Fri Feb 12 16:39:31 2016
@@ -195,7 +195,7 @@ public class AMQPConnection_0_10 extends
             @Override
             public Object run()
             {
-                _connection.getEventLogger().message(ConnectionMessages.IDLE_CLOSE());
+                _connection.getEventLogger().message(ConnectionMessages.IDLE_CLOSE("", false));
                 _network.close();
                 return null;
             }

Modified: qpid/java/branches/6.0.x/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQPConnection_0_8.java
URL: http://svn.apache.org/viewvc/qpid/java/branches/6.0.x/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQPConnection_0_8.java?rev=1730065&r1=1730064&r2=1730065&view=diff
==============================================================================
--- qpid/java/branches/6.0.x/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQPConnection_0_8.java
(original)
+++ qpid/java/branches/6.0.x/broker-plugins/amqp-0-8-protocol/src/main/java/org/apache/qpid/server/protocol/v0_8/AMQPConnection_0_8.java
Fri Feb 12 16:39:31 2016
@@ -842,7 +842,7 @@ public class AMQPConnection_0_8
             @Override
             public Object run()
             {
-                getEventLogger().message(ConnectionMessages.IDLE_CLOSE());
+                getEventLogger().message(ConnectionMessages.IDLE_CLOSE("Current connection
state: " + _state, true));
                 _network.close();
                 return null;
             }

Modified: qpid/java/branches/6.0.x/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/AMQPConnection_1_0.java
URL: http://svn.apache.org/viewvc/qpid/java/branches/6.0.x/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/AMQPConnection_1_0.java?rev=1730065&r1=1730064&r2=1730065&view=diff
==============================================================================
--- qpid/java/branches/6.0.x/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/AMQPConnection_1_0.java
(original)
+++ qpid/java/branches/6.0.x/broker-plugins/amqp-1-0-protocol/src/main/java/org/apache/qpid/server/protocol/v1_0/AMQPConnection_1_0.java
Fri Feb 12 16:39:31 2016
@@ -284,7 +284,7 @@ public class AMQPConnection_1_0 extends
             @Override
             public Object run()
             {
-                getEventLogger().message(ConnectionMessages.IDLE_CLOSE());
+                getEventLogger().message(ConnectionMessages.IDLE_CLOSE("", false));
                 getNetwork().close();
                 return null;
             }

Modified: qpid/java/branches/6.0.x/client/src/main/java/org/apache/qpid/client/state/AMQState.java
URL: http://svn.apache.org/viewvc/qpid/java/branches/6.0.x/client/src/main/java/org/apache/qpid/client/state/AMQState.java?rev=1730065&r1=1730064&r2=1730065&view=diff
==============================================================================
--- qpid/java/branches/6.0.x/client/src/main/java/org/apache/qpid/client/state/AMQState.java
(original)
+++ qpid/java/branches/6.0.x/client/src/main/java/org/apache/qpid/client/state/AMQState.java
Fri Feb 12 16:39:31 2016
@@ -26,35 +26,10 @@ package org.apache.qpid.client.state;
  */
 public enum AMQState
 {
-
-    CONNECTION_NOT_STARTED(1, "CONNECTION_NOT_STARTED"),
-
-    CONNECTION_NOT_TUNED(2, "CONNECTION_NOT_TUNED"),
-
-    CONNECTION_NOT_OPENED(3, "CONNECTION_NOT_OPENED"),
-
-    CONNECTION_OPEN(4, "CONNECTION_OPEN"),
-
-    CONNECTION_CLOSING(5, "CONNECTION_CLOSING"),
-
-    CONNECTION_CLOSED(6, "CONNECTION_CLOSED");
-
-
-    private final int _id;
-
-    private final String _name;
-
-    private AMQState(int id, String name)
-    {
-        _id = id;
-        _name = name;
-    }
-
-    public String toString()
-    {
-        return "AMQState: id = " + _id + " name: " + _name;
-    }
-
-
-
+    CONNECTION_NOT_STARTED,
+    CONNECTION_NOT_TUNED,
+    CONNECTION_NOT_OPENED,
+    CONNECTION_OPEN,
+    CONNECTION_CLOSING,
+    CONNECTION_CLOSED;
 }

Modified: qpid/java/branches/6.0.x/client/src/main/java/org/apache/qpid/client/state/StateWaiter.java
URL: http://svn.apache.org/viewvc/qpid/java/branches/6.0.x/client/src/main/java/org/apache/qpid/client/state/StateWaiter.java?rev=1730065&r1=1730064&r2=1730065&view=diff
==============================================================================
--- qpid/java/branches/6.0.x/client/src/main/java/org/apache/qpid/client/state/StateWaiter.java
(original)
+++ qpid/java/branches/6.0.x/client/src/main/java/org/apache/qpid/client/state/StateWaiter.java
Fri Feb 12 16:39:31 2016
@@ -23,6 +23,7 @@ package org.apache.qpid.client.state;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import org.apache.qpid.AMQTimeoutException;
 import org.apache.qpid.QpidException;
 import org.apache.qpid.client.failover.FailoverException;
 import org.apache.qpid.client.util.BlockingWaiter;
@@ -113,9 +114,13 @@ public class StateWaiter extends Blockin
             {
                 return (AMQState) block(timeout);
             }
+            catch (AMQTimeoutException e)
+            {
+                throw new AMQTimeoutException("Waiting for " + timeout + "ms to attain one
of the states " + _awaitStates + "; current state is " + _stateManager.getCurrentState(),
e);
+            }
             catch (FailoverException e)
             {
-                _logger.error("Failover occured whilst waiting for states:" + _awaitStates);
+                _logger.error("Failover occurred whilst waiting for states:" + _awaitStates);
 
                 return null;
             }
@@ -125,7 +130,7 @@ public class StateWaiter extends Blockin
             //Prevent any more errors being notified to this waiter.
             close();
 
-            //Remove the waiter from the notifcation list in the statee manager
+            //Remove the waiter from the notification list in the state manager
             _stateManager.removeWaiter(this);
         }
     }



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


Mime
View raw message