End Node and ExecutionListeners

2 views
Skip to first unread message

Cheong Chung Onn

unread,
Aug 21, 2009, 1:36:15 AM8/21/09
to sarasvat...@googlegroups.com
Hi Paul,

I have encountered a new problem. Previously we decided to create a
custom EndNode to achieve my need to have an explicit EndNode, however I
realized this approach has side effect. This is because when the token
reaches the End Node, Sarasvati still fires all the registered
listeners like NodeTokenCompleted, NodeTokenExecuted and
ProcessCompleted etc.

My use case is EndNode should not exhibit the same behaviors as a
regular Node in terms of Node lifecycle. To avoid these extraneous
triggers I had to work around it. I wonder should Node has a special
flag to request it not to fire all the events?

Regards
chung-onn

Paul Lorenz

unread,
Aug 21, 2009, 9:47:25 AM8/21/09
to sarasvat...@googlegroups.com
Have you considered using and either a whitelist or blacklist approach to control which nodes your execution listeners pay attention to? You could just put

public void notify (ExecutionEvent event ) {
  NodeToken token = event.getNodeToken();
  if ( token != null && token.getNode().getType().equals( "end" ) )
  {
    return;
  }
  ..
}

Which is easier than updating the xml schema, the xml classes, the loader, the database schema, the node class and the engine. Maybe I'm missing something, though. Are there use cases for an 'ignore events' flag that couldn't be handled in this way?

cheers,
Paul

Cheong Chung Onn

unread,
Aug 21, 2009, 11:30:19 AM8/21/09
to sarasvat...@googlegroups.com
Hi Paul,

Thanks for pointing me the right direction. I failed to dig deeper into
the javadoc :)

Cheers!
chung-onn
Reply all
Reply to author
Forward
0 new messages