cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cschnei...@apache.org
Subject [2/2] cxf-dosgi git commit: [DOSGI-245] Remove thread context classloader as it works without now
Date Tue, 12 Jul 2016 14:06:24 GMT
[DOSGI-245] Remove thread context classloader as it works without now


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

Branch: refs/heads/master
Commit: a19974dadeff80e6901b07e55ffeab308459438c
Parents: 04cf85b
Author: Christian Schneider <chris@die-schneider.net>
Authored: Tue Jul 12 16:06:12 2016 +0200
Committer: Christian Schneider <chris@die-schneider.net>
Committed: Tue Jul 12 16:06:12 2016 +0200

----------------------------------------------------------------------
 .../cxf/dosgi/dsw/handlers/rest/RsProvider.java | 20 +-------------------
 .../cxf/dosgi/dsw/handlers/ws/WsProvider.java   | 14 ++------------
 2 files changed, 3 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/a19974da/provider-rs/src/main/java/org/apache/cxf/dosgi/dsw/handlers/rest/RsProvider.java
----------------------------------------------------------------------
diff --git a/provider-rs/src/main/java/org/apache/cxf/dosgi/dsw/handlers/rest/RsProvider.java
b/provider-rs/src/main/java/org/apache/cxf/dosgi/dsw/handlers/rest/RsProvider.java
index 2a61970..b3b254b 100644
--- a/provider-rs/src/main/java/org/apache/cxf/dosgi/dsw/handlers/rest/RsProvider.java
+++ b/provider-rs/src/main/java/org/apache/cxf/dosgi/dsw/handlers/rest/RsProvider.java
@@ -32,7 +32,6 @@ import org.apache.aries.rsa.spi.Endpoint;
 import org.apache.aries.rsa.spi.IntentUnsatisfiedException;
 import org.apache.cxf.Bus;
 import org.apache.cxf.BusFactory;
-import org.apache.cxf.common.util.ProxyClassLoader;
 import org.apache.cxf.dosgi.common.httpservice.HttpServiceManager;
 import org.apache.cxf.dosgi.common.intent.IntentHelper;
 import org.apache.cxf.dosgi.common.intent.IntentManager;
@@ -42,7 +41,6 @@ import org.apache.cxf.dosgi.common.util.ServerEndpoint;
 import org.apache.cxf.endpoint.AbstractEndpointFactory;
 import org.apache.cxf.endpoint.Server;
 import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
-import org.apache.cxf.jaxrs.client.Client;
 import org.apache.cxf.jaxrs.client.JAXRSClientFactoryBean;
 import org.apache.cxf.jaxrs.lifecycle.SingletonResourceProvider;
 import org.osgi.framework.BundleContext;
@@ -91,23 +89,7 @@ public class RsProvider implements DistributionProvider {
             LOG.warn("Remote address is unavailable");
             return null;
         }
-        ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
-        try {
-            Thread.currentThread().setContextClassLoader(JAXRSClientFactoryBean.class.getClassLoader());
-            return createJaxrsProxy(address, iClass, null, endpoint);
-        } catch (Throwable e) {
-            Thread.currentThread().setContextClassLoader(oldClassLoader);
-        }
-
-        try {
-            ProxyClassLoader cl = new ProxyClassLoader(iClass.getClassLoader());
-            cl.addLoader(Client.class.getClassLoader());
-            return createJaxrsProxy(address, iClass, cl, endpoint);
-        } catch (Throwable e) {
-            LOG.warn("proxy creation failed", e);
-        }
-
-        return null;
+        return createJaxrsProxy(address, iClass, null, endpoint);
     }
 
     private Object createJaxrsProxy(String address,

http://git-wip-us.apache.org/repos/asf/cxf-dosgi/blob/a19974da/provider-ws/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ws/WsProvider.java
----------------------------------------------------------------------
diff --git a/provider-ws/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ws/WsProvider.java
b/provider-ws/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ws/WsProvider.java
index 73157ab..2550128 100644
--- a/provider-ws/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ws/WsProvider.java
+++ b/provider-ws/src/main/java/org/apache/cxf/dosgi/dsw/handlers/ws/WsProvider.java
@@ -98,7 +98,6 @@ public class WsProvider implements DistributionProvider {
         String address = getClientAddress(sd);
         LOG.info("Creating a " + iClass.getName() + " client, endpoint address is " + address);
 
-        ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
         try {
             ClientProxyFactoryBean factory = createClientProxyFactoryBean(sd, iClass);
             factory.setDataBinding(getDataBinding(sd, iClass));
@@ -112,12 +111,9 @@ public class WsProvider implements DistributionProvider {
             intentManager.assertAllIntentsSupported(intents);
             intentManager.applyIntents(factory.getClientFactoryBean(), intents);
 
-            Thread.currentThread().setContextClassLoader(ClientProxyFactoryBean.class.getClassLoader());
             return ProxyFactory.create(factory.create(), iClass);
         } catch (Exception e) {
             throw new RuntimeException("proxy creation failed", e);
-        } finally {
-            Thread.currentThread().setContextClassLoader(oldClassLoader);
         }
     }
 
@@ -212,14 +208,8 @@ public class WsProvider implements DistributionProvider {
     }
 
     protected Endpoint createServerFromFactory(ServerFactoryBean factory, EndpointDescription
epd) {
-        ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
-        try {
-            Thread.currentThread().setContextClassLoader(ServerFactoryBean.class.getClassLoader());
-            Server server = factory.create();
-            return new ServerEndpoint(epd, server);
-        } finally {
-            Thread.currentThread().setContextClassLoader(oldClassLoader);
-        }
+        Server server = factory.create();
+        return new ServerEndpoint(epd, server);
     }
 
     protected static void addContextProperties(AbstractEndpointFactory factory, 


Mime
View raw message