Thread BLOCKED using BS in Multi threads

"Fred Rolland (frolland)" <[email protected]> Mon, 15 Nov 2010 12:49:33 +0100
Newsgroups gmane.comp.java.beanshell.user
Message-ID <[email protected]>
Hi all,

 

I am having an issue when running multiple BS at the same type in
different threads in the same JVM.

 

Almost all the treads are getting into BLOCKED state due to some
synchronized code in Class.forName.

As a result the time of operation is much longer.

 

I have noticed that it happens mainly when the scripts are using
"source" to load other scripts.

 

Each threads have his own engine.

 

Any suggestion ?

 

Thanks

 

Fred

 

Thread dump:

 

"Scheduler-collector-SnmpCollector(MC.CA-30.4.31.162
[248]-0:0:0:0:0:0:0:0 [64]" prio=3 tid=0x012aa400 nid=0x4c waiting for
monitor entry [0x9457e000]

   java.lang.Thread.State: BLOCKED (on object monitor)

        at java.lang.Class.forName0(Native Method)

        at java.lang.Class.forName(Class.java:169)

        at bsh.BshClassManager.plainClassForName(Unknown Source)

        at bsh.classpath.ClassManagerImpl.classForName(Unknown Source)

        at bsh.NameSpace.classForName(Unknown Source)

        at bsh.NameSpace.getImportedClassImpl(Unknown Source)

        at bsh.NameSpace.getClassImpl(Unknown Source)

        at bsh.NameSpace.getClass(Unknown Source)

        at bsh.NameSpace.getClass(Unknown Source)

        at bsh.Name.toClass(Unknown Source)

        - locked <0xe8988700> (a bsh.Name)

        at bsh.BSHAmbiguousName.toClass(Unknown Source)

        at bsh.BSHType.getType(Unknown Source)

        at bsh.BSHTypedVariableDeclaration.eval(Unknown Source)

        at bsh.BSHBlock.evalBlock(Unknown Source)

        at bsh.BSHBlock.eval(Unknown Source)

        at bsh.BSHBlock.eval(Unknown Source)

        at bsh.BSHTryStatement.eval(Unknown Source)

        at bsh.Interpreter.eval(Unknown Source)

        at bsh.Interpreter.eval(Unknown Source)

        at bsh.Interpreter.eval(Unknown Source)

        at bsh.util.BeanShellBSFEngine.eval(Unknown Source)

        at org.apache.bsf.BSFManager$5.run(Unknown Source)

        at java.security.AccessController.doPrivileged(Native Method)

        at org.apache.bsf.BSFManager.eval(Unknown Source)

------------------------------------------------------------------------------
Centralized Desktop Delivery: Dell and VMware Reference Architecture
Simplifying enterprise desktop deployment and management using
Dell EqualLogic storage and VMware View: A highly scalable, end-to-end
client virtualization framework. Read more!
http://p.sf.net/sfu/dell-eql-dev2dev