aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Singleton using EJB Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Singleton using EJB" Watch "Singleton using EJB" New topic
Author

Singleton using EJB

Anandg Joshi
Greenhorn

Joined: Nov 24, 2003
Posts: 2
What is the best approach for implementing the Singleton design pattern using EJB and how to log important events from the EJB (The specs prohibits the use of Sockets/File IO)?
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3879
For the singleton idea, see this article. However, be aware of the limitations of this approach. If you need the singleton value to be clusterable, then you should look at the Distributed Cache approach described in my article in this month's JavaRanch Journal.
Kyle


Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
norman richards
Author
Ranch Hand

Joined: Jul 21, 2003
Posts: 367
What you are actually trying to accomplish with the singleton? Do you really need a singleton or are you just trying to apply a "design pattern". I don't know your domain, but based on my experience, I'd say there's a 99% chance you don't actually need the singleton. You'll save yourself a lot of trouble but not chasing after an anti-pattern. Instead, look at the qualities of the singleton you are really interested in (controlled instantiation, caching, etc...) and pick a solution that gives you those. (just a suggestion)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Singleton using EJB
 
Similar Threads
Singleton implementation
where can i initialize the global parameter?
why stateless bean is not singleton
Static Methods in EJB
running only one instance of java program