Skip to content

Commit 6442179

Browse files
author
Vlad Ionescu
committed
fixing access to ConnectionFactory.DEFAULT_CLIENT_PROPERTIES - replaced with ConnectionFactory.getDefaultClientProperties() static function; fixing access to AMQConnection._clientProperties
1 parent 40c7571 commit 6442179

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

src/com/rabbitmq/client/Connection.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,9 @@ public interface Connection extends ShutdownNotifier { // rename to AMQPConnecti
9191
int getHeartbeat();
9292

9393
/**
94-
* Get the map of client properties sent to the server
94+
* Get a copy of the map of client properties sent to the server
9595
*
96-
* @return map of client properties
96+
* @return a copy of the map of client properties
9797
*/
9898
Map<String, Object> getClientProperties();
9999

src/com/rabbitmq/client/ConnectionFactory.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,6 @@ public class ConnectionFactory implements Cloneable {
7373
/** Default value for desired heartbeat interval; zero for none */
7474
public static final int DEFAULT_HEARTBEAT = 0;
7575

76-
/** Default extra client properties to be sent to the server */
77-
public static final Map<String, Object> DEFAULT_CLIENT_PROPERTIES =
78-
new HashMap<String, Object>();
79-
8076
/** The default host to connect to */
8177
public static final String DEFAULT_HOST = "localhost";
8278

@@ -102,7 +98,7 @@ public class ConnectionFactory implements Cloneable {
10298
private int requestedChannelMax = DEFAULT_CHANNEL_MAX;
10399
private int requestedFrameMax = DEFAULT_FRAME_MAX;
104100
private int requestedHeartbeat = DEFAULT_HEARTBEAT;
105-
private Map<String, Object> _clientProperties = DEFAULT_CLIENT_PROPERTIES;
101+
private Map<String, Object> _clientProperties = getDefaultClientProperties();
106102
private SocketFactory factory = SocketFactory.getDefault();
107103

108104
/**
@@ -241,6 +237,15 @@ public void setRequestedHeartbeat(int requestedHeartbeat) {
241237
this.requestedHeartbeat = requestedHeartbeat;
242238
}
243239

240+
/**
241+
* Retrieve the default table of extra client properties to be sent to the
242+
* server.
243+
* @return the map of extra client properties
244+
*/
245+
public static Map<String, Object> getDefaultClientProperties() {
246+
return new HashMap<String, Object>();
247+
}
248+
244249
/**
245250
* Retrieve the map of extra client properties to be sent to the server
246251
* @return the map of extra client properties

src/com/rabbitmq/client/impl/AMQConnection.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import java.io.IOException;
3636
import java.net.SocketException;
3737
import java.util.Map;
38+
import java.util.HashMap;
3839
import java.util.concurrent.TimeoutException;
3940

4041
import com.rabbitmq.client.AMQP;
@@ -365,7 +366,7 @@ public void setHeartbeat(int heartbeat) {
365366
}
366367

367368
public Map<String, Object> getClientProperties() {
368-
return _clientProperties;
369+
return new HashMap<String, Object>(_clientProperties);
369370
}
370371

371372
/**

0 commit comments

Comments
 (0)