[jboss-user] [JBoss jBPM] - Question on propagation of events in GraphElement

pirx do-not-reply at jboss.com
Fri Feb 16 14:52:50 EST 2007


While looking through the current CVS source, I have a question concerning on propagation of events in GraphElement:


  | // event handling ///////////////////////////////////////////////////////////
  | 
  |   public void fireEvent(String eventType, ExecutionContext executionContext) {
  |     Token token = executionContext.getToken();
  | 
  |     log.debug( "event '"+eventType+"' on '"+this+"' for '"+token+"'" );
  | 
  |     try {
  |       executionContext.setEventSource(this);
  |       fireAndPropagateEvent(eventType, executionContext);
  |     } finally {
  |       executionContext.setEventSource(null);
  |     }
  |   }
  | 
  |   public void fireAndPropagateEvent(String eventType, ExecutionContext executionContext) {
  |     // calculate if the event was fired on this element or if it was a propagated event
  |     boolean isPropagated = (this.equals(executionContext.getEventSource()));
  | 
  |     // execute static actions 
  |     // .....
  | }
  | 
  |  void executeActions(List actions, ExecutionContext executionContext, boolean isPropagated) {
  |     if (actions!=null) {
  |       Iterator iter = actions.iterator();
  |       while (iter.hasNext()) {
  |         Action action = (Action) iter.next();
  |         if ( action.acceptsPropagatedEvents()
  |              || (!isPropagated)
  |            ) {
  |          .....
  |         }
  |       }
  |     }
  | 

IMO, the boolean condition 


  | boolean isPropagated = (this.equals(executionContext.getEventSource()));
  | 

should be inverted, since when the executionContext's event source is the 
same as the surrounding graph element, then the event is not 
propagating but originating from this GraphElement. (see the lines above).

Please correct me, when I'm wrong.

...roland

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4017841#4017841

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4017841



More information about the jboss-user mailing list