> Maybe I miss something, but if you really implemented a singleton this way, then I
> won't ever buy your product :-(

Not to worry, it was never a for-sale product anyway. :-)

> First of all, EJBs are intended to be distributed. This means that if your servers
> are clustered, you can't have a real singleton (only a singleton per VM) for all
> your servers.


Let me say it in a different way. If an entity bean is identified by the
primary key FOO, then you can connect to that entity bean remotely and
from multiple JVMs by doing a Home.findByPrimaryKey(FOO). Would you
agree?

Now just take it one step further. Let's say you call
Home.findByPrimaryKey(BAR). And suppose I secretly switch out BAR and
replace it with FOO. Then you still get the original FOO entity bean,
don't you? Even though you asked for the BAR entity bean. And because
we're following all the EJB rules, you can do this across JVMs and
across machines.

So, in a sense, we've created a singleton. No matter what you do, you
always get the same entity bean. The FOO bean. And this works in a
clustered environment because we haven't made any assumptions about
being in a single JVM.

I should note that this was all implemented in BMP. I suspect it might
not work so well in CMP.

-david


--
David Sims             [EMAIL PROTECTED]
Sims Computing, Inc.     www.simscomputing.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".

Reply via email to