Maria,

You are right. EJB does not provide a clean Singleton model. There are many
suggestions on ways to handle this in the archives.

Quickly, my suggestions are:

- Use a distributed object model that supports Singleton for this specific
purpose (CORBA and RMI are both candidates).

- Use stateless session beans to access a singleton that your app server can
provide under the hood <vendor> GemStone/J can do this nicely with PCA
objects. A PCA object is the same object, even when it is accessed through
another JVM on a different physical machines </vendor> Other products may
provide similar capabilities, in a different way.

Regards,

-Chris.

> -----Original Message-----
> From: Maria Soledad Escobar - Sun Argentina
> [SMTP:[EMAIL PROTECTED]]
> Sent: Friday, March 24, 2000 2:06 AM
> To:   [EMAIL PROTECTED]
> Subject:      What should I do if I need a singleton?
>
> Hi all!!!
> 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.)
>
> any suggestions?
> Thank you :-)
>
> --
>          ______
>         /_____/\          Maria Soledad Escobar
>        /____ \\ \         Systems Engineer
>       /_____\ \\ /
>      /_____/ \/ / /       Sun Microsystem de Argentina
>     /_____/ /   \//\      Bouchard 547 Piso 26
>     \_____\//\   / /      Buenos Aires (1106)
>      \_____/ / /\ /       Tel: (54) 11-4317-5600
>       \_____/ \\ \        Fax: (54) 11-4311-8999
>        \_____\ \\
>         \_____\/
>
> ==========================================================================
> =
> 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".

Reply via email to