Discussion:
Static variables in EJB should not be relied upon as they may break in clusters. Why?
(too old to reply)
JohnItter
2003-07-03 08:38:53 UTC
Permalink
Hi ,

Static variables in EJB should not be relied upon as they may break in clusters.
Why?
Any help will be appreciated.

--JohnItter
SIPTech Community
2003-07-03 08:57:35 UTC
Permalink
Hi John,,

Since Static variables are cannot be serialised ,
so it leads to some difficulties during activation and passivation process
of stateful Session beans.
It will also yield some unpredictable results during clustering,

For further information regarding this refer this article
http://servlet.java.sun.com/javaone/javaone2000/pdfs/TS-1295.pdf


Regards
Karthikeyan Gangadharan
SIP Technologies, Chennai
Post by JohnItter
Hi ,
Static variables in EJB should not be relied upon as they may break in clusters.
Why?
Any help will be appreciated.
--JohnItter
SIPTech Community
2003-07-03 08:57:52 UTC
Permalink
Hi John,,

Since Static variables are cannot be serialised ,
so it leads to some difficulties during activation and passivation process
of stateful Session beans.
It will also yield some unpredictable results during clustering,

For further information regarding this refer this article
http://servlet.java.sun.com/javaone/javaone2000/pdfs/TS-1295.pdf


Regards
Karthikeyan Gangadharan
SIP Technologies, Chennai
Post by JohnItter
Hi ,
Static variables in EJB should not be relied upon as they may break in clusters.
Why?
Any help will be appreciated.
--JohnItter
Philip Strube
2003-07-03 08:59:06 UTC
Permalink
Hi John,

let's say you have two servers in a cluster. If you set a static
variable of a class in server A, the value will not be propagated to
server B.

i.e. something like "static int myint = 42;"

In A:
myint = 43;

In B:
System.out.println(myint); => 42



final static is always ok.

Regards, Philip
Post by JohnItter
Hi ,
Static variables in EJB should not be relied upon as they may break in clusters.
Why?
Any help will be appreciated.
--JohnItter
SIPtech community
2003-07-03 09:17:24 UTC
Permalink
Hi JohnItter,
Do refer the following link for detaiils.

http://www.jguru.com/faq/view.jsp?EID=710888

Thanks,
Thilak
Post by JohnItter
Hi ,
Static variables in EJB should not be relied upon as they may break in clusters.
Why?
Any help will be appreciated.
--JohnItter
Loading...