cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1469338 - in /cxf/branches/2.7.x-fixes: ./ rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/Client.java
Date Thu, 18 Apr 2013 14:17:47 GMT
Author: sergeyb
Date: Thu Apr 18 14:17:46 2013
New Revision: 1469338

URL: http://svn.apache.org/r1469338
Log:
Merged revisions 1469308 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1469308 | sergeyb | 2013-04-18 14:19:10 +0100 (Thu, 18 Apr 2013) | 1 line
  
  [CXF-4974] Adding close() method to Client interface
........

Modified:
    cxf/branches/2.7.x-fixes/   (props changed)
    cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java
    cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/Client.java

Propchange: cxf/branches/2.7.x-fixes/
------------------------------------------------------------------------------
  Merged /cxf/trunk:r1469308

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

Modified: cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java?rev=1469338&r1=1469337&r2=1469338&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java
(original)
+++ cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/AbstractClient.java
Thu Apr 18 14:17:46 2013
@@ -18,6 +18,8 @@
  */
 package org.apache.cxf.jaxrs.client;
 
+import java.io.Closeable;
+import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.io.Reader;
@@ -57,6 +59,7 @@ import javax.xml.stream.XMLStreamWriter;
 import org.apache.cxf.Bus;
 import org.apache.cxf.common.i18n.BundleUtils;
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.endpoint.ClientLifeCycleManager;
 import org.apache.cxf.endpoint.ConduitSelector;
 import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.endpoint.Retryable;
@@ -273,6 +276,29 @@ public abstract class AbstractClient imp
         return this;
     }
 
+    public void close() {
+        if (cfg.getBus() == null) {
+            return;
+        }
+        ClientLifeCycleManager mgr = cfg.getBus().getExtension(ClientLifeCycleManager.class);
+        if (null != mgr) {
+            mgr.clientDestroyed(new FrontendClientAdapter(getConfiguration()));
+        }
+
+        if (cfg.getConduitSelector() instanceof Closeable) {
+            try {
+                ((Closeable)cfg.getConduitSelector()).close();
+            } catch (IOException e) {
+                //ignore, we're destroying anyway
+            }
+        } else {
+            cfg.getConduit().close();
+        }
+        state.reset();
+        state = null;
+        cfg = null;
+    }
+
     private void possiblyAddHeader(String name, String value) {
         if (!isDuplicate(name, value)) {
             state.getRequestHeaders().add(name, value);

Modified: cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/Client.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/Client.java?rev=1469338&r1=1469337&r2=1469338&view=diff
==============================================================================
--- cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/Client.java
(original)
+++ cxf/branches/2.7.x-fixes/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/Client.java
Thu Apr 18 14:17:46 2013
@@ -156,4 +156,9 @@ public interface Client {
      * @return JAXRS Response response
      */
     Response getResponse();
+
+    /**
+     * Releases the internal state and configuration associated with this client 
+     */
+    void close(); 
 }



Mime
View raw message