diff options
author | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-09-04 17:27:49 +0000 |
---|---|---|
committer | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-09-04 17:27:49 +0000 |
commit | 6f65f5aaa929eb81052ffb88a589a273ec18f5ea (patch) | |
tree | 04a3963f2aa9d7082ab60395b40e564fb5ae4b31 /java/sca/modules/implementation-bpel-runtime | |
parent | 9aeacb7f587490b9067e84a118b62675f1f76f58 (diff) |
TUSCANY-2995 - Adding timeout to avoid blocking when exception occours
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@811501 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/implementation-bpel-runtime')
-rw-r--r-- | java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/provider/BPELInvoker.java | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/provider/BPELInvoker.java b/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/provider/BPELInvoker.java index 0b6ade799b..e3fb1aa005 100644 --- a/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/provider/BPELInvoker.java +++ b/java/sca/modules/implementation-bpel-runtime/src/main/java/org/apache/tuscany/sca/implementation/bpel/ode/provider/BPELInvoker.java @@ -21,6 +21,7 @@ package org.apache.tuscany.sca.implementation.bpel.ode.provider; import java.lang.reflect.InvocationTargetException; import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; import javax.transaction.SystemException; import javax.transaction.TransactionManager; @@ -29,13 +30,11 @@ import javax.xml.namespace.QName; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.apache.ode.bpel.iapi.MessageExchange; import org.apache.ode.bpel.iapi.MyRoleMessageExchange; import org.apache.ode.bpel.iapi.MessageExchange.Status; import org.apache.ode.utils.DOMUtils; import org.apache.ode.utils.GUID; import org.apache.tuscany.sca.assembly.Base; -import org.apache.tuscany.sca.assembly.Endpoint; import org.apache.tuscany.sca.assembly.EndpointReference; import org.apache.tuscany.sca.implementation.bpel.ode.EmbeddedODEServer; import org.apache.tuscany.sca.interfacedef.Interface; @@ -59,6 +58,8 @@ import org.w3c.dom.Element; * @version $Rev$ $Date$ */ public class BPELInvoker implements Invoker { + private final static long TIME_OUT = 500L; + protected final Log __log = LogFactory.getLog(getClass()); private EmbeddedODEServer odeServer; @@ -166,7 +167,8 @@ public class BPELInvoker implements Invoker { // Waiting until the reply is ready in case the engine needs to continue in a different thread if (onhold != null) { try { - onhold.get(); + //add timeout to avoid blocking when there is a exception/failure + onhold.get(TIME_OUT, TimeUnit.MILLISECONDS); } catch (Exception e) { throw new InvocationTargetException(e,"Error invoking BPEL process : " + e.getMessage()); } // end try |