You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by na...@apache.org on 2006/10/14 06:09:44 UTC

svn commit: r463891 - in /webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws: core/controller/AxisInvocationController.java server/JAXWSMessageReceiver.java

Author: nagy
Date: Fri Oct 13 21:09:41 2006
New Revision: 463891

URL: http://svn.apache.org/viewvc?view=rev&rev=463891
Log:
Added calls to ThreadContextMigrator.cleanup* methods so that they will be invoked in the event of an excecption that occurs within the scope of an earlier ThreadContextMigrator.migrate* method that has not already been cleaned up.

Modified:
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/AxisInvocationController.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/JAXWSMessageReceiver.java

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/AxisInvocationController.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/AxisInvocationController.java?view=diff&rev=463891&r1=463890&r2=463891
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/AxisInvocationController.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/AxisInvocationController.java Fri Oct 13 21:09:41 2006
@@ -169,9 +169,17 @@
                 // Set the Axis2 request MessageContext
                 opClient.addMessageContext(axisRequestMsgCtx);
 
-                //This assumes that we are on the ultimate execution thread
-                ThreadContextMigratorUtil.performMigrationToContext(Constants.THREAD_CONTEXT_MIGRATOR_LIST_ID, axisRequestMsgCtx);
-                opClient.execute(true);
+                try
+                {
+                  //This assumes that we are on the ultimate execution thread
+                  ThreadContextMigratorUtil.performMigrationToContext(Constants.THREAD_CONTEXT_MIGRATOR_LIST_ID, axisRequestMsgCtx);
+                  opClient.execute(true);
+                }
+                catch (AxisFault e)
+                {
+                  ThreadContextMigratorUtil.performContextCleanup(Constants.THREAD_CONTEXT_MIGRATOR_LIST_ID, axisRequestMsgCtx);
+                  throw e;
+                }
                 ThreadContextMigratorUtil.performContextCleanup(Constants.THREAD_CONTEXT_MIGRATOR_LIST_ID, axisRequestMsgCtx);
                 
                 // Collect the response MessageContext and envelope
@@ -322,8 +330,16 @@
                 opClient.addMessageContext(axisRequestMsgCtx);
 
                 //This assumes that we are on the ultimate execution thread
-                ThreadContextMigratorUtil.performMigrationToContext(Constants.THREAD_CONTEXT_MIGRATOR_LIST_ID, axisRequestMsgCtx);
-                opClient.execute(true);
+                try
+                {
+                  ThreadContextMigratorUtil.performMigrationToContext(Constants.THREAD_CONTEXT_MIGRATOR_LIST_ID, axisRequestMsgCtx);
+                  opClient.execute(true);
+                }
+                catch (AxisFault e)
+                {
+                  ThreadContextMigratorUtil.performContextCleanup(Constants.THREAD_CONTEXT_MIGRATOR_LIST_ID, axisRequestMsgCtx);
+                  throw e;
+                }
                 ThreadContextMigratorUtil.performContextCleanup(Constants.THREAD_CONTEXT_MIGRATOR_LIST_ID, axisRequestMsgCtx);
             } catch (AxisFault e) {
                 throw ExceptionFactory.makeWebServiceException(e);
@@ -459,8 +475,16 @@
                 axisRequestMsgCtx.setServiceContext(svcClient.getServiceContext());
                 opClient.addMessageContext(axisRequestMsgCtx);
                 opClient.setCallback(axisCallback);
-                ThreadContextMigratorUtil.performMigrationToContext(Constants.THREAD_CONTEXT_MIGRATOR_LIST_ID, axisRequestMsgCtx);
-                opClient.execute(false);
+                try
+                {
+                  ThreadContextMigratorUtil.performMigrationToContext(Constants.THREAD_CONTEXT_MIGRATOR_LIST_ID, axisRequestMsgCtx);
+                  opClient.execute(false);
+                }
+                catch (AxisFault e)
+                {
+                  ThreadContextMigratorUtil.performContextCleanup(Constants.THREAD_CONTEXT_MIGRATOR_LIST_ID, axisRequestMsgCtx);
+                  throw e;
+                }
                 ThreadContextMigratorUtil.performContextCleanup(Constants.THREAD_CONTEXT_MIGRATOR_LIST_ID, axisRequestMsgCtx);
             } catch (AxisFault e) {
                 throw ExceptionFactory.makeWebServiceException(e);

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/JAXWSMessageReceiver.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/JAXWSMessageReceiver.java?view=diff&rev=463891&r1=463890&r2=463891
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/JAXWSMessageReceiver.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/server/JAXWSMessageReceiver.java Fri Oct 13 21:09:41 2006
@@ -165,26 +165,35 @@
                 
                 OperationContext opCtx = axisResponseMsgCtx.getOperationContext();
                 opCtx.addMessageContext(axisResponseMsgCtx);
-            
-                //This assumes that we are on the ultimate execution thread
-                ThreadContextMigratorUtil.performMigrationToContext(Constants.THREAD_CONTEXT_MIGRATOR_LIST_ID, axisResponseMsgCtx);
+
+                try
+                {
+                  //This assumes that we are on the ultimate execution thread
+                  ThreadContextMigratorUtil.performMigrationToContext(Constants.THREAD_CONTEXT_MIGRATOR_LIST_ID, axisResponseMsgCtx);
                 
-                //Create the AxisEngine for the reponse and send it.
-                AxisEngine engine = new AxisEngine(axisResponseMsgCtx.getConfigurationContext());
-                engine.send(axisResponseMsgCtx);
+                  //Create the AxisEngine for the reponse and send it.
+                  AxisEngine engine = new AxisEngine(axisResponseMsgCtx.getConfigurationContext());
+                  engine.send(axisResponseMsgCtx);
+                }
+                catch (AxisFault e)
+                {
+                  ThreadContextMigratorUtil.performContextCleanup(Constants.THREAD_CONTEXT_MIGRATOR_LIST_ID, axisResponseMsgCtx);
+                  throw e;
+                }
                 
                 //This assumes that we are on the ultimate execution thread
                 ThreadContextMigratorUtil.performContextCleanup(Constants.THREAD_CONTEXT_MIGRATOR_LIST_ID, axisResponseMsgCtx);
             }
 
-            //This assumes that we are on the ultimate execution thread
-            ThreadContextMigratorUtil.performThreadCleanup(Constants.THREAD_CONTEXT_MIGRATOR_LIST_ID, axisRequestMsgCtx);
-            
         } catch (Exception e) {
         	//TODO: This temp code for alpha till we add fault processing on client code.
         	// TODO NLS
+            ThreadContextMigratorUtil.performThreadCleanup(Constants.THREAD_CONTEXT_MIGRATOR_LIST_ID, axisRequestMsgCtx);
             throw ExceptionFactory.makeWebServiceException(e);
         } 
+
+        //This assumes that we are on the ultimate execution thread
+        ThreadContextMigratorUtil.performThreadCleanup(Constants.THREAD_CONTEXT_MIGRATOR_LIST_ID, axisRequestMsgCtx);
     }
     
     private boolean isMepInOnly(String mep){



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org