geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Jencks <david_jen...@yahoo.com>
Subject Re: Static Variables and ClassLoaders
Date Tue, 13 Sep 2005 04:04:13 GMT
I think you have found the cause of the problems in your other post :-)

I'm assuming you are using M5/Head.

First, make sure that each jar appears in only one plan as a dependency 
or as a module in an .ear.

Then, locate the plans that contain all the jars you need directly as 
dependencies or as parents.

Pick one, and use it's configId as the parentId attribute of your plan.

Include the others using include elements, which have the same xml form 
as dependency elements:
<include>
     <uri>configuIdURI</uri>
</include>

There's an alternate format that may be convenient if you have your 
configurations in a maven-like repository, see the schema.

For your example in the other post, if the jar containing the hello 
class is in the j2ee application, setting the parentId of your plan to 
the configId of the application and leaving out the dependency element 
should be sufficient.

thanks
david jencks


On Sep 12, 2005, at 8:38 PM, Krishnakumar B wrote:

> Hi,
>
> I have a doubt related to usage of Static Variables.
>
> "Static Variables are scoped in the class they r defined. So if a
> class is loaded by more than one classloader in same JVM then there
> will be multiple copies within same JVM"
>
> How do i used Config Id/Parent Id to ensure that 2 plans use the same
> ClassLoader so that i get a single instance of static variable.
>
> Regards
> Krishnakumar B
>


Mime
View raw message