[jboss-user] [jBPM] - JPAWorkingMemoryDbLogger logs inconsistent data in case the process instance flow starts and terminates in single thread

Rahul Agrawal do-not-reply at jboss.com
Fri Sep 28 01:17:53 EDT 2012


Rahul Agrawal [https://community.jboss.org/people/rahulamt] created the discussion

"JPAWorkingMemoryDbLogger logs inconsistent data in case the process instance flow starts and terminates in single thread"

To view the discussion, visit: https://community.jboss.org/message/762097#762097

--------------------------------------------------------------
When a process is defined such that there are no wait-states in the flow i.e. the process instance flow will be completed in the same thread, in which it is started, the JPAWorkingMemoryDbLogger is not recording the end data for that particular ProcessInstanceLog.

One more point: I am starting the transaction and commiting it.


More analysis reveals that 

In case of start and completion of the process instance in the single thread the below method will execute the query. 
But as the transaction is not commited the query is unable to find the processinstancelog object.


private void updateProcessLog(long processInstanceId) {
        List<ProcessInstanceLog> result = getEntityManager().createQuery(
            "from ProcessInstanceLog as log where log.processInstanceId = ? and log.end is null")
                .setParameter(1, processInstanceId).getResultList();
        if (result != null && result.size() != 0) {
            ProcessInstanceLog log = result.get(result.size() - 1);
            log.setEnd(new Date());
            getEntityManager().merge(log);
        }
}

My work-around is to have a map field JPAWorkingMemoryDbLogger inside this class it will store the processInstanceLog object created against the processInstanceId and inside the above method if query is unable to find the object, use the object from the map. If the EntityManager is able to find processInstanceLog, remove it from the map.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/762097#762097]

Start a new discussion in jBPM at Community
[https://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/20120928/6631c75a/attachment-0001.html 


More information about the jboss-user mailing list