[sarasvati-wf-users:75] getListeners() in HibGraphProcess

7 views
Skip to first unread message

Dave Butz

unread,
May 13, 2010, 3:36:29 PM5/13/10
to sarasvati-wf-users
Hi Paul

I'm trying to setup a new WF on Hibernate. I've got problem with the
following method:

newEventQueue.initFromPersisted( getListeners() );

public void initFromPersisted (List<? extends
PersistedExecutionListener> listeners)
{
for ( PersistedExecutionListener listener : listeners )
{
addListener( listenerCache.getListener( listener.getType() ),
listener.getEventTypeMask() );
}
}

I get an exception because the getListerners() method returns null
(I've no listener registered) and then the for loop throws a
NullPointerException

It is recommended to have a ExecutionListener registered?

Thanks

--
You received this message because you are subscribed to the Google Groups "sarasvati-wf-users" group.
To post to this group, send email to sarasvati...@googlegroups.com.
To unsubscribe from this group, send email to sarasvati-wf-us...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sarasvati-wf-users?hl=en.

Paul Lorenz

unread,
May 13, 2010, 3:46:08 PM5/13/10
to sarasvati...@googlegroups.com
Hmm, I'm trying to figure out why getListeners would return null. If it's a new instance, it's initialized in the constructor to an empty list. When loading from the DB, my understanding was that hibernate would always give you back an empty list if you didn't have any constituents.

Is this a new instance or one you're pulling from the database? Are you ever explicitly setting the listeners to null?

You should not any execution listeners registered, so if my understanding of hibernate behavior is incorrect, or behavior has changed, this will need a patch.

Cheers,
Paul
Message has been deleted

Dave Butz

unread,
May 13, 2010, 4:15:31 PM5/13/10
to sarasvati-wf-users
It's a new instance and I do not set the listeners to null explicitly.
I just use your example and added the following code inside the "if
(doInit)":

while ( true )
{
Session session = HibTestSetup.openSession();
Transaction t = session.beginTransaction();
HibEngine engine = new HibEngine( session );

if (doInit)
{
engine.addNodeType("dump", DumpNode.class);
HibGraph graph = engine.getFactory().newGraph("TestGraph", 1,
"100");
Node firstNode = engine.getFactory().newNode(graph,
"FirstNode", "dump", JoinType.FIRST, null, true, null, null);
Node secondNode = engine.getFactory().newNode(graph,
"SecondNode", "dump", JoinType.FIRST, null, false, null, null);
HibArc arc = engine.getFactory().newArc(graph, firstNode,
secondNode, "TestArc");
engine.addExecutionListener(LoggingExecutionListener.class,
ExecutionEventType.values());
doInit = false;
}

HibGraph choosenGraph = getGraph( engine );

HibGraphProcess process =
(HibGraphProcess)engine.startProcess( choosenGraph );

session.flush();
t.commit();
session.close();

runWorkflow( process.getId() );
> > sarasvati-wf-us...@googlegroups.com<sarasvati-wf-users%2Bunsubs cr...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/sarasvati-wf-users?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups "sarasvati-wf-users" group.
> To post to this group, send email to sarasvati...@googlegroups.com.
> To unsubscribe from this group, send email to sarasvati-wf-us...@googlegroups.com.
> For more options, visit this group athttp://groups.google.com/group/sarasvati-wf-users?hl=en.

Paul Lorenz

unread,
May 13, 2010, 4:38:58 PM5/13/10
to sarasvati-wf-users
Found it. It's not the HibGraphProcess, but the HibGraph (from what I
can see) that can have a null listener list. As a short term work
around you can call graph.setListeners( new
LinkedList<HibGraphListener>() );

I created issue 60 for this (http://code.google.com/p/sarasvati/issues/
detail?id=60) and have committed a fix. I'll try to get a point
release out soon.

Let me know if you think this won't resolve your issue.

Cheers,
Paul

Dave Butz

unread,
May 13, 2010, 5:06:38 PM5/13/10
to sarasvati-wf-users
Thanks! Your fix is working cause I use the newest trunk.

:-)
Reply all
Reply to author
Forward
0 new messages