[jbossws-commits] JBossWS SVN: r18295 - stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client.

jbossws-commits at lists.jboss.org jbossws-commits at lists.jboss.org
Thu Jan 30 12:13:26 EST 2014


Author: asoldano
Date: 2014-01-30 12:13:26 -0500 (Thu, 30 Jan 2014)
New Revision: 18295

Modified:
   stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/ProviderImpl.java
Log:
[JBWS-3755] Use ClassLoaderProvider.isSet() to know when to look for the ServerConfig in ProviderImpl


Modified: stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/ProviderImpl.java
===================================================================
--- stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/ProviderImpl.java	2014-01-30 17:10:12 UTC (rev 18294)
+++ stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/ProviderImpl.java	2014-01-30 17:13:26 UTC (rev 18295)
@@ -56,11 +56,10 @@
 import org.apache.cxf.jaxws.ServiceImpl;
 import org.apache.cxf.ws.addressing.EndpointReferenceType;
 import org.jboss.ws.api.configuration.AbstractClientFeature;
+import org.jboss.ws.common.management.AbstractServerConfig;
 import org.jboss.ws.common.utils.DelegateClassLoader;
-import org.jboss.wsf.spi.SPIProvider;
 import org.jboss.wsf.spi.classloading.ClassLoaderProvider;
 import org.jboss.wsf.spi.management.ServerConfig;
-import org.jboss.wsf.spi.management.ServerConfigFactory;
 import org.jboss.wsf.spi.metadata.config.ClientConfig;
 import org.jboss.wsf.stack.cxf.Loggers;
 import org.jboss.wsf.stack.cxf.Messages;
@@ -166,16 +165,6 @@
  */
 public class ProviderImpl extends org.apache.cxf.jaxws22.spi.ProviderImpl
 {
-   private static final boolean jbossModulesEnv;
-   private static ServerConfig serverConfig = null;
-   private static boolean serverConfigInit = false;
-
-   static {
-      //check if running in a JBoss Modules environment: the jbossws-cxf and cxf classes come
-      //from different classloader when using jboss-modules (no flat classloader)
-      jbossModulesEnv = (ProviderImpl.class.getClassLoader() != org.apache.cxf.jaxws22.spi.ProviderImpl.class.getClassLoader());
-   }
-
    @Override
    protected org.apache.cxf.jaxws.EndpointImpl createEndpointImpl(Bus bus, String bindingId, Object implementor,
          WebServiceFeature... features)
@@ -586,8 +575,8 @@
          Binding binding = ((BindingProvider)obj).getBinding();
          Client client = obj instanceof DispatchImpl<?> ? ((DispatchImpl<?>)obj).getClient() : ClientProxy.getClient(obj);
          client.getOutInterceptors().add(new HandlerChainSortInterceptor(binding));
-         if (jbossModulesEnv) { //optimization for avoiding checking for a server config when we know for sure we're out-of-container
-            ServerConfig sc = getServerConfig();
+         if (ClassLoaderProvider.isSet()) { //optimization for avoiding checking for a server config when we know for sure we're out-of-container
+            ServerConfig sc = AbstractServerConfig.getServerIntegrationServerConfig();
             if (sc != null) {
                ClientConfig config = sc.getClientConfig(ClientConfig.STANDARD_CLIENT_CONFIG);
                if (config != null) {
@@ -607,21 +596,4 @@
       }
    }
 
-   //lazy get the server config (and try once per classloader only)
-   private static synchronized ServerConfig getServerConfig()
-   {
-      if (!serverConfigInit)
-      {
-         try {
-            final ClassLoader cl = ClassLoaderProvider.getDefaultProvider().getServerIntegrationClassLoader();
-            serverConfig = SPIProvider.getInstance().getSPI(ServerConfigFactory.class, cl).getServerConfig();
-         } catch (Exception e) {
-            Loggers.ROOT_LOGGER.cannotRetrieveServerConfigIgnoreForClients(e);
-         } finally {
-            serverConfigInit = true;
-         }
-      }
-      return serverConfig;
-   }
-
 }



More information about the jbossws-commits mailing list