cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject git commit: Use the same connection we already have on the server side to send the response rather than create a new connection
Date Thu, 13 Mar 2014 06:11:44 GMT
Repository: cxf
Updated Branches:
  refs/heads/master b11ce27dc -> a0aef78c0


Use the same connection we already have on the server side to send the response rather than
create a new connection


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/a0aef78c
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/a0aef78c
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/a0aef78c

Branch: refs/heads/master
Commit: a0aef78c0c059be5e3a33debe08a66b37b2989fc
Parents: b11ce27
Author: Daniel Kulp <dkulp@apache.org>
Authored: Thu Mar 13 01:59:46 2014 -0400
Committer: Daniel Kulp <dkulp@apache.org>
Committed: Thu Mar 13 01:59:46 2014 -0400

----------------------------------------------------------------------
 .../java/org/apache/cxf/transport/jms/BackChannelConduit.java | 7 +++----
 .../java/org/apache/cxf/transport/jms/JMSDestination.java     | 2 +-
 .../apache/cxf/transport/jms/util/JMSListenerContainer.java   | 4 ++++
 .../cxf/transport/jms/util/MessageListenerContainer.java      | 4 ++++
 .../org/apache/cxf/transport/jms/ThrottlingCounterTest.java   | 6 ++++++
 5 files changed, 18 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/a0aef78c/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/BackChannelConduit.java
----------------------------------------------------------------------
diff --git a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/BackChannelConduit.java
b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/BackChannelConduit.java
index bc273e0..d07b6be 100644
--- a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/BackChannelConduit.java
+++ b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/BackChannelConduit.java
@@ -27,7 +27,6 @@ import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import javax.jms.Connection;
-import javax.jms.ConnectionFactory;
 import javax.jms.Destination;
 import javax.jms.JMSException;
 import javax.jms.Session;
@@ -51,11 +50,13 @@ class BackChannelConduit extends AbstractConduit implements JMSExchangeSender
{
     private static final Logger LOG = LogUtils.getL7dLogger(JMSDestination.class);
     private JMSConfiguration jmsConfig;
     private Message inMessage;
+    private Connection connection;
     
-    BackChannelConduit(Message inMessage, JMSConfiguration jmsConfig) {
+    BackChannelConduit(Message inMessage, JMSConfiguration jmsConfig, Connection connection)
{
         super(EndpointReferenceUtils.getAnonymousEndpointReference());
         this.inMessage = inMessage;
         this.jmsConfig = jmsConfig;
+        this.connection = connection;
     }
     @Override
     public void close(Message msg) throws IOException {
@@ -111,8 +112,6 @@ class BackChannelConduit extends AbstractConduit implements JMSExchangeSender
{
 
         ResourceCloser closer = new ResourceCloser();
         try {
-            ConnectionFactory cf = jmsConfig.getConnectionFactory();
-            Connection connection = closer.register(cf.createConnection());
             Session session = closer
                 .register(connection.createSession(jmsConfig.isSessionTransacted(), Session.AUTO_ACKNOWLEDGE));
 

http://git-wip-us.apache.org/repos/asf/cxf/blob/a0aef78c/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
----------------------------------------------------------------------
diff --git a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
index f73c64a..1e349a0 100644
--- a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
+++ b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
@@ -70,7 +70,7 @@ public class JMSDestination extends AbstractMultiplexDestination
      * @return the inbuilt backchannel
      */
     protected Conduit getInbuiltBackChannel(Message inMessage) {
-        return new BackChannelConduit(inMessage, jmsConfig);
+        return new BackChannelConduit(inMessage, jmsConfig, jmsListener.getConnection());
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/cxf/blob/a0aef78c/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/util/JMSListenerContainer.java
----------------------------------------------------------------------
diff --git a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/util/JMSListenerContainer.java
b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/util/JMSListenerContainer.java
index 4a2187f..7adf956 100644
--- a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/util/JMSListenerContainer.java
+++ b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/util/JMSListenerContainer.java
@@ -19,9 +19,13 @@
 
 package org.apache.cxf.transport.jms.util;
 
+import javax.jms.Connection;
+
 public interface JMSListenerContainer {
     boolean isRunning();
     void stop();
     void start();
     void shutdown();
+    
+    Connection getConnection();
 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/a0aef78c/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/util/MessageListenerContainer.java
----------------------------------------------------------------------
diff --git a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/util/MessageListenerContainer.java
b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/util/MessageListenerContainer.java
index 03f5535..204fa51 100644
--- a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/util/MessageListenerContainer.java
+++ b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/util/MessageListenerContainer.java
@@ -54,6 +54,10 @@ public class MessageListenerContainer implements JMSListenerContainer {
         executor = Executors.newFixedThreadPool(20);
     }
     
+    public Connection getConnection() {
+        return connection;
+    }
+    
     public void setTransacted(boolean transacted) {
         this.transacted = transacted;
     }

http://git-wip-us.apache.org/repos/asf/cxf/blob/a0aef78c/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/ThrottlingCounterTest.java
----------------------------------------------------------------------
diff --git a/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/ThrottlingCounterTest.java
b/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/ThrottlingCounterTest.java
index d7e85b7..c222818 100644
--- a/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/ThrottlingCounterTest.java
+++ b/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/ThrottlingCounterTest.java
@@ -18,7 +18,10 @@
  */
 package org.apache.cxf.transport.jms;
 
+import javax.jms.Connection;
+
 import org.apache.cxf.transport.jms.util.JMSListenerContainer;
+
 import org.junit.Test;
 
 import static org.junit.Assert.assertFalse;
@@ -63,6 +66,9 @@ public class ThrottlingCounterTest {
         public void shutdown() {
         }
 
+        public Connection getConnection() {
+            return null;
+        }
     }
 
 }


Mime
View raw message