... but you can create a Singleton (NOT and EJB), accessed by a static
method (from an EJB), and save the data in the object. The container/VM may
garbage collect, but the worst case is that the singleton is created for
every access - it's more likely it'll hang around (override finalize to log
this and check).
Usual warning applies - the 'singleton' is VM bound (multiple VM's will each
have a singleton of their own), so it's only suitable for data which does
not change during the lifetime of the application.

tim
> -----Original Message-----
> From: Jon Tirs�n [SMTP:[EMAIL PROTECTED]]
> Sent: Monday, July 10, 2000 9:15 AM
> To:   [EMAIL PROTECTED]
> Subject:      Re: Global Objects in EJB Containers?
>
> Well, actually: 1) no and 2) no.
>
> Simple reason: An EJB can not have static
> data-members.
>
> There are so many issues regarding this that I can not
> name them all. Transactions, security, thread-safety
> etc. etc. etc.
>
>  --- Victor Langelo <[EMAIL PROTECTED]>
> skrev: > "More, Yogesh" wrote:
> >
> > > Fundamental questions..
> > >
> > > 1. Can I have global objects which created by a
> > session bean stay in memory
> > > even after the bean ceases to exist....for other
> > beans to share.
> >
> > Yes. You use static data members to hold references
> > to these objects. Be careful
> > that the garbage collector doesn't clear you class.
> > Or at least be prepared for
> > when it happens.
> >
> > >
> > >
> > > 2. Can I have singleton classes in a Container
> > environment shared by all
> > > EJBs?
> >
> > Yes. You can create a singleton class with only
> > static members. Same warning
> > about the GC as above.
> >
> > >
> > >
> > > Thanks,
> > > Yogesh
> > >
> > >
> >
> ==========================================================================
> =
> > > 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".
> >
>
>
> __________________________________________________
> Do You Yahoo!?
> Get Yahoo! Mail - Free email you can access from anywhere!
> http://mail.yahoo.com/
>
> ==========================================================================
> =
> 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".

This e-mail, and any attachment, is confidential. If you have received it in error, 
please delete it from your system, do not use or disclose the information in any way, 
and notify me immediately. The contents of this message may contain personal views 
which are not the views of the BBC, unless specifically stated.

===========================================================================
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".

Reply via email to