Hi,

I have found a problem with createObject  method of ObjectFactoryImpl class :

  |   public Object createObject(ObjectInfo objectInfo) {
  |     clearRegistry();
  |     return getObject(objectInfo);
  |   }
  | 
this code is not thread safe

This can cause errors like 

java.lang.RuntimeException: closed JbpmContext more then once... check your 
try-finally's around JbpmContexts blocks
        at org.jbpm.JbpmContext.popThisContextFromTheStack(JbpmContext.java:493)
        at org.jbpm.JbpmContext.close(JbpmContext.java:139)

due to bad context creation when calling JbpmConfiguration.createJbpmContext 
from a lot of different threads

It's difficult to produce, so try adding a sleep call after clearRegistry() in 
createObject method, and you will see the problem ...

  |   public Object createObject(ObjectInfo objectInfo) {
  |     clearRegistry();
  |     try {
  |        Thread.sleep(2000);
  |     } catch (InterruptedException e) {
  |        // TODO Auto-generated catch block
  |        e.printStackTrace();
  |     }
  |     return getObject(objectInfo);
  |   }
  | 
  | 

I think adding a synchronized will correct the bug.


  |   public synchronized Object createObject(ObjectInfo objectInfo) {
  |     clearRegistry();
  |     return getObject(objectInfo);
  |   }
  | 

Regards,

Emmanuel

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3921851#3921851

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3921851


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to