cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject [2/2] cxf git commit: - implemented AutoCloseable Client This closes #124
Date Fri, 31 Mar 2017 16:50:28 GMT
 - implemented AutoCloseable Client
This closes #124


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

Branch: refs/heads/master
Commit: e262bd20dbc8e8567ffe0c8ed3d394191696e981
Parents: ef3ca8e
Author: bilak <bilaak@gmail.com>
Authored: Thu Mar 31 11:44:32 2016 +0200
Committer: Daniel Kulp <dkulp@apache.org>
Committed: Fri Mar 31 12:50:21 2017 -0400

----------------------------------------------------------------------
 core/src/main/java/org/apache/cxf/endpoint/Client.java    |  2 +-
 .../src/main/java/org/apache/cxf/endpoint/ClientImpl.java | 10 ++++++++++
 .../apache/cxf/endpoint/dynamic/DynamicClientFactory.java |  6 +++---
 .../apache/cxf/jaxrs/client/FrontendClientAdapter.java    |  5 ++++-
 4 files changed, 18 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/e262bd20/core/src/main/java/org/apache/cxf/endpoint/Client.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/endpoint/Client.java b/core/src/main/java/org/apache/cxf/endpoint/Client.java
index 6ff2940..27ec1b3 100644
--- a/core/src/main/java/org/apache/cxf/endpoint/Client.java
+++ b/core/src/main/java/org/apache/cxf/endpoint/Client.java
@@ -31,7 +31,7 @@ import org.apache.cxf.service.model.BindingOperationInfo;
 import org.apache.cxf.transport.Conduit;
 import org.apache.cxf.transport.MessageObserver;
 
-public interface Client extends InterceptorProvider, MessageObserver, ConduitSelectorHolder
{
+public interface Client extends InterceptorProvider, MessageObserver, ConduitSelectorHolder,
AutoCloseable {
     String REQUEST_CONTEXT = "RequestContext";
     String RESPONSE_CONTEXT = "ResponseContext";
     String KEEP_CONDUIT_ALIVE = "KeepConduitAlive";

http://git-wip-us.apache.org/repos/asf/cxf/blob/e262bd20/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java b/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
index 09f8373..9551c3f 100644
--- a/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
+++ b/core/src/main/java/org/apache/cxf/endpoint/ClientImpl.java
@@ -175,6 +175,11 @@ public class ClientImpl
             }
         }
 
+        ClassLoaderHolder holder = bus.getExtension(ClassLoaderHolder.class);
+        if (null != holder){
+            holder.reset();
+        }
+        
         bus = null;
         conduitSelector = null;
         outFaultObserver = null;
@@ -1020,6 +1025,11 @@ public class ClientImpl
         return Boolean.TRUE.equals(in.get(Message.PARTIAL_RESPONSE_MESSAGE));
     }
 
+    @Override
+    public void close() throws Exception {
+        destroy();
+    }
+
 
     /*
      * modification are echoed back to the shared map

http://git-wip-us.apache.org/repos/asf/cxf/blob/e262bd20/rt/frontend/simple/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java
----------------------------------------------------------------------
diff --git a/rt/frontend/simple/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java
b/rt/frontend/simple/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java
index 1640cfc..36aa236 100644
--- a/rt/frontend/simple/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java
+++ b/rt/frontend/simple/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java
@@ -424,7 +424,8 @@ public class DynamicClientFactory {
         ServiceInfo svcfo = client.getEndpoint().getEndpointInfo().getService();
 
         // Setup the new classloader!
-        ClassLoaderUtils.setThreadContextClassloader(cl);
+        ClassLoaderUtils.ClassLoaderHolder holder = ClassLoaderUtils.setThreadContextClassloader(cl);
+        bus.setExtension(holder, ClassLoaderUtils.ClassLoaderHolder.class);
 
         TypeClassInitializer visitor = new TypeClassInitializer(svcfo,
                                                                 intermediateModel,
@@ -440,7 +441,7 @@ public class DynamicClientFactory {
 
     protected SchemaCompiler createSchemaCompiler() {
         SchemaCompiler compiler =
-            JAXBUtils.createSchemaCompilerWithDefaultAllocator(new HashSet<>());
+         JAXBUtils.createSchemaCompilerWithDefaultAllocator(new HashSet<>());
         if (schemaCompilerOptions != null && schemaCompilerOptions.length > 0)
{
             compiler.getOptions().parseArguments(schemaCompilerOptions);
         }
@@ -630,7 +631,6 @@ public class DynamicClientFactory {
         } else {
             javaCompiler.setTarget("1.6");
         }
-
         return javaCompiler.compileFiles(srcList);
     }
 

http://git-wip-us.apache.org/repos/asf/cxf/blob/e262bd20/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/FrontendClientAdapter.java
----------------------------------------------------------------------
diff --git a/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/FrontendClientAdapter.java
b/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/FrontendClientAdapter.java
index d76b3dc..ab6f3a4 100644
--- a/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/FrontendClientAdapter.java
+++ b/rt/rs/client/src/main/java/org/apache/cxf/jaxrs/client/FrontendClientAdapter.java
@@ -209,5 +209,8 @@ class FrontendClientAdapter implements org.apache.cxf.endpoint.Client
{
         throw new UnsupportedOperationException();
     }
 
-
+    @Override
+    public void close() throws Exception {
+        destroy();
+    }
 }


Mime
View raw message