Author: alessio.soldano(a)jboss.com
Date: 2011-02-28 11:33:18 -0500 (Mon, 28 Feb 2011)
New Revision: 13810
Modified:
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/ProviderImpl.java
Log:
[JBWS-3223] Avoid using default bus when thread default bus is not available at endpoint
creation
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 2011-02-28
14:04:26 UTC (rev 13809)
+++
stack/cxf/trunk/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/ProviderImpl.java 2011-02-28
16:33:18 UTC (rev 13810)
@@ -84,6 +84,14 @@
try
{
restoreTCCL = checkAndFixContextClassLoader(origClassLoader);
+ //we override this method to prevent using the default bus when the current
+ //thread is not already associated to a bus. In those situations we create
+ //a new bus from scratch instead and link that to the thread.
+ Bus bus = BusFactory.getThreadDefaultBus(false);
+ if (bus == null)
+ {
+ bus = BusFactory.newInstance().createBus(); //this also set thread local bus
internally as it's not set yet
+ }
return new DelegateEndpointImpl(super.createEndpoint(bindingId, implementor));
}
finally
@@ -102,6 +110,14 @@
try
{
restoreTCCL = checkAndFixContextClassLoader(origClassLoader);
+ //we override this method to prevent using the default bus when the current
+ //thread is not already associated to a bus. In those situations we create
+ //a new bus from scratch instead and link that to the thread.
+ Bus bus = BusFactory.getThreadDefaultBus(false);
+ if (bus == null)
+ {
+ bus = BusFactory.newInstance().createBus(); //this also set thread local bus
internally as it's not set yet
+ }
return new DelegateEndpointImpl(super.createEndpoint(bindingId, implementor,
features));
}
finally
Show replies by date