Author: midon
Date: Tue Dec  2 19:21:34 2008
New Revision: 722734

URL: http://svn.apache.org/viewvc?rev=722734&view=rev
Log:
ODE-447 prevent reloading options during invocation preparation
The Options instance must not be changed in the middle of an invoke()
Meaning the check() method must be called only once.

Modified:
    
ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/SoapExternalService.java

Modified: 
ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/SoapExternalService.java
URL: 
http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/SoapExternalService.java?rev=722734&r1=722733&r2=722734&view=diff
==============================================================================
--- 
ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/SoapExternalService.java
 (original)
+++ 
ode/branches/APACHE_ODE_1.X/axis2/src/main/java/org/apache/ode/axis2/SoapExternalService.java
 Tue Dec  2 19:21:34 2008
@@ -134,13 +134,16 @@
     public void invoke(final PartnerRoleMessageExchange odeMex) {
         boolean isTwoWay = odeMex.getMessageExchangePattern() == 
org.apache.ode.bpel.iapi.MessageExchange.MessageExchangePattern.REQUEST_RESPONSE;
         try {
+
+            ServiceClient client = getServiceClient();
+
             // Override options are passed to the axis MessageContext so we can
             // retrieve them in our session out changeHandler.
             MessageContext mctx = new MessageContext();
             /* make the given options the parent so it becomes the defaults of 
the MessageContexgt. That allows the user to override
             *  specific options on a given message context and not affect the 
overall options.
             */
-            mctx.getOptions().setParent(getOptions());
+            mctx.getOptions().setParent(client.getOptions());
             writeHeader(mctx, odeMex);
 
             _converter.createSoapRequest(mctx, odeMex.getRequest(), 
odeMex.getOperation());
@@ -153,8 +156,6 @@
                 __log.debug("Message: " + soapEnv);
             }
 
-            ServiceClient client = getServiceClient();
-
             final OperationClient operationClient = 
client.createClient(isTwoWay ? ServiceClient.ANON_OUT_IN_OP
                     : ServiceClient.ANON_OUT_ONLY_OP);
             operationClient.addMessageContext(mctx);
@@ -229,6 +230,7 @@
             // call manually the check procedure
             // we dont want a dedicated thread for that
             _axisServiceWatchDog.check();
+            _axisOptionsWatchDog.check();
         } catch (RuntimeException e) {
             throw AxisFault.makeFault(e.getCause() != null ? e.getCause() : e);
         }
@@ -241,22 +243,12 @@
         }
         AxisService anonymousService = 
_axisServiceWatchDog.getObserver().anonymousService;
         serviceClient.setAxisService(anonymousService);
-        serviceClient.setOptions(getOptions());
+        serviceClient.setOptions(_axisOptionsWatchDog.getObserver().options);
 
-        applySecuritySettings(getOptions(), serviceClient);
+        applySecuritySettings(_axisOptionsWatchDog.getObserver().options, 
serviceClient);
 
         return serviceClient;
     }
-
-    private Options getOptions() throws AxisFault {
-        try {
-            _axisOptionsWatchDog.check();
-        } catch (RuntimeException e) {
-            throw AxisFault.makeFault(e.getCause() != null ? e.getCause() : e);
-        }
-        return _axisOptionsWatchDog.getObserver().options;
-    }
-
     private void applySecuritySettings(Options options, ServiceClient 
serviceClient) throws AxisFault {
         if (options.getProperty(Properties.PROP_SECURITY_POLICY) != null) {
             String policy = (String) 
options.getProperty(Properties.PROP_SECURITY_POLICY);


Reply via email to