cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1153932 - in /cxf/branches/2.4.x-fixes: ./ api/src/main/java/org/apache/cxf/endpoint/ rt/core/src/main/java/org/apache/cxf/endpoint/ rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/ rt/frontend/simple/src/main/java/org/apache/c...
Date Thu, 04 Aug 2011 17:10:53 GMT
Author: dkulp
Date: Thu Aug  4 17:10:52 2011
New Revision: 1153932

URL: http://svn.apache.org/viewvc?rev=1153932&view=rev
Log:
Merged revisions 1153930 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1153930 | dkulp | 2011-08-04 13:05:14 -0400 (Thu, 04 Aug 2011) | 1 line
  
  [CXF-3710, CXF-3711] Some client shutdown enhancements and optimizations
........

Modified:
    cxf/branches/2.4.x-fixes/   (props changed)
    cxf/branches/2.4.x-fixes/api/src/main/java/org/apache/cxf/endpoint/AbstractConduitSelector.java
    cxf/branches/2.4.x-fixes/api/src/main/java/org/apache/cxf/endpoint/ConduitSelector.java
    cxf/branches/2.4.x-fixes/api/src/main/java/org/apache/cxf/endpoint/PreexistingConduitSelector.java
    cxf/branches/2.4.x-fixes/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
    cxf/branches/2.4.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/JaxWsProxyFactoryBeanDefinitionParser.java
    cxf/branches/2.4.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/spring/ClientProxyFactoryBeanDefinitionParser.java

Propchange: cxf/branches/2.4.x-fixes/
            ('svn:mergeinfo' removed)

Propchange: cxf/branches/2.4.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.4.x-fixes/api/src/main/java/org/apache/cxf/endpoint/AbstractConduitSelector.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/api/src/main/java/org/apache/cxf/endpoint/AbstractConduitSelector.java?rev=1153932&r1=1153931&r2=1153932&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/api/src/main/java/org/apache/cxf/endpoint/AbstractConduitSelector.java
(original)
+++ cxf/branches/2.4.x-fixes/api/src/main/java/org/apache/cxf/endpoint/AbstractConduitSelector.java
Thu Aug  4 17:10:52 2011
@@ -19,6 +19,7 @@
 
 package org.apache.cxf.endpoint;
 
+import java.io.Closeable;
 import java.io.IOException;
 import java.util.logging.Logger;
 
@@ -41,7 +42,7 @@ import org.apache.cxf.ws.addressing.Endp
  * Abstract base class holding logic common to any ConduitSelector
  * that retreives a Conduit from the ConduitInitiator.
  */
-public abstract class AbstractConduitSelector implements ConduitSelector {
+public abstract class AbstractConduitSelector implements ConduitSelector, Closeable {
     protected static final String KEEP_CONDUIT_ALIVE = "KeepConduitAlive";
     
     protected Conduit selectedConduit;
@@ -56,6 +57,12 @@ public abstract class AbstractConduitSel
         selectedConduit = c;
     }
         
+    public void close() {
+        if (selectedConduit != null) {
+            selectedConduit.close();
+            selectedConduit = null;
+        }
+    }
     /**
      * Mechanics to actually get the Conduit from the ConduitInitiator
      * if necessary.

Modified: cxf/branches/2.4.x-fixes/api/src/main/java/org/apache/cxf/endpoint/ConduitSelector.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/api/src/main/java/org/apache/cxf/endpoint/ConduitSelector.java?rev=1153932&r1=1153931&r2=1153932&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/api/src/main/java/org/apache/cxf/endpoint/ConduitSelector.java
(original)
+++ cxf/branches/2.4.x-fixes/api/src/main/java/org/apache/cxf/endpoint/ConduitSelector.java
Thu Aug  4 17:10:52 2011
@@ -25,7 +25,7 @@ import org.apache.cxf.transport.Conduit;
 
 
 /**
- * Strategy for retreiving a Conduit to mediate an outbound message.
+ * Strategy for retrieving a Conduit to mediate an outbound message.
  * A specific instance implementing a particular strategy may be injected
  * into the Client via config.
  */

Modified: cxf/branches/2.4.x-fixes/api/src/main/java/org/apache/cxf/endpoint/PreexistingConduitSelector.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/api/src/main/java/org/apache/cxf/endpoint/PreexistingConduitSelector.java?rev=1153932&r1=1153931&r2=1153932&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/api/src/main/java/org/apache/cxf/endpoint/PreexistingConduitSelector.java
(original)
+++ cxf/branches/2.4.x-fixes/api/src/main/java/org/apache/cxf/endpoint/PreexistingConduitSelector.java
Thu Aug  4 17:10:52 2011
@@ -19,6 +19,7 @@
 
 package org.apache.cxf.endpoint;
 
+import java.io.Closeable;
 import java.io.IOException;
 
 import org.apache.cxf.message.Exchange;
@@ -32,7 +33,7 @@ import org.apache.cxf.transport.MessageO
  * outbound message.
  */
 public class PreexistingConduitSelector implements
-    ConduitSelector {
+    ConduitSelector, Closeable {
 
     private Conduit selectedConduit;
     private Endpoint endpoint;
@@ -108,4 +109,8 @@ public class PreexistingConduitSelector 
     public void setEndpoint(Endpoint ep) {
         endpoint = ep;
     }
+
+    public void close() throws IOException {
+        selectedConduit.close();
+    }
 }

Modified: cxf/branches/2.4.x-fixes/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java?rev=1153932&r1=1153931&r2=1153932&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
(original)
+++ cxf/branches/2.4.x-fixes/rt/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
Thu Aug  4 17:10:52 2011
@@ -19,6 +19,7 @@
 
 package org.apache.cxf.endpoint;
 
+import java.io.Closeable;
 import java.io.IOException;
 import java.net.URI;
 import java.net.URISyntaxException;
@@ -204,7 +205,15 @@ public class ClientImpl
         }
 
         if (conduitSelector != null) {
-            getConduit().close();
+            if (conduitSelector instanceof Closeable) {
+                try {
+                    ((Closeable)conduitSelector).close();
+                } catch (IOException e) {
+                    //ignore, we're destroying anyway
+                }
+            } else {
+                getConduit().close();
+            }
         }
     }
 

Modified: cxf/branches/2.4.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/JaxWsProxyFactoryBeanDefinitionParser.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/JaxWsProxyFactoryBeanDefinitionParser.java?rev=1153932&r1=1153931&r2=1153932&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/JaxWsProxyFactoryBeanDefinitionParser.java
(original)
+++ cxf/branches/2.4.x-fixes/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/spring/JaxWsProxyFactoryBeanDefinitionParser.java
Thu Aug  4 17:10:52 2011
@@ -18,13 +18,18 @@
  */
 package org.apache.cxf.jaxws.spring;
 
+import java.io.Closeable;
+
 import org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor;
 import org.apache.cxf.common.injection.NoJSR250Annotations;
+import org.apache.cxf.endpoint.Client;
 import org.apache.cxf.frontend.ClientFactoryBean;
+import org.apache.cxf.frontend.ClientProxy;
 import org.apache.cxf.frontend.spring.ClientProxyFactoryBeanDefinitionParser;
 import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
 
 import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.DisposableBean;
 import org.springframework.beans.factory.FactoryBean;
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.ApplicationContextAware;
@@ -53,7 +58,7 @@ public class JaxWsProxyFactoryBeanDefini
 
     @NoJSR250Annotations
     public static class JAXWSSpringClientProxyFactoryBean extends JaxWsProxyFactoryBean
-        implements ApplicationContextAware, FactoryBean {
+        implements ApplicationContextAware, FactoryBean, DisposableBean {
 
         private Object obj;
 
@@ -85,5 +90,15 @@ public class JaxWsProxyFactoryBeanDefini
         public boolean isSingleton() {
             return true;
         }
+        public void destroy() throws Exception {
+            if (obj != null) {
+                if (obj instanceof Closeable) {
+                    ((Closeable)obj).close();
+                } else {
+                    Client c = ClientProxy.getClient(obj);
+                    c.destroy();
+                }
+            }
+        }
     }
 }

Modified: cxf/branches/2.4.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/spring/ClientProxyFactoryBeanDefinitionParser.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.4.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/spring/ClientProxyFactoryBeanDefinitionParser.java?rev=1153932&r1=1153931&r2=1153932&view=diff
==============================================================================
--- cxf/branches/2.4.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/spring/ClientProxyFactoryBeanDefinitionParser.java
(original)
+++ cxf/branches/2.4.x-fixes/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/spring/ClientProxyFactoryBeanDefinitionParser.java
Thu Aug  4 17:10:52 2011
@@ -18,6 +18,7 @@
  */
 package org.apache.cxf.frontend.spring;
 
+import java.io.Closeable;
 import java.util.List;
 import java.util.Map;
 
@@ -28,9 +29,12 @@ import org.w3c.dom.Element;
 import org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor;
 import org.apache.cxf.common.injection.NoJSR250Annotations;
 import org.apache.cxf.configuration.spring.AbstractFactoryBeanDefinitionParser;
+import org.apache.cxf.endpoint.Client;
 import org.apache.cxf.frontend.ClientFactoryBean;
+import org.apache.cxf.frontend.ClientProxy;
 import org.apache.cxf.frontend.ClientProxyFactoryBean;
 import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.DisposableBean;
 import org.springframework.beans.factory.FactoryBean;
 import org.springframework.beans.factory.support.BeanDefinitionBuilder;
 import org.springframework.beans.factory.xml.ParserContext;
@@ -91,7 +95,7 @@ public class ClientProxyFactoryBeanDefin
     
     @NoJSR250Annotations
     public static class SpringClientProxyFactoryBean extends ClientProxyFactoryBean
-        implements ApplicationContextAware, FactoryBean {
+        implements ApplicationContextAware, FactoryBean, DisposableBean {
 
         private Object obj;
         
@@ -123,5 +127,15 @@ public class ClientProxyFactoryBeanDefin
         public boolean isSingleton() {
             return true;
         }
+        public void destroy() throws Exception {
+            if (obj != null) {
+                if (obj instanceof Closeable) {
+                    ((Closeable)obj).close();
+                } else {
+                    Client c = ClientProxy.getClient(obj);
+                    c.destroy();
+                }
+            }
+        }
     }
 }



Mime
View raw message