Author: asoldano
Date: 2015-06-16 18:07:37 -0400 (Tue, 16 Jun 2015)
New Revision: 19793
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/BusHolder.java
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/MessagePropertySettingInterceptor.java
Log:
[JBWS-3920] Default to OneWayProcessorInterceptor.USE_ORIGINAL_THREAD = true
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/BusHolder.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/BusHolder.java 2015-06-16
03:15:03 UTC (rev 19792)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/configuration/BusHolder.java 2015-06-16
22:07:37 UTC (rev 19793)
@@ -33,6 +33,7 @@
import org.apache.cxf.buslifecycle.BusLifeCycleManager;
import org.apache.cxf.configuration.Configurer;
import org.apache.cxf.endpoint.ServerLifeCycleManager;
+import org.apache.cxf.interceptor.OneWayProcessorInterceptor;
import org.apache.cxf.management.InstrumentationManager;
import org.apache.cxf.management.counters.CounterRepository;
import org.apache.cxf.management.interceptor.ResponseTimeMessageInInterceptor;
@@ -161,6 +162,12 @@
bus.getExtension(FactoryBeanListenerManager.class).addListener(policySetsListener);
}
+ //default to USE_ORIGINAL_THREAD = true; this can be overridden by simply setting
the property in the endpoint or in the message using an interceptor
+ //this forces one way operation to use original thread, which is required for ejb
webserivce endpoints to avoid authorization failures from ejb container
+ //and is a performance improvement in general when running in-container, as CXF
needs to cache the message to free the thread, which is expensive
+ //(moreover the user can tune the web container thread pool instead of expecting
cxf to fork new threads)
+ bus.setProperty(OneWayProcessorInterceptor.USE_ORIGINAL_THREAD, true);
+
FeatureUtils.addFeatures(bus, bus, props);
}
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/MessagePropertySettingInterceptor.java
===================================================================
---
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/MessagePropertySettingInterceptor.java 2015-06-16
03:15:03 UTC (rev 19792)
+++
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/interceptor/MessagePropertySettingInterceptor.java 2015-06-16
22:07:37 UTC (rev 19793)
@@ -21,28 +21,20 @@
*/
package org.jboss.wsf.stack.cxf.interceptor;
-import org.apache.cxf.interceptor.Fault;
-import org.apache.cxf.interceptor.OneWayProcessorInterceptor;
import org.apache.cxf.message.Message;
import org.apache.cxf.phase.AbstractPhaseInterceptor;
import org.apache.cxf.phase.Phase;
import org.apache.cxf.ws.addressing.soap.MAPCodec;
-import org.jboss.wsf.spi.deployment.Endpoint;
-import org.jboss.wsf.spi.deployment.EndpointType;
/**
* This interceptor adds the following context properties to cxf message:
* <p>1.decoupled_fault_support<p>
* It enables decoupled faultTo. This is an optional feature in cxf and we
* need this to be default to make it same behavior with native stack.
- * <p>2.OneWayProcessorInterceptor.USE_ORIGINAL_THREAD<p>
- * This will force one way operation to use original thread for ejb webserivce endpoint
- * <p>to avoid authorization failure from ejb container
* @author <a href="mailto:ema@redhat.com">Jim Ma</a>
*/
public class MessagePropertySettingInterceptor extends
AbstractPhaseInterceptor<Message>
{
- private static EjbWSOneWayThreadInterceptor ejbOneWayInterceptor = new
EjbWSOneWayThreadInterceptor();
public MessagePropertySettingInterceptor()
{
@@ -53,38 +45,10 @@
public void handleMessage(Message message)
{
message.put("org.apache.cxf.ws.addressing.decoupled_fault_support",
true);
- message.getInterceptorChain().add(ejbOneWayInterceptor);
}
public void handleFault(Message message)
{
//complete
}
-
- private static class EjbWSOneWayThreadInterceptor extends
AbstractPhaseInterceptor<Message>
- {
- public EjbWSOneWayThreadInterceptor()
- {
- super(Phase.PRE_LOGICAL);
- this.addBefore(OneWayProcessorInterceptor.class.getName());
- }
-
- @Override
- public void handleMessage(Message message) throws Fault
- {
-
- Endpoint endpoint = message.getExchange().get(Endpoint.class);
- if (endpoint == null)
- {
- return;
- }
- //Use original thread for oneway message to avoid authorization failure in ejb
container for webservice endpoint
- if (endpoint.getType() == EndpointType.JAXWS_EJB3 &&
message.getExchange().isOneWay() && !isRequestor(message))
- {
- message.put(OneWayProcessorInterceptor.USE_ORIGINAL_THREAD, true);
- }
-
- }
- }
-
}
Show replies by date