"J. Jawahar" wrote:

> We need to write objects that contain transient (non-presistent) data that
> needs to be shared among multiple clients. My understanding of stateful
> session EJBs is that they are meant to be instantiated and used by a single
> client. What kind of EJBs should we use to implement a shared object -- for
> instance an EJB that implements shared cache of some kind?

The pattern you need is just not supported in the EJB framework. You could try
to tweak an entity bean but that doesn't look too promising since entity beans
have a very restrictively defined life cycle.

The best solution is probably to make this object a CORBA object. That's a
trivial implementation - any decent Java ORB is multithreaded and synchronized
can be easily achieved with Java's synchronize mechanisms.

Interesting issue is however how you get it deployed in an EJB container. In the
worst case you just run it in its own JVM. You can find it in any case via JNDI.
That may require to hand-code the (5 lines of) JNDI registration.

The same problem occurs whenever you need objects which want to provide
read-only data combined with caching.

Cheers,

Andreas
--
"Programming with EJB, JTS and OTS" is now available. Collect all three!

begin:vcard
n:Vogel;Andreas
tel;fax:+1 650 655 3950
tel;home:+1 415 643 8827
tel;work:+1 650 358 3037
x-mozilla-html:TRUE
url:http://www.wiley.com/compbooks/vogel
org:Inprise Corp.
version:2.1
email;internet:[EMAIL PROTECTED]
title:Strategic Technology Adviser
adr;quoted-printable:;;951 Mariners' Island Blvd.=0D=0ASuite 120;San Mateo;CA;94404;USA
x-mozilla-cpt:;-6336
fn:Andreas Vogel
end:vcard

Reply via email to