RE: Stateless Session Beans

2001-05-03 Thread elephantwalker

I believe that the servletContext which can meet the bill for you. Have a
servlet initialize on loading the application, you can control that in the
web.xml. Whenever the slsb is initialized, pass the servelet context, and
get your application class with a servletContext.getAttribute(myClass).

You can also get a env reference, and let the slsb get the reference (if its
a simple object you want).



-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of SCOTT FARQUHAR
Sent: Wednesday, May 02, 2001 10:48 PM
To: Orion-Interest
Subject: Stateless Session Beans


I'm hoping that someone can help me with this.

Can you have a stateless session bean that actually has class variables?

Ie I want to have a variable that is loaded once per application, and then
accessed by all the whole application.

I know that SLSB are pooled and created and destroyed at will - but will
they be created with the variable containing a value?

Any thoughts are much appreciated.

Scott






RE: Stateless Session Beans

2001-05-03 Thread Mike Cannon-Brookes

Scotty,

What is the need for this? Any stateless session variable can have a normal
variable that's initialised in the ejbActivate() and ejbCreate() methods.
static variables are fugly in a distributed environment because they're only
per JVM - remember this !

-mike

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED]]On Behalf Of SCOTT FARQUHAR
 Sent: Thursday, May 03, 2001 3:48 PM
 To: Orion-Interest
 Subject: Stateless Session Beans


 I'm hoping that someone can help me with this.

 Can you have a stateless session bean that actually has class variables?

 Ie I want to have a variable that is loaded once per application,
 and then accessed by all the whole application.

 I know that SLSB are pooled and created and destroyed at will -
 but will they be created with the variable containing a value?

 Any thoughts are much appreciated.

 Scott








RE: Stateless session beans reuse

2000-12-14 Thread John D'Ausilio

h ... I understand the case where, for instance, the field holds
something that uses system resources like an open file-based stream.
However, in this case the goal is to eliminate the repeated lookups for home
interfaces. There would be little savings if we get the home interfaces in
the ejbCreate and nulled them in ejbRemove, but the interesting question for
us is 'will the field still be valid, and if not how can one tell so it can
be made valid again?' .. so we can safely lazy initialize those fields.

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED]]On Behalf Of Jason Boehle
 Sent: Wednesday, December 13, 2000 4:28 PM
 To: Orion-Interest
 Subject: RE: Stateless session beans reuse


 My understanding is that the fields will not be set to null.  Instance
 variables are useful in stateless session beans to hold references to
 "global" objects/resources that are used over and over again.  You can
 allocate/release the variables in ejb[Post]Create()/ejbRemove().  Please,
 someone else tell me if I am wrong! :)

 Jason Boehle
 [EMAIL PROTECTED]

 -Original Message-
 From: John D'Ausilio [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, December 13, 2000 1:42 PM
 To: Orion-Interest
 Subject: Stateless session beans reuse


 Stateless session beans are clearly allowed to have instance variables
 (fields). A client of a stateless session bean cannot assume that
 he has the
 same bean instance for each method call.

 Assume we have a stateless session bean, which holds some fields storing
 various home interfaces. Gary (my co-worker) and I disagree in
 interpreting
 the EJB spec on what happens to those fields between method calls,
 specifically with respect to lazy initialization. My assumption is that
 those fields will be set to null between method calls, Gary
 assumes that the
 field may hold valid information (in which case lazy initialization dosn't
 occur). Comments?

 (we discussed doing a test, but that would only prove what Orion does ...)

 john d






RE: Stateless session beans reuse

2000-12-13 Thread Jason Boehle

My understanding is that the fields will not be set to null.  Instance
variables are useful in stateless session beans to hold references to
"global" objects/resources that are used over and over again.  You can
allocate/release the variables in ejb[Post]Create()/ejbRemove().  Please,
someone else tell me if I am wrong! :)

Jason Boehle
[EMAIL PROTECTED]

-Original Message-
From: John D'Ausilio [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, December 13, 2000 1:42 PM
To: Orion-Interest
Subject: Stateless session beans reuse


Stateless session beans are clearly allowed to have instance variables
(fields). A client of a stateless session bean cannot assume that he has the
same bean instance for each method call.

Assume we have a stateless session bean, which holds some fields storing
various home interfaces. Gary (my co-worker) and I disagree in interpreting
the EJB spec on what happens to those fields between method calls,
specifically with respect to lazy initialization. My assumption is that
those fields will be set to null between method calls, Gary assumes that the
field may hold valid information (in which case lazy initialization dosn't
occur). Comments?

(we discussed doing a test, but that would only prove what Orion does ...)

john d