diff options
| author | Aidan Skinner <aidan@apache.org> | 2008-07-29 16:20:06 +0000 |
|---|---|---|
| committer | Aidan Skinner <aidan@apache.org> | 2008-07-29 16:20:06 +0000 |
| commit | b853dea8f27f295dc535f190d9c95255bfa2f635 (patch) | |
| tree | d2f2228f9a11b96f6b57566cca78a3b580a79780 /qpid/java/client/src | |
| parent | a20fd18aa78bc4a385a0fb3ded48ed6f2e0143e2 (diff) | |
| download | qpid-python-b853dea8f27f295dc535f190d9c95255bfa2f635.tar.gz | |
QPID-1203: Add 08ExcludeList for external Java broker and make the profile use that.
Make AMQConnectionFactory take an optional clientid and use that if specified.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@680752 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/client/src')
| -rw-r--r-- | qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionFactory.java | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionFactory.java b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionFactory.java index 090620a560..01a915f2cc 100644 --- a/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionFactory.java +++ b/qpid/java/client/src/main/java/org/apache/qpid/client/AMQConnectionFactory.java @@ -293,14 +293,23 @@ public class AMQConnectionFactory implements ConnectionFactory, QueueConnectionF public Connection createConnection(String userName, String password) throws JMSException { + return createConnection(userName, password, null); + } + + public Connection createConnection(String userName, String password, String id) throws JMSException + { try { if (_connectionDetails != null) { _connectionDetails.setUsername(userName); _connectionDetails.setPassword(password); - - if (_connectionDetails.getClientName() == null || _connectionDetails.getClientName().equals("")) + + if (id != null && !id.equals("")) + { + _connectionDetails.setClientName(id); + } + else if (_connectionDetails.getClientName() == null || _connectionDetails.getClientName().equals("")) { _connectionDetails.setClientName(getUniqueClientID()); } @@ -308,7 +317,7 @@ public class AMQConnectionFactory implements ConnectionFactory, QueueConnectionF } else { - return new AMQConnection(_host, _port, userName, password, getUniqueClientID(), _virtualPath); + return new AMQConnection(_host, _port, userName, password, (id != null ? id : getUniqueClientID()), _virtualPath); } } catch (Exception e) |
