@@ -73,19 +73,27 @@ public class AMQConnection extends ShutdownNotifierComponent implements Connecti
7373 /** Timeout used while waiting for a connection.close-ok (milliseconds) */
7474 public static final int CONNECTION_CLOSING_TIMEOUT = 10000 ;
7575
76- private static final Object [] DEFAULT_CLIENT_PROPERTIES_ARRAY =
77- new Object [] {
78- "product" , LongStringHelper .asLongString ("RabbitMQ" ),
79- "version" , LongStringHelper .asLongString (ClientVersion .VERSION ),
80- "platform" , LongStringHelper .asLongString ("Java" ),
81- "copyright" , LongStringHelper .asLongString (
82- "Copyright (C) 2007-2008 LShift Ltd., " +
83- "Cohesive Financial Technologies LLC., " +
84- "and Rabbit Technologies Ltd." ),
85- "information" , LongStringHelper .asLongString (
86- "Licensed under the MPL. " +
87- "See http://www.rabbitmq.com/" )
88- };
76+ /**
77+ * Retrieve a copy of the default table of client properties that
78+ * will be sent to the server during connection startup. This
79+ * method is called when each new ConnectionFactory instance is
80+ * constructed.
81+ * @return a map of client properties
82+ * @see Connection.getClientProperties()
83+ */
84+ public static Map <String , Object > defaultClientProperties () {
85+ return Frame .buildTable (new Object [] {
86+ "product" , LongStringHelper .asLongString ("RabbitMQ" ),
87+ "version" , LongStringHelper .asLongString (ClientVersion .VERSION ),
88+ "platform" , LongStringHelper .asLongString ("Java" ),
89+ "copyright" , LongStringHelper .asLongString (
90+ "Copyright (C) 2007-2008 LShift Ltd., " +
91+ "Cohesive Financial Technologies LLC., " +
92+ "and Rabbit Technologies Ltd." ),
93+ "information" , LongStringHelper .asLongString (
94+ "Licensed under the MPL. See http://www.rabbitmq.com/" )
95+ });
96+ }
8997
9098 private static final Version clientVersion =
9199 new Version (AMQP .PROTOCOL .MAJOR , AMQP .PROTOCOL .MINOR );
@@ -218,8 +226,7 @@ public AMQConnection(ConnectionFactory factory,
218226 _requestedChannelMax = factory .getRequestedChannelMax ();
219227 _requestedFrameMax = factory .getRequestedFrameMax ();
220228 _requestedHeartbeat = factory .getRequestedHeartbeat ();
221- _clientProperties =
222- buildClientPropertiesTable (factory .getClientProperties ());
229+ _clientProperties = new HashMap <String , Object >(factory .getClientProperties ());
223230
224231 this .factory = factory ;
225232 _frameHandler = frameHandler ;
@@ -414,14 +421,6 @@ public void writeFrame(Frame f) throws IOException {
414421 _lastActivityTime = System .nanoTime ();
415422 }
416423
417- private static Map <String , Object > buildClientPropertiesTable (
418- Map <String , Object > extraClientProperties ) {
419- Map <String , Object > props =
420- Frame .buildTable (DEFAULT_CLIENT_PROPERTIES_ARRAY );
421- props .putAll (extraClientProperties );
422- return props ;
423- }
424-
425424 private static int negotiatedMaxValue (int clientValue , int serverValue ) {
426425 return (clientValue == 0 || serverValue == 0 ) ?
427426 Math .max (clientValue , serverValue ) :
0 commit comments