Re: Thread BLOCKED using BS in Multi threads

"Fred Rolland (frolland)" <[email protected]> Mon, 15 Nov 2010 14:16:04 +0100
Newsgroups gmane.comp.java.beanshell.user
Message-ID <[email protected]>
David, thanks for your response.

What kind of caching are you using ?

I am currently considering to override NameSpace to cache the classes in
a static map.
Maybe it will help avoid the blocking in my case.



-----Original Message-----
From: David Lee [mailto:[email protected]] 
Sent: Monday, November 15, 2010 2:57 PM
To: Fred Rolland (frolland); beanshell-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: RE: [Beanshell-users] Thread BLOCKED using BS in Multi threads

I haven't seen this myself, we use BS in up to 200 threads and they are
not
getting blocked to my knowledge.
However we are not using source, rather all BSH scripts are either
resources
or provided as strings to the Interpreter instance.
Also we do a lot of caching to avoid having to 'compile' the scripts
frequently.   

----------------------------------------
David A. Lee
[email protected]
http://www.xmlsh.org

-----Original Message-----
From: Fred Rolland (frolland) [mailto:[email protected]] 
Sent: Monday, November 15, 2010 6:50 AM
To: beanshell-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject: [Beanshell-users] Thread BLOCKED using BS in Multi threads

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
_______________________________________________
Beanshell-users mailing list
Beanshell-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/beanshell-users


------------------------------------------------------------------------------
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