Also able to pass MapEnv while starting process, which is available in nodeToken.getFullEnv while processing tasks. Could you validate - is this the right way way to achieve what I was looking for in the initial post.
int id = <thread number>;
MemEngine engine = new MemEngine();
...
Graph example1Graph = engine.getRepository().getLatestGraph("example1");
MapEnv me = new MapEnv();
me.setAttribute("id", id);
GraphProcess example1Process = engine.startProcess( example1Graph, me);
Now in b/w I observed following exception while trying workflow instances in multiple threads - so even with different engine instances does Saraswati has any issues with multiple threads?
Exception in thread "Thread-0" java.lang.NullPointerException
at java.util.LinkedList$ListItr.next(LinkedList.java:891)
at com.googlecode.sarasvati.impl.AbstractGraph.getInputArcs(AbstractGraph.java:83)
at com.googlecode.sarasvati.join.LabelJoinStrategy.getJoiningArcs(LabelJoinStrategy.java:39)
at com.googlecode.sarasvati.join.AndJoinStrategy.performJoin(AndJoinStrategy.java:88)
at com.googlecode.sarasvati.join.AndJoinStrategy.performJoin(AndJoinStrategy.java:82)
at com.googlecode.sarasvati.impl.BaseEngine.retryIncompleteArcToken(BaseEngine.java:293)
at com.googlecode.sarasvati.impl.BaseEngine.executeArc(BaseEngine.java:278)
at com.googlecode.sarasvati.impl.BaseEngine.executeQueuedArcTokens(BaseEngine.java:591)
at com.googlecode.sarasvati.impl.BaseEngine.startProcess(BaseEngine.java:217)
at com.googlecode.sarasvati.impl.BaseEngine.startProcess(BaseEngine.java:187)
At my old job we used the hibernate backed version with lots of threads. However, some quirk of the loading process ensure that we didn't see the bug you are seeing. The AbstractGroup#initialize method should be changed to something like the code below.
Unfortunately I no longer have time to maintain Sarasvati. Looking for a new maintainer, if you know anyone who is interested in helping out :)
private void initialize () |
{ |
Map<Node, List<Arc>> inputMap = new HashMap<Node, List<Arc>>(); |
Map<Node, List<Arc>> outputMap = new HashMap<Node, List<Arc>>(); |
for ( Arc arc : getArcs() ) |
{ |
Node node = arc.getStartNode(); |
List<Arc> list = outputMap.get( node ); |
if ( list == null ) |
{ |
list = new LinkedList<Arc>(); |
outputMap.put( node, list ); |
} |
list.add( arc ); |
node = arc.getEndNode(); |
list = inputMap.get( node ); |
if ( list == null ) |
{ |
list = new LinkedList<Arc>(); |
inputMap.put( node, list ); |
} |
list.add( arc ); |
} this.inputMap = inputMap; this.outputMap = outputMap; |
}
|
--
You received this message because you are subscribed to the Google Groups "sarasvati-wf-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sarasvati-wf-us...@googlegroups.com.
To post to this group, send email to sarasvati...@googlegroups.com.
Visit this group at http://groups.google.com/group/sarasvati-wf-users.
For more options, visit https://groups.google.com/groups/opt_out.