activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r382886 - /incubator/activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQResourceAdapter.java
Date Fri, 03 Mar 2006 16:57:50 GMT
Author: jstrachan
Date: Fri Mar  3 08:57:49 2006
New Revision: 382886

URL: http://svn.apache.org/viewcvs?rev=382886&view=rev
Log:
fixed bug if the connection factory already has a clientId configured

Modified:
    incubator/activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQResourceAdapter.java

Modified: incubator/activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQResourceAdapter.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQResourceAdapter.java?rev=382886&r1=382885&r2=382886&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQResourceAdapter.java
(original)
+++ incubator/activemq/trunk/activemq-ra/src/main/java/org/apache/activemq/ra/ActiveMQResourceAdapter.java
Fri Mar  3 08:57:49 2006
@@ -16,10 +16,13 @@
  */
 package org.apache.activemq.ra;
 
-import java.io.Serializable;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.HashMap;
+import org.apache.activemq.ActiveMQConnection;
+import org.apache.activemq.ActiveMQConnectionFactory;
+import org.apache.activemq.broker.BrokerFactory;
+import org.apache.activemq.broker.BrokerService;
+import org.apache.activemq.util.ServiceSupport;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 import javax.jms.Connection;
 import javax.jms.JMSException;
@@ -34,11 +37,10 @@
 import javax.resource.spi.endpoint.MessageEndpointFactory;
 import javax.transaction.xa.XAResource;
 
-import org.apache.activemq.ActiveMQConnection;
-import org.apache.activemq.ActiveMQConnectionFactory;
-import org.apache.activemq.broker.BrokerFactory;
-import org.apache.activemq.broker.BrokerService;
-import org.apache.activemq.util.ServiceSupport;
+import java.io.Serializable;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.HashMap;
 
 /**
  * Knows how to connect to one ActiveMQ server. It can then activate endpoints
@@ -52,6 +54,9 @@
  */
 public class ActiveMQResourceAdapter implements ResourceAdapter, Serializable {
 
+    private static final long serialVersionUID = -5417363537865649130L;
+    private static final Log log = LogFactory.getLog(ActiveMQResourceAdapter.class);
+    
     private final HashMap endpointWorkers = new HashMap();
     private final ActiveMQConnectionRequestInfo info = new ActiveMQConnectionRequestInfo();
 
@@ -114,10 +119,16 @@
         ActiveMQConnectionFactory connectionFactory = createConnectionFactory(info);
         String userName = defaultValue(activationSpec.getUserName(), info.getUserName());
         String password = defaultValue(activationSpec.getPassword(), info.getPassword());
-        ActiveMQConnection physicalConnection = (ActiveMQConnection) connectionFactory.createConnection(userName,
password);
-        if (activationSpec.isDurableSubscription()) {
-            physicalConnection.setClientID(activationSpec.getClientId());
+        String clientId = activationSpec.getClientId();
+        if (clientId != null) {
+            connectionFactory.setClientID(clientId);
+        }
+        else {
+            if (activationSpec.isDurableSubscription()) {
+                log.warn("No clientID specified for durable subscription: " + activationSpec);
+            }
         }
+        ActiveMQConnection physicalConnection = (ActiveMQConnection) connectionFactory.createConnection(userName,
password);
         return physicalConnection;
     }
 



Mime
View raw message