Hi,
to get the right understandig of static variables within ejb i have the following question: Having
session Beans "A" and "B" both of which instantiates a class "X" with a static member "y",
where class "X" is a "normal" class, i.e no enterprise bean,
and session bean "A" is instantiated by one client
and session bean "B" is instantiated by a second client
and both clients running on different computers (i.e. different JVMs),
is it correct that both clients reference the same address if they access "y", i.e. both client can share/exchange data by using "y" ?
If so, is this behaviour specific for weblogic or is this the standard behaviour. Where can I get documentation about this ?
I know that EJB 2.0 spec., section 24.1.2 states that "enterprise Beans must not use read/write static fields" but does this include the "normal" classes which are instantiated by enterprise beans ?
regards
michael
-
scope of static variables (1 messages)
- Posted by: michael grindel
- Posted on: August 31 2001 07:37 EDT
Threaded Messages (1)
- scope of static variables by Tom Davies on August 31 2001 08:32 EDT
-
scope of static variables[ Go to top ]
- Posted by: Tom Davies
- Posted on: August 31 2001 08:32 EDT
- in response to michael grindel
The justification for this rule in the spec is that different instances might be in different JVMs, so yes, it does include 'normal' classes.
Having said that, I use non-final statics as caches in SLSB, where the cache is read-only.
I think that you will usually find that what you are doing works, but of course it doesn't allow you to cluster, and could break in the future.
I'd be interested to hear other people's opinions on this.
Tom