Why even use a Bean at all? You don't have to make all of your system fit
the EJB model. You can use some of the other great things in J2EE, like the
JNDI. Why not put your singleton java object in a JNDI namespace? Okay so
you won't be able to propogate your transactional context if you need one,
unless of course you use a persistent JMS to transmit the request to the
JNDI singleton. If you don't need to propogate a transactional context then
personally I'd go with the JNDI.
-----Original Message-----
From: Rickard �berg [mailto:[EMAIL PROTECTED]]
Sent: 24 March 2000 08:02
To: [EMAIL PROTECTED]
Subject: Re: What should I do if I need a singleton?
Hey
Maria Soledad Escobar - Sun Argentina wrote:
> Say you want a stateful, shared, server-side object, i.e., a singleton.
> EJB
> does not provide this design pattern explicitly. I could use an entity
> bean,
> but these are really intended to be stored in either a database or some
> (other) legacy backend. Writing a stand-alone entity bean (which
> provides
> full transactional semantics, as entities should) is overkill for a
> simple
> singleton. Or, you could use a stateful session bean, but these are
> intended
> to be single-user. (In reality, it is not possible for a container to
> enforce this rule, and thus it could be ignored, but again we find
> ourselves
> doing something quite unnatural in EJB.)
EJBoss 2.0 will provide a variant of a session bean container whose
instance pool only contains one instance. By doing this we allow
singletons to be implemented as a stateless session bean.
If you use this you will depend on our implementation of EJB, but the
bean itself does not contain EJBoss specific code.
/Rickard
--
Rickard �berg
@home: +46 13 177937
Email: [EMAIL PROTECTED]
http://www.dreambean.com
Question reality
===========================================================================
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 is intended only for the addressee. This e-mail and any files transmitted
with it may contain confidential or privileged information. If you are not the named
addressee or the person responsible for delivering the message to the named addressee,
please contact [EMAIL PROTECTED]
This e-mail has been scanned by MIMEsweeper.
Visit the Prebon Yamane web site at http://www.prebon.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".