Title: RE: [jdjlist] EJB problem

I am not sure, but I think you're talking about an "EJB Singleton".  Sorry, but there is no such animal. You can try and hack it, many methods for this exist, just search on Google. 

Think about it this way:

2 or more machines, each running their own JVM.  Each creates instance of Session EJB to service a remote call.  You set some class variable on the session bean class on machine #1, now all the Session EJBs made on that machine will have the field set. But how would machine #2 JVM know about this? 

They can, but this is not easy to implement, unless you make this an RMI call to all other machines. And even then, you're not guaranteed anything -- it may take minutes/hours to propagate your setting to other JVMs.  If you need a field set reliably and shared between distributed beans, put it in the DB -- forget class variables.

Greg

-----Original Message-----
From: abhay [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 24, 2003 2:31 AM
To: JDJList
Subject: [jdjlist] EJB problem


Hello all ,
I 'm a novice in EJB .
Here i have prob regarding class level variables  in stateless session
beans.
I have set  boolean cbflag  = false as class level variable. (which
happens to be its default value)

Two methods are using the same flag.
consider the case:
that client 'A' access a method in (EJB) where he sets the flag cbflag =
true and finishes his processing.

Now, if that client 'B'  connecting to same EJB and accessing  a
different method, in which he wants to use the default value of flag,
what will he get?

whether it would be true or false.
In other words , does the EJB wipe out the variable's value set by other
client ??

please help me ..

Thanks in advance.

regards
abhay






____________________________________________________
To change your JDJList options, please visit:
http://www.sys-con.com/java/list.cfm

Be respectful! Clean up your posts before replying
____________________________________________________

____________________________________________________
To change your JDJList options, please visit:
http://www.sys-con.com/java/list.cfm

Be respectful! Clean up your posts before replying
____________________________________________________

Reply via email to