For Programmers: Free Programming Magazines  


Home > Archive > Java Beans > July 2004 > Stateless Session Beans and a Stateful Singleton? (Sharing data between clients)









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Stateless Session Beans and a Stateful Singleton? (Sharing data between clients)
Kurta

2004-07-20, 3:58 pm

Consider the following (hugely simplified) scenario:

We have various clients accessing a server application. The server
might be clustered. A client wants to know how many clients are
connected to the server.

Is the next design OK? Are there any flaws in it? Is there a better
design? Any help/comments are appretiated.

The clients call Stateless Session Bean methods to get that info. In
the static initializer of the SLSB we do a lookup of a Stateful
Session Bean (is that possible?) that we later plan to use as a
singleton. Store the JNDI handle in a static variable of the SLSB and
use that handle to get the SFSB whenever it's needed to get the count.
(We access the counter in the SFSB.)

-- We cannot use simply SFSB's 'cause they're bound to a client
session and are instantiated for every client.
-- We cannot use simply static variables, for they're unique only
inside a JVM or ClassLoader. Remember that the server could be
clustered. The data should be shared betwenn clustered server
instances.
-- We don't really want to use Entity Beans to persist this counter
data in a database...

Hope this makes sense...
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com