[jbpm-commits] JBoss JBPM SVN: r6217 - in jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm: job and 1 other directory.
do-not-reply at jboss.org
do-not-reply at jboss.org
Tue Mar 9 06:42:06 EST 2010
Author: alex.guizar at jboss.com
Date: 2010-03-09 06:42:06 -0500 (Tue, 09 Mar 2010)
New Revision: 6217
Modified:
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/def/Node.java
jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/job/Timer.java
Log:
JBPM-2812: call Token.signal(Transition) in Timer.execute to prevent redundant lookup;
consider superstate transitions in Node.hasLeavingTransition
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/def/Node.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/def/Node.java 2010-03-09 11:24:05 UTC (rev 6216)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/graph/def/Node.java 2010-03-09 11:42:06 UTC (rev 6217)
@@ -195,7 +195,7 @@
}
/**
- * removes the bidirection relation between this node and the given leaving
+ * removes the bidirectional relation between this node and the given leaving
* transition.
*
* @throws IllegalArgumentException if leavingTransition is null.
@@ -211,41 +211,36 @@
}
/**
- * checks for the presence of a leaving transition with the given name.
+ * checks for the presence of a leaving transition with the given name. the
+ * leaving transitions of the supernode are taken into account as well.
*
* @return true if this node has a leaving transition with the given name,
* false otherwise.
*/
public boolean hasLeavingTransition(String transitionName) {
- if (leavingTransitions != null) {
- for (Iterator i = leavingTransitions.iterator(); i.hasNext();) {
- Transition transition = (Transition) i.next();
- if (transitionName.equals(transition.getName())) return true;
- }
- }
- return false;
+ return getLeavingTransition(transitionName) != null;
}
/**
- * retrieves a leaving transition by name. note that also the leaving
- * transitions of the supernode are taken into account.
+ * retrieves a leaving transition by name. the leaving transitions of the
+ * supernode are taken into account as well.
*/
public Transition getLeavingTransition(String transitionName) {
- Transition transition = null;
if (leavingTransitions != null) {
- transition = (Transition) getLeavingTransitionsMap().get(transitionName);
+ for (Iterator i = leavingTransitions.iterator(); i.hasNext();) {
+ Transition transition = (Transition) i.next();
+ if (transitionName != null ? transitionName.equals(transition.getName())
+ : transition.getName() == null) return transition;
+ }
}
- if (transition == null && superState != null) {
- transition = superState.getLeavingTransition(transitionName);
- }
- return transition;
+ return superState != null ? superState.getLeavingTransition(transitionName) : null;
}
/**
- * true if this transition has leaving transitions.
+ * tells whether this node lacks leaving transitions.
*/
public boolean hasNoLeavingTransitions() {
- return (leavingTransitions == null || leavingTransitions.size() == 0)
+ return (leavingTransitions == null || leavingTransitions.isEmpty())
&& (superState == null || superState.hasNoLeavingTransitions());
}
Modified: jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/job/Timer.java
===================================================================
--- jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/job/Timer.java 2010-03-09 11:24:05 UTC (rev 6216)
+++ jbpm3/branches/jbpm-3.2-soa/modules/core/src/main/java/org/jbpm/job/Timer.java 2010-03-09 11:42:06 UTC (rev 6217)
@@ -12,6 +12,7 @@
import org.jbpm.graph.def.Event;
import org.jbpm.graph.def.GraphElement;
import org.jbpm.graph.def.Node;
+import org.jbpm.graph.def.Transition;
import org.jbpm.graph.exe.ExecutionContext;
import org.jbpm.graph.exe.Token;
@@ -85,11 +86,12 @@
// and if no unhandled exception occurred during the action
if (transitionName != null && exception == null) {
Node node = token.getNode();
- if (node.getLeavingTransition(transitionName)!=null) {
- token.signal(transitionName);
+ Transition transition = node.getLeavingTransition(transitionName);
+ if (transition != null) {
+ token.signal(transition);
}
else {
- log.warn(node + " has no leaving transition with name: " + transitionName);
+ log.warn(node + " has no leaving transition named " + transitionName);
}
}
@@ -106,7 +108,7 @@
repeatDate = businessCalendar.add(repeatDate, interval);
} while (repeatDate.getTime() <= currentTime);
- log.debug("scheduling " + this + " for repeat on: " + dueDate);
+ log.debug("scheduling " + this + " for repeat on " + dueDate);
dueDate = repeatDate;
// unlock timer so that:
More information about the jbpm-commits
mailing list