cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject svn commit: r1154466 - in /cxf/trunk/rt: bindings/coloc/src/main/java/org/apache/cxf/binding/coloc/ bindings/coloc/src/test/java/org/apache/cxf/binding/coloc/ core/src/main/java/org/apache/cxf/interceptor/ core/src/main/java/org/apache/cxf/transport/ f...
Date Sat, 06 Aug 2011 08:54:44 GMT
Author: ema
Date: Sat Aug  6 08:54:43 2011
New Revision: 1154466

URL: http://svn.apache.org/viewvc?rev=1154466&view=rev
Log:
[CXF-3716]:Move bus.getExtension(ClassLoader.class) to the constructor

Modified:
    cxf/trunk/rt/bindings/coloc/src/main/java/org/apache/cxf/binding/coloc/ColocMessageObserver.java
    cxf/trunk/rt/bindings/coloc/src/test/java/org/apache/cxf/binding/coloc/ColocMessageObserverTest.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractFaultChainInitiatorObserver.java
    cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/ChainInitiationObserver.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientMessageObserver.java
    cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java
    cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java
    cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFNonSpringServlet.java
    cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
    cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/continuations/JMSContinuation.java

Modified: cxf/trunk/rt/bindings/coloc/src/main/java/org/apache/cxf/binding/coloc/ColocMessageObserver.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/coloc/src/main/java/org/apache/cxf/binding/coloc/ColocMessageObserver.java?rev=1154466&r1=1154465&r2=1154466&view=diff
==============================================================================
--- cxf/trunk/rt/bindings/coloc/src/main/java/org/apache/cxf/binding/coloc/ColocMessageObserver.java
(original)
+++ cxf/trunk/rt/bindings/coloc/src/main/java/org/apache/cxf/binding/coloc/ColocMessageObserver.java
Sat Aug  6 08:54:43 2011
@@ -51,16 +51,16 @@ import org.apache.cxf.transport.ChainIni
 public class ColocMessageObserver extends ChainInitiationObserver {
     private static final Logger LOG = LogUtils.getL7dLogger(ColocMessageObserver.class);
     private static final String COLOCATED = Message.class.getName() + ".COLOCATED";
-
+    private ClassLoader loader;
     public ColocMessageObserver(Endpoint endpoint, Bus bus) {
         super(endpoint, bus);
+        loader = bus.getExtension(ClassLoader.class);
     }
 
     public void onMessage(Message m) {
         Bus origBus = BusFactory.getThreadDefaultBus(false);
         ClassLoader origLoader = Thread.currentThread().getContextClassLoader();
         try {
-            ClassLoader loader = bus.getExtension(ClassLoader.class);
             if (loader != null) {
                 Thread.currentThread().setContextClassLoader(loader);
             }

Modified: cxf/trunk/rt/bindings/coloc/src/test/java/org/apache/cxf/binding/coloc/ColocMessageObserverTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/coloc/src/test/java/org/apache/cxf/binding/coloc/ColocMessageObserverTest.java?rev=1154466&r1=1154465&r2=1154466&view=diff
==============================================================================
--- cxf/trunk/rt/bindings/coloc/src/test/java/org/apache/cxf/binding/coloc/ColocMessageObserverTest.java
(original)
+++ cxf/trunk/rt/bindings/coloc/src/test/java/org/apache/cxf/binding/coloc/ColocMessageObserverTest.java
Sat Aug  6 08:54:43 2011
@@ -77,10 +77,8 @@ public class ColocMessageObserverTest ex
 
     @Test
     public void testSetExchangeProperties() throws Exception {
-        observer = new ColocMessageObserver(ep, bus);
         QName opName = new QName("A", "B");
-        msg.put(Message.WSDL_OPERATION, opName);
-
+        msg.put(Message.WSDL_OPERATION, opName);    
         EasyMock.expect(ep.getService()).andReturn(srv);
         Binding binding = control.createMock(Binding.class);
         EasyMock.expect(ep.getBinding()).andReturn(binding);
@@ -91,8 +89,9 @@ public class ColocMessageObserverTest ex
         BindingOperationInfo boi = control.createMock(BindingOperationInfo.class);
         EasyMock.expect(bi.getOperation(opName)).andReturn(boi);
         EasyMock.expect(boi.getOperationInfo()).andReturn(oi);        
-
+        EasyMock.expect(bus.getExtension(ClassLoader.class)).andReturn(this.getClass().getClassLoader());
         control.replay();
+        observer = new ColocMessageObserver(ep, bus);
         observer.setExchangeProperties(ex, msg);
         control.verify();
 
@@ -112,7 +111,6 @@ public class ColocMessageObserverTest ex
 
     @Test
     public void testObserverOnMessage() throws Exception {
-        observer = new TestColocMessageObserver(ep, bus);
         msg.setExchange(ex);
         
         Binding binding = control.createMock(Binding.class);
@@ -131,8 +129,9 @@ public class ColocMessageObserverTest ex
         EasyMock.expect(bus.getInInterceptors()).andReturn(new ArrayList<Interceptor<?
extends Message>>());
         EasyMock.expect(ep.getInInterceptors()).andReturn(new ArrayList<Interceptor<?
extends Message>>());
         EasyMock.expect(srv.getInInterceptors()).andReturn(new ArrayList<Interceptor<?
extends Message>>());
-
+        EasyMock.expect(bus.getExtension(ClassLoader.class)).andReturn(this.getClass().getClassLoader());
         control.replay();
+        observer = new TestColocMessageObserver(ep, bus);
         observer.onMessage(msg);
         control.verify();
 

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractFaultChainInitiatorObserver.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractFaultChainInitiatorObserver.java?rev=1154466&r1=1154465&r2=1154466&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractFaultChainInitiatorObserver.java
(original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractFaultChainInitiatorObserver.java
Sat Aug  6 08:54:43 2011
@@ -41,9 +41,11 @@ public abstract class AbstractFaultChain
     private static final Logger LOG = LogUtils.getL7dLogger(AbstractFaultChainInitiatorObserver.class);
     
     private Bus bus;
+    private ClassLoader loader;
 
     public AbstractFaultChainInitiatorObserver(Bus bus) {
         this.bus = bus;
+        loader = bus.getExtension(ClassLoader.class);
     }
 
     public void onMessage(Message message) {
@@ -54,7 +56,6 @@ public abstract class AbstractFaultChain
         BusFactory.setThreadDefaultBus(bus);
         ClassLoader origLoader = Thread.currentThread().getContextClassLoader();
         try {
-            ClassLoader loader = bus.getExtension(ClassLoader.class);
             if (loader != null) {
                 Thread.currentThread().setContextClassLoader(loader);
             }

Modified: cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/ChainInitiationObserver.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/ChainInitiationObserver.java?rev=1154466&r1=1154465&r2=1154466&view=diff
==============================================================================
--- cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/ChainInitiationObserver.java
(original)
+++ cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/ChainInitiationObserver.java
Sat Aug  6 08:54:43 2011
@@ -46,6 +46,7 @@ import org.apache.cxf.service.model.Endp
 public class ChainInitiationObserver implements MessageObserver {
     protected Endpoint endpoint;
     protected Bus bus;
+    protected ClassLoader loader;
     
     private PhaseChainCache chainCache = new PhaseChainCache();
 
@@ -53,6 +54,9 @@ public class ChainInitiationObserver imp
         super();
         this.endpoint = endpoint;
         this.bus = bus;
+        if (bus != null) {
+            loader = bus.getExtension(ClassLoader.class);
+        }
     }
 
     public void onMessage(Message m) {
@@ -60,7 +64,6 @@ public class ChainInitiationObserver imp
         BusFactory.setThreadDefaultBus(bus);
         ClassLoader origLoader = Thread.currentThread().getContextClassLoader();
         try {
-            ClassLoader loader = bus.getExtension(ClassLoader.class);
             if (loader != null) {
                 Thread.currentThread().setContextClassLoader(loader);
             }

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientMessageObserver.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientMessageObserver.java?rev=1154466&r1=1154465&r2=1154466&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientMessageObserver.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/client/ClientMessageObserver.java
Sat Aug  6 08:54:43 2011
@@ -27,10 +27,12 @@ import org.apache.cxf.transport.MessageO
 
 class ClientMessageObserver implements MessageObserver {
 
-    private ClientConfiguration cfg; 
+    private ClientConfiguration cfg;
+    private ClassLoader loader;
     
     public ClientMessageObserver(ClientConfiguration cfg) {
         this.cfg = cfg;
+        loader = cfg.getBus().getExtension(ClassLoader.class);
     }
     
     public void onMessage(Message m) {
@@ -45,7 +47,6 @@ class ClientMessageObserver implements M
         BusFactory.setThreadDefaultBus(cfg.getBus());
         ClassLoader origLoader = Thread.currentThread().getContextClassLoader();
         try {
-            ClassLoader loader = cfg.getBus().getExtension(ClassLoader.class);
             if (loader != null) {
                 Thread.currentThread().setContextClassLoader(loader);
             }

Modified: cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java?rev=1154466&r1=1154465&r2=1154466&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java
(original)
+++ cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestination.java
Sat Aug  6 08:54:43 2011
@@ -62,6 +62,7 @@ public class JettyHTTPDestination extend
     protected JettyHTTPServerEngineFactory serverEngineFactory;
     protected ServletContext servletContext;
     protected URL nurl;
+    protected ClassLoader loader;
     
     /**
      * This variable signifies that finalizeConfig() has been called.
@@ -90,6 +91,7 @@ public class JettyHTTPDestination extend
         super(bus, registry, ei, getAddressValue(ei, true).getAddress(), true);
         this.serverEngineFactory = serverEngineFactory;
         nurl = new URL(endpointInfo.getAddress());
+        loader = bus.getExtension(ClassLoader.class);
     }
 
     protected Logger getLogger() {
@@ -278,7 +280,6 @@ public class JettyHTTPDestination extend
         // REVISIT: service on executor if associated with endpoint
         ClassLoader origLoader = Thread.currentThread().getContextClassLoader();
         try {
-            ClassLoader loader = bus.getExtension(ClassLoader.class);
             if (loader != null) {
                 Thread.currentThread().setContextClassLoader(loader);
             }

Modified: cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java?rev=1154466&r1=1154465&r2=1154466&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java
(original)
+++ cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java
Sat Aug  6 08:54:43 2011
@@ -571,8 +571,10 @@ public class JettyHTTPDestinationTest ex
             bus = EasyMock.createMock(Bus.class);
             bus.getExtension(EndpointResolverRegistry.class);
             EasyMock.expectLastCall().andReturn(null);
-            bus.getExtension(PolicyEngine.class);
+            bus.getExtension(PolicyEngine.class);          
             EasyMock.expectLastCall().andReturn(null);
+            bus.getExtension(ClassLoader.class);
+            EasyMock.expectLastCall().andReturn(this.getClass().getClassLoader());
             EasyMock.replay(bus);
         }
         

Modified: cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFNonSpringServlet.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFNonSpringServlet.java?rev=1154466&r1=1154465&r2=1154466&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFNonSpringServlet.java
(original)
+++ cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/servlet/CXFNonSpringServlet.java
Sat Aug  6 08:54:43 2011
@@ -40,6 +40,7 @@ public class CXFNonSpringServlet extends
     private DestinationRegistry destinationRegistry;
     private Bus bus;
     private ServletController controller;
+    private ClassLoader loader;
     
     public CXFNonSpringServlet() {
     }
@@ -54,7 +55,7 @@ public class CXFNonSpringServlet extends
         if (this.bus == null) {
             loadBus(sc);
         }
-
+        loader = bus.getExtension(ClassLoader.class);
         ResourceManager resourceManager = bus.getExtension(ResourceManager.class);
         resourceManager.addResourceResolver(new ServletContextResourceResolver(
                                                sc.getServletContext()));
@@ -106,7 +107,6 @@ public class CXFNonSpringServlet extends
     protected void invoke(HttpServletRequest request, HttpServletResponse response) throws
ServletException {
         ClassLoader origLoader = Thread.currentThread().getContextClassLoader();
         try {
-            ClassLoader loader = bus.getExtension(ClassLoader.class);
             if (loader != null) {
                 Thread.currentThread().setContextClassLoader(loader);
             }

Modified: cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java?rev=1154466&r1=1154465&r2=1154466&view=diff
==============================================================================
--- cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
(original)
+++ cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
Sat Aug  6 08:54:43 2011
@@ -81,6 +81,7 @@ public class JMSDestination extends Abst
     private AbstractMessageListenerContainer jmsListener;
     private Collection<JMSContinuation> continuations = 
         new ConcurrentLinkedQueue<JMSContinuation>();
+    private ClassLoader loader;
 
     public JMSDestination(Bus b, EndpointInfo info, JMSConfiguration jmsConfig) {
         super(b, getTargetReference(info, b), info);
@@ -88,6 +89,7 @@ public class JMSDestination extends Abst
         this.ei = info;
         this.jmsConfig = jmsConfig;
         info.setProperty(OneWayProcessorInterceptor.USE_ORIGINAL_THREAD, Boolean.TRUE);
+        loader = bus.getExtension(ClassLoader.class);
     }
 
     /**
@@ -183,7 +185,6 @@ public class JMSDestination extends Abst
     public void onMessage(javax.jms.Message message, Session session) {
         ClassLoader origLoader = Thread.currentThread().getContextClassLoader();
         try {
-            ClassLoader loader = bus.getExtension(ClassLoader.class);
             if (loader != null) {
                 Thread.currentThread().setContextClassLoader(loader);
             }

Modified: cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/continuations/JMSContinuation.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/continuations/JMSContinuation.java?rev=1154466&r1=1154465&r2=1154466&view=diff
==============================================================================
--- cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/continuations/JMSContinuation.java
(original)
+++ cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/continuations/JMSContinuation.java
Sat Aug  6 08:54:43 2011
@@ -50,6 +50,7 @@ public class JMSContinuation implements 
     private volatile boolean isResumed;
     private volatile boolean isCanceled;
     private WorkQueue workQueue;
+    private ClassLoader loader;
     
     public JMSContinuation(Bus b, Message m, MessageObserver observer,
                            Collection<JMSContinuation> cList, 
@@ -70,6 +71,7 @@ public class JMSContinuation implements 
         } else {
             LOG.warning("ERROR_GETTING_WORK_QUEUE");
         }
+        loader = bus.getExtension(ClassLoader.class);
     }
     
     public Object getObject() {
@@ -110,7 +112,6 @@ public class JMSContinuation implements 
         ClassLoader origLoader = Thread.currentThread().getContextClassLoader();
         try {
             BusFactory.setThreadDefaultBus(bus);
-            ClassLoader loader = bus.getExtension(ClassLoader.class);
             if (loader != null) {
                 Thread.currentThread().setContextClassLoader(loader);
             }



Mime
View raw message