[jboss-user] [jBPM] - timer 4.3 error
Jas Lam
do-not-reply at jboss.com
Tue Apr 6 15:32:46 EDT 2010
Jas Lam [http://community.jboss.org/people/lamj1] created the discussion
"timer 4.3 error"
To view the discussion, visit: http://community.jboss.org/message/535918#535918
--------------------------------------------------------------
I modified the org.jbpm.examples.eventlistener jUnit test case slightly to introduce a timer as follow: the red code is the newly insert timer.
<?xml version="1.0" encoding="UTF-8"?>
<process name="EventListener" xmlns="http://jbpm.org/4.2/jpdl">
<on event="start">
<event-listener>
<field name="msg"><string value="start on process definition"/></field>
</event-listener>
</on>
<start g="17,19,48,48">
<transition to="wait"/>
</start>
<state name="wait" g="96,16,104,52">
<on event="start">
<event-listener>
<field name="msg"><string value="start on activity wait"/></field>
</event-listener>
</on>
<on event="NotifyRCP">
<timer duedate="5 seconds"/>
<event-listener>
<field name="msg"><string value="NotifyRCP"/></field>
</event-listener>
</on>
<on event="end">
<event-listener>
<field name="msg"><string value="end on activity wait"/></field>
</event-listener>
</on>
<transition to="park">
<event-listener>
<field name="msg"><string value="take transition"/></field>
</event-listener>
</transition>
</state>
<state name="park" g="231,19,80,52"/>
</process>
In the test case i just add an additional text to the expectedLogs and a sleep
public void testEventListener() {
ProcessInstance processInstance = executionService.startProcessInstanceByKey("EventListener");
List<String> expectedLogs = new ArrayList<String>();
expectedLogs.add("start on process definition");
expectedLogs.add("start on activity wait");
expectedLogs.add("NotifyRCP");
try{ Thread.sleep(6000); } catch(Exception e){}
List<String> logs = (List<String>) executionService.getVariable(processInstance.getId(), "logs");
assertEquals(expectedLogs, logs);
Execution execution = processInstance.findActiveExecutionIn("wait");
executionService.signalExecutionById(execution.getId());
logs = (List<String>) executionService.getVariable(processInstance.getId(), "logs");
expectedLogs.add("end on activity wait");
expectedLogs.add("take transition");
assertEquals(expectedLogs, logs);
}
When I run this code the first time, it always work!!!! BUT after that I kept failing when the timer triggered!!! with the following error trace. Could some one confirm this? i tried this on two separate machine and getting the same behavior. Full source code is attached.
15:09:12,216 FIN | [ExecuteActivity] execution[EventListener.50007.wait] executes activity(wait)
[start on process definition, start on activity wait]
15:09:12,232 FIN | [HibernateSessionResource] ----- committing hibernate tx 23511316 -------------------------------------------------------
15:09:12,240 FIN | [HibernateSessionResource] ----- beginning hibernate tx 31798998 --------------------------------------------------------
15:09:12,241 FIN | [HibernateSessionResource] ----- committing hibernate tx 32102833 -------------------------------------------------------
15:09:12,242 FIN | [HibernateSessionResource] ----- beginning hibernate tx 22677439 --------------------------------------------------------
15:09:12,251 FIN | [HibernateSessionResource] ----- committing hibernate tx 32700170 -------------------------------------------------------
15:09:17,210 FIN | [HibernateSessionResource] ----- beginning hibernate tx 28678425 --------------------------------------------------------
### EXCEPTION ###########################################
15:09:17,217 SEV | [AbstractFlushingEventListener] Could not synchronize database state with session
org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [org.jbpm.pvm.internal.job.TimerImpl#50012]
at org.hibernate.persister.entity.AbstractEntityPersister.check(AbstractEntityPersister.java:1792)
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2435)
at org.hibernate.persister.entity.AbstractEntityPersister.updateOrInsert(AbstractEntityPersister.java:2335)
at org.hibernate.persister.entity.AbstractEntityPersister.update(AbstractEntityPersister.java:2635)
at org.hibernate.action.EntityUpdateAction.execute(EntityUpdateAction.java:115)
at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:279)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:263)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:168)
at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1027)
at org.jbpm.pvm.internal.tx.HibernateSessionResource.prepare(HibernateSessionResource.java:56)
at org.jbpm.pvm.internal.tx.StandardTransaction.commit(StandardTransaction.java:107)
at org.jbpm.pvm.internal.tx.StandardTransaction.complete(StandardTransaction.java:64)
at org.jbpm.pvm.internal.tx.StandardTransactionInterceptor.execute(StandardTransactionInterceptor.java:61)
at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.executeInNewEnvironment(EnvironmentInterceptor.java:53)
at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java:40)
at org.jbpm.pvm.internal.svc.RetryInterceptor.execute(RetryInterceptor.java:55)
at org.jbpm.pvm.internal.svc.SkipInterceptor.execute(SkipInterceptor.java:43)
at org.jbpm.pvm.internal.jobexecutor.DispatcherThread.acquireJobs(DispatcherThread.java:126)
at org.jbpm.pvm.internal.jobexecutor.DispatcherThread.run(DispatcherThread.java:67)
### EXCEPTION ###########################################
15:09:17,219 FIN | [HibernateSessionResource] ----- rolling back hibernate tx 28848200 -----------------------------------------------------
15:09:17,270 FIN | [HibernateSessionResource] ----- beginning hibernate tx 1191324 --------------------------------------------------------
Thank you in advance.
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/535918#535918]
Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20100406/a75684c1/attachment.html
More information about the jboss-user
mailing list