ode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mr...@apache.org
Subject svn commit: r544215 - in /incubator/ode/trunk: axis2/src/main/java/org/apache/ode/axis2/ bpel-runtime/src/main/java/org/apache/ode/bpel/engine/
Date Mon, 04 Jun 2007 19:00:18 GMT
Author: mriou
Date: Mon Jun  4 12:00:15 2007
New Revision: 544215

URL: http://svn.apache.org/viewvc?view=rev&rev=544215
Log:
Closing a few loopholes causing leakage for in-mem processes in on-way interactions.

Modified:
    incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEService.java
    incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcess.java
    incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java
    incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/MyRoleMessageExchangeImpl.java

Modified: incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEService.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEService.java?view=diff&rev=544215&r1=544214&r2=544215
==============================================================================
--- incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEService.java (original)
+++ incubator/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/ODEService.java Mon Jun 
4 12:00:15 2007
@@ -144,64 +144,64 @@
         }
 
         if (odeMex.getOperation().getOutput() != null) {
-                // Waits for the response to arrive
-                try {
-                    responseFuture.get(TIMEOUT, TimeUnit.MILLISECONDS);
-                } catch (Exception e) {
-                    String errorMsg = "Timeout or execution error when waiting for response
to MEX "
-                            + odeMex + " " + e.toString();
-                    __log.error(errorMsg);
-                    throw new OdeFault(errorMsg);
-                }
+            // Waits for the response to arrive
+            try {
+                responseFuture.get(TIMEOUT, TimeUnit.MILLISECONDS);
+            } catch (Exception e) {
+                String errorMsg = "Timeout or execution error when waiting for response to
MEX "
+                        + odeMex + " " + e.toString();
+                __log.error(errorMsg);
+                throw new OdeFault(errorMsg);
+            }
 
-                if (outMsgContext != null) {
-                    SOAPEnvelope envelope = soapFactory.getDefaultEnvelope();
-                    outMsgContext.setEnvelope(envelope);
+            if (outMsgContext != null) {
+                SOAPEnvelope envelope = soapFactory.getDefaultEnvelope();
+                outMsgContext.setEnvelope(envelope);
 
-                    // Hopefully we have a response
-                    __log.debug("Handling response for MEX " + odeMex);
-                    boolean commit = false;
-                    try {
-                        if (__log.isDebugEnabled()) __log.debug("Starting transaction.");
-                        _txManager.begin();
-                    } catch (Exception ex) {
-                        throw new OdeFault("Error starting transaction!", ex);
-                    }
-                    try {
-                        // Refreshing the message exchange
-                        odeMex = (MyRoleMessageExchange) _server.getEngine().getMessageExchange(odeMex.getMessageExchangeId());
-                        onResponse(odeMex, outMsgContext);
-                        commit = true;
-                    } catch (AxisFault af) {
-                        __log.error("Error processing response for MEX " + odeMex, af);
-                        commit = true;
-                        throw af;
-                    } catch (Exception e) {
-                        __log.error("Error processing response for MEX " + odeMex, e);
-                        throw new OdeFault("An exception occured when invoking ODE.", e);
-                    } finally {
-                        odeMex.release();
-                        if (commit) {
-                            try {
-                                if (__log.isDebugEnabled()) __log.debug("Comitting transaction.");
-                                _txManager.commit();
-                            } catch (Exception e) {
-                                throw new OdeFault("Commit failed!", e);
-                            }
-                        } else {
-                            try {
-                                _txManager.rollback();
-                            } catch (Exception ex) {
-                                throw new OdeFault("Rollback failed!", ex);
-                            }
+                // Hopefully we have a response
+                __log.debug("Handling response for MEX " + odeMex);
+                boolean commit = false;
+                try {
+                    if (__log.isDebugEnabled()) __log.debug("Starting transaction.");
+                    _txManager.begin();
+                } catch (Exception ex) {
+                    throw new OdeFault("Error starting transaction!", ex);
+                }
+                try {
+                    // Refreshing the message exchange
+                    odeMex = (MyRoleMessageExchange) _server.getEngine().getMessageExchange(odeMex.getMessageExchangeId());
+                    onResponse(odeMex, outMsgContext);
+                    commit = true;
+                } catch (AxisFault af) {
+                    __log.error("Error processing response for MEX " + odeMex, af);
+                    commit = true;
+                    throw af;
+                } catch (Exception e) {
+                    __log.error("Error processing response for MEX " + odeMex, e);
+                    throw new OdeFault("An exception occured when invoking ODE.", e);
+                } finally {
+                    odeMex.release();
+                    if (commit) {
+                        try {
+                            if (__log.isDebugEnabled()) __log.debug("Comitting transaction.");
+                            _txManager.commit();
+                        } catch (Exception e) {
+                            throw new OdeFault("Commit failed!", e);
+                        }
+                    } else {
+                        try {
+                            _txManager.rollback();
+                        } catch (Exception ex) {
+                            throw new OdeFault("Rollback failed!", ex);
                         }
+                    }
                 }
             }
             if (!success) {
                 throw new OdeFault("Message was either unroutable or timed out!");
+            }
         }
     }
-    }
 
     public boolean respondsTo(QName serviceName, QName portTypeName) {
         boolean result = _serviceName.equals(serviceName);
@@ -223,8 +223,7 @@
             case RESPONSE:
                 _converter.createSoapResponse(msgContext, mex.getResponse().getMessage(),
mex.getOperation());
                 if (__log.isDebugEnabled())
-                    __log.debug("Response message " +
-                        msgContext.getEnvelope());
+                    __log.debug("Response message " + msgContext.getEnvelope());
                 writeHeader(msgContext, mex);
                 break;
             case FAILURE:

Modified: incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcess.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcess.java?view=diff&rev=544215&r1=544214&r2=544215
==============================================================================
--- incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcess.java
(original)
+++ incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcess.java
Mon Jun  4 12:00:15 2007
@@ -153,6 +153,11 @@
         markused();
         target.invokeMyRole(mex);
         markused();
+
+        // For a one way, once the engine is done, the mex can be safely released.
+        if (mex.getPattern().equals(MessageExchange.MessageExchangePattern.REQUEST_ONLY))
{
+            mex.release();
+        }
     }
 
     private PartnerLinkMyRoleImpl getMyRoleForService(QName serviceName) {

Modified: incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java?view=diff&rev=544215&r1=544214&r2=544215
==============================================================================
--- incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java
(original)
+++ incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelRuntimeContextImpl.java
Mon Jun  4 12:00:15 2007
@@ -204,7 +204,7 @@
      */
     public void completedOk() {
         if (BpelProcess.__log.isDebugEnabled()) {
-            BpelProcess.__log.debug("ProcessImpl completed OK.");
+            BpelProcess.__log.debug("ProcessImpl " + _bpelProcess.getPID() + " completed
OK.");
         }
 
         // send event
@@ -786,13 +786,13 @@
         evt.setMexId(mexDao.getMessageExchangeId());
         sendEvent(evt);
 
-        // MEX pattern is request only, at this point the status can only be a
-        // one way
+        // MEX pattern is request only, at this point the status can only be a one way
         if (mexDao.getPattern().equals(MessageExchangePattern.REQUEST_ONLY.toString())) {
             mexDao.setStatus(MessageExchange.Status.ASYNC.toString());
+            // This mex can now be released
+            mexDao.release();
         }
-        // Check if there is a synchronous response, if so, we need to inject
-        // the
+        // Check if there is a synchronous response, if so, we need to inject the
         // message on the response channel.
         switch (mex.getStatus()) {
         case NEW:
@@ -1052,6 +1052,7 @@
             default:
                 mex.setFailure(FailureType.OTHER, "No response.", null);
                 _bpelProcess._engine._contexts.mexContext.onAsyncReply(mex);
+                mex.release();
             }
         }
     }

Modified: incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/MyRoleMessageExchangeImpl.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/MyRoleMessageExchangeImpl.java?view=diff&rev=544215&r1=544214&r2=544215
==============================================================================
--- incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/MyRoleMessageExchangeImpl.java
(original)
+++ incubator/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/MyRoleMessageExchangeImpl.java
Mon Jun  4 12:00:15 2007
@@ -131,8 +131,10 @@
             we.setProcessId(target.getPID());
             we.setMexId(getDAO().getMessageExchangeId());
 
-            ResponseCallback callback = new ResponseCallback();
-            _waitingCallbacks.put(getClientId(), callback);
+            if (getOperation().getOutput() != null) {
+                ResponseCallback callback = new ResponseCallback();
+                _waitingCallbacks.put(getClientId(), callback);
+            }
 
             setStatus(Status.ASYNC);
             if (target.isInMemory())



Mime
View raw message