So at what place should we initialize these variables ? Because all SSB's
state should be similar in the pool.
Rgds,
Gavin
"Mohit"
<magrawal@argu To: <[EMAIL PROTECTED]>
soft.com> cc:
Subject: RE: [Re:State in Stateless
Session
11/02/2001 Bean]
04:51 PM
Please respond
to magrawal
No, beacause ejbCreate() is called only when new instace is created and u
cannot be sure that each user call will be assigned a new instance of SLSB,
container uses to cater request from pool and in this case instance
variables wont be initialized. In which case again the same problem will
arise.
U should use instance variables in SLSB for conenction objects etc. will
will keep an open connection usable by any user.
Also one more thing we can try is declaring instance variables as
TRANSIENT, so that they will be initilized at every ejbActivate() or
ejbPassivate() call.
Regards
Mohit
-----Original Message-----
From: Gavin Selvaratnam [mailto:[EMAIL PROTECTED]]
Sent: Friday, November 02, 2001 2:49 PM
To: [EMAIL PROTECTED]
Subject: Re: [Re:State in Stateless Session Bean]
So this meens that we have to initialize thease instance variables within
the "ejbCreate()" create method ?
Thanks,
Gavin
Mohit
<magrawal@ARGUSOF To:
[EMAIL PROTECTED]
T.COM> cc:
Sent by: A Subject: Re: [Re:State in
Stateless Session
mailing list for Bean]
Enterprise
JavaBeans
development
<EJB-INTEREST@JAV
A.SUN.COM>
11/02/2001 03:04
PM
Please respond to
magrawal
Sun has mentioned this in the stateless session (Section 6.8, EJB 2.0
Specification) :-
" The term "stateless" signifies that an instance has no state for a
specific client. However, the instance
variables of the instance can contain the state across client-invoked
method
calls. Examples of such states include an open database connection and an
object reference to an EJB object. "
...
"Because all instances of a stateless session bean are equivalent, the
container can choose to delegate a
client-invoked method to any available instance. This means, for example,
that the Container may dele-gate
the requests from the same client within the same transaction to different
instances, and that the Container may interleave requests from multiple
transactions to the same instance."
...
"There is no fixed mapping between clients and stateless instances. The
container simply delegates a cli-ent's work to any available instance that
is method-ready."
I think it answers your doubt.
Regards
Mohit -([EMAIL PROTECTED])
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".