Ok , makes sense. but when you leave the Spec a bit behind you can use it
with static fields too I guess :-).

Frank


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Fred Loney
Sent: Thursday, July 05, 2001 4:33 PM
To: [EMAIL PROTECTED]
Subject: Re: [JBoss-user] Design question - Singleton


The EJB spec forbids an enterprise Bean to use read/write static fields.
This restriction is part of the contract with the EJB Container to control
the bean lifecycle, e.g. by transparently distributing bean instances across
multiple JVMs. I understand GemStone was big on spawning JVMs.

The standard EJB singleton technique is to bind the singleton instance to a
known JNDI location and access it via JNDI lookup. A JNDI singleton is safe
because it is unique in the namespace and the jndi hook prevents garbage
collection.

Frank Marx wrote:

> I wonder if it is possible to have a static field in the session bean and
> check if this field is set in the ejbCreate()

--
Fred Loney
Enterprise Java Consultant
Spirited Software, Inc.
[EMAIL PROTECTED]



_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user

_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to