Author: mriou
Date: Tue Aug 14 16:31:48 2007
New Revision: 565968

URL: http://svn.apache.org/viewvc?view=rev&rev=565968
Log:
Latch was swallowing exceptions.

Modified:
    
ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcess.java
    
ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/NStateLatch.java

Modified: 
ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcess.java
URL: 
http://svn.apache.org/viewvc/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcess.java?view=diff&rev=565968&r1=565967&r2=565968
==============================================================================
--- 
ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcess.java
 (original)
+++ 
ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcess.java
 Tue Aug 14 16:31:48 2007
@@ -147,8 +147,8 @@
      * @param mex
      */
     void invokeProcess(MyRoleMessageExchangeImpl mex) {
-        _hydrationLatch.latch(1);
         try {
+            _hydrationLatch.latch(1);
             PartnerLinkMyRoleImpl target = 
getMyRoleForService(mex.getServiceName());
             if (target == null) {
                 String errmsg = 
__msgs.msgMyRoleRoutingFailure(mex.getMessageExchangeId());
@@ -285,8 +285,8 @@
      * @see 
org.apache.ode.bpel.engine.BpelProcess#handleWorkEvent(java.util.Map<java.lang.String,java.lang.Object>)
      */
     public void handleWorkEvent(Map<String, Object> jobData) {
-        _hydrationLatch.latch(1);
         try {
+            _hydrationLatch.latch(1);
             markused();
 
             if (__log.isDebugEnabled()) {
@@ -456,8 +456,8 @@
     }
 
     EndpointReference getInitialPartnerRoleEPR(OPartnerLink link) {
-        _hydrationLatch.latch(1);
         try {
+            _hydrationLatch.latch(1);
             PartnerLinkPartnerRoleImpl prole = _partnerRoles.get(link);
             if (prole == null)
                 throw new IllegalStateException("Unknown partner link " + 
link);
@@ -468,8 +468,8 @@
     }
 
     Endpoint getInitialPartnerRoleEndpoint(OPartnerLink link) {
-        _hydrationLatch.latch(1);
         try {
+            _hydrationLatch.latch(1);
             PartnerLinkPartnerRoleImpl prole = _partnerRoles.get(link);
             if (prole == null)
                 throw new IllegalStateException("Unknown partner link " + 
link);
@@ -480,8 +480,8 @@
     }
 
     EndpointReference getInitialMyRoleEPR(OPartnerLink link) {
-        _hydrationLatch.latch(1);
         try {
+            _hydrationLatch.latch(1);
             PartnerLinkMyRoleImpl myRole = _myRoles.get(link);
             if (myRole == null)
                 throw new IllegalStateException("Unknown partner link " + 
link);
@@ -496,8 +496,8 @@
     }
 
     PartnerRoleChannel getPartnerRoleChannel(OPartnerLink partnerLink) {
-        _hydrationLatch.latch(1);
         try {
+            _hydrationLatch.latch(1);
             PartnerLinkPartnerRoleImpl prole = _partnerRoles.get(partnerLink);
             if (prole == null)
                 throw new IllegalStateException("Unknown partner link " + 
partnerLink);
@@ -531,9 +531,8 @@
      * Ask the process to dehydrate.
      */
     void dehydrate() {
-        _hydrationLatch.latch(0);
-
         try {
+            _hydrationLatch.latch(0);
             // We don't actually need to do anything, the latch will run the 
doDehydrate method
             // when necessary..
         } finally {
@@ -543,9 +542,8 @@
     }
 
     void hydrate() {
-        _hydrationLatch.latch(1);
-
         try {
+            _hydrationLatch.latch(1);
             // We don't actually need to do anything, the latch will run the 
doHydrate method
             // when necessary..
         } finally {
@@ -554,8 +552,8 @@
     }
     
     OProcess getOProcess() {
-        _hydrationLatch.latch(1);
         try {
+            _hydrationLatch.latch(1);
             return _oprocess;
         } finally {
             _hydrationLatch.release(1);
@@ -563,8 +561,8 @@
     }
 
     private Map<Endpoint, PartnerLinkMyRoleImpl> getEndpointToMyRoleMap() {
-        _hydrationLatch.latch(1);
         try {
+            _hydrationLatch.latch(1);
             return _endpointToMyRoleMap;
         } finally {
             _hydrationLatch.release(1);
@@ -572,8 +570,8 @@
     }
 
     public ReplacementMap getReplacementMap() {
-        _hydrationLatch.latch(1);
         try {
+            _hydrationLatch.latch(1);
             return _replacementMap;
         } finally {
             _hydrationLatch.release(1);

Modified: 
ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/NStateLatch.java
URL: 
http://svn.apache.org/viewvc/ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/NStateLatch.java?view=diff&rev=565968&r1=565967&r2=565968
==============================================================================
--- 
ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/NStateLatch.java
 (original)
+++ 
ode/trunk/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/NStateLatch.java
 Tue Aug 14 16:31:48 2007
@@ -19,6 +19,9 @@
 
 package org.apache.ode.bpel.engine;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
 import java.util.concurrent.locks.Condition;
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReentrantLock;
@@ -32,12 +35,11 @@
  * can change state only when the count is zero. Every time the latch changes 
state an 
  * optional [EMAIL PROTECTED] Runnable} corresponding to the new state is 
executed. 
  * 
- * 
  * @author Maciej Szefler ( m s z e f l e r @ g m a i l . c o m )
- *
  */
 public class NStateLatch {
-    
+    static final Log __log = LogFactory.getLog(NStateLatch.class);
+
     /** Current state. */
     private int _state = -1;
 
@@ -72,7 +74,6 @@
         
         _lock.lock();
         try {
-
             if (_transitioning )
                 throw new IllegalStateException("Manipulating latch from 
transition. ");
             
@@ -86,21 +87,13 @@
                         try {
                             _transitioning = true;
                             _transitions[state].run();
-                        } catch (Throwable t) {
-                            t.printStackTrace();
                         } finally {
                             _transitioning = false;
+                            _depth ++;
                         }
-
-                        
                     _state = state;
-                    
                 }
             }
-
-            _depth ++;
-            
-            
         } finally {
             _lock.unlock();
         }
@@ -114,7 +107,7 @@
                 throw new IllegalStateException("Manipulating latch from 
transition. ");
 
             if (_state != state)
-                throw new IllegalStateException("Wrong state.");
+                __log.error("Latch error, was releasing for state " + state + 
" but actually in " + _state);
             if (_depth <= 0)
                 throw new IllegalStateException("Too many release() calls.");
             


Reply via email to