Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / JavaBeans / August 2004

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Kurta - 20 Jul 2004 17:12 GMT
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...
ifly - 26 Aug 2004 15:45 GMT
I am interested in solving the same problem.
I currently have a solution involving JMX and WebLogic cluster.
1-create dynamic Mbean with synchronized methods
2-register with WL admin server as MBean agent/manager
3-all managed servers/users in cluster have access to this singleton
4-as clients log in/out they can invoke addUser/deleteUser methods on
dynamic mbean. They can also read currentUserCount.

PROBLEM:Single point of failure on admin server.
Looking for a simpler solution as you described above, OR
figuring out how to have dynamic MBean replicated in cluster so that each
managed server uses a local replicated copy--not sure how to achieve this
yet...


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.