cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r805907 - in /cxf/trunk: integration/jca/src/main/java/org/apache/cxf/jca/outbound/ rt/core/src/main/java/org/apache/cxf/endpoint/ rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/
Date Wed, 19 Aug 2009 18:08:32 GMT
Author: dkulp
Date: Wed Aug 19 18:08:31 2009
New Revision: 805907

URL: http://svn.apache.org/viewvc?rev=805907&view=rev
Log:
[CXF-2398] Make sure close() is called on the conduits for JCA. Heavily
modified patch from Seumas Soltysik applied.

Modified:
    cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/outbound/ManagedConnectionImpl.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
    cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java
    cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfiguration.java

Modified: cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/outbound/ManagedConnectionImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/outbound/ManagedConnectionImpl.java?rev=805907&r1=805906&r2=805907&view=diff
==============================================================================
--- cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/outbound/ManagedConnectionImpl.java
(original)
+++ cxf/trunk/integration/jca/src/main/java/org/apache/cxf/jca/outbound/ManagedConnectionImpl.java
Wed Aug 19 18:08:31 2009
@@ -50,6 +50,8 @@
 import org.apache.cxf.bus.spring.SpringBusFactory;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.configuration.Configurer;
+import org.apache.cxf.endpoint.Client;
+import org.apache.cxf.frontend.ClientProxy;
 import org.apache.cxf.frontend.ClientProxyFactoryBean;
 import org.apache.cxf.jaxws.EndpointUtils;
 import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
@@ -394,9 +396,8 @@
         }
         
         private Object handleCloseMethod(Object proxy, Method method,
-                Object[] args) {
+                Object[] args) { 
             
-
             handles.remove(proxy);
             associatedHandle = null;
             ConnectionEvent event = new ConnectionEvent(ManagedConnectionImpl.this,
@@ -404,6 +405,11 @@
             event.setConnectionHandle(proxy);
             sendEvent(event);
             
+            ConnectionInvocationHandler ch = 
+                (ConnectionInvocationHandler)Proxy.getInvocationHandler(proxy);         
  
+            Client client = ClientProxy.getClient(ch.target);
+            client.destroy();
+            
             return null;
         }
     }

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java?rev=805907&r1=805906&r2=805907&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java (original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java Wed Aug 19 18:08:31
2009
@@ -158,13 +158,14 @@
     }
 
     public void destroy() {
-
-        // TODO: also inform the conduit so it can shutdown any response listeners
-
         ClientLifeCycleManager mgr = bus.getExtension(ClientLifeCycleManager.class);
         if (null != mgr) {
             mgr.clientDestroyed(this);
         }
+
+        if (conduitSelector != null) {
+            getConduit().close();
+        }
     }
 
     private void notifyLifecycleManager() {

Modified: cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java?rev=805907&r1=805906&r2=805907&view=diff
==============================================================================
--- cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java
(original)
+++ cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java
Wed Aug 19 18:08:31 2009
@@ -27,6 +27,7 @@
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
+import javax.jms.ConnectionFactory;
 import javax.jms.Destination;
 import javax.jms.JMSException;
 import javax.jms.Session;
@@ -40,6 +41,7 @@
 import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.transport.AbstractConduit;
 import org.apache.cxf.ws.addressing.EndpointReferenceType;
+import org.springframework.jms.connection.SingleConnectionFactory;
 import org.springframework.jms.core.JmsTemplate;
 import org.springframework.jms.core.MessageCreator;
 
@@ -232,6 +234,12 @@
     }
 
     public void close() {
+        if (jmsConfig.getWrappedConnectionFactory() != null) {
+            ConnectionFactory f = jmsConfig.getWrappedConnectionFactory();
+            if (f instanceof SingleConnectionFactory) {
+                ((SingleConnectionFactory)f).destroy();
+            }
+        }
         LOG.log(Level.FINE, "JMSConduit closed ");
     }
 
@@ -254,6 +262,7 @@
     
     @Override
     protected void finalize() throws Throwable {
+        close();
         super.finalize();
     }
 }
\ No newline at end of file

Modified: cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfiguration.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfiguration.java?rev=805907&r1=805906&r2=805907&view=diff
==============================================================================
--- cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfiguration.java
(original)
+++ cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfiguration.java
Wed Aug 19 18:08:31 2009
@@ -417,7 +417,7 @@
      * 
      * @return usable connectionFactory
      */
-    public ConnectionFactory getOrCreateWrappedConnectionFactory() {
+    public synchronized ConnectionFactory getOrCreateWrappedConnectionFactory() {
         if (wrappedConnectionFactory == null) {
             if (connectionFactory == null) {
                 connectionFactory = JMSFactory.getConnectionFactoryFromJndi(this);
@@ -444,7 +444,9 @@
         }
         return wrappedConnectionFactory;
     }
-
+    public ConnectionFactory getWrappedConnectionFactory() {
+        return wrappedConnectionFactory;
+    }
     /**
      * Only for tests
      * @return



Mime
View raw message