File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB and other Java EE Technologies and the fly likes 'True' Singletons in Clustered EJB Servers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark " Watch " New topic

'True' Singletons in Clustered EJB Servers

Andy Bowes
Ranch Hand

Joined: Jan 14, 2003
Posts: 171
Hi Guys,
Hoping that someone out there can help as I have hit a bit of a conceptual brick-wall
I am currently designing part of an application that will generate and send a batch of emails overnight. This process will be invoked by calling methods on a Stateless Session Bean from a 'Scheduler' task.
The interesting part is that this will need to be deployed in a clustered environment with multiple servers and multiple JVMs on each server. It is therefore vital that there is only ONE scheduler task running in the cluster so that the users don't receive multiple emails (i.e. one per JVM) however it must be resilient so that if any of the servers go down then the scheduler will automatically switch to another server.
The solution must run on a generic EJB1.1 platform.
Thanks in advance for any ideas
Andy Bowes

Andy Bowes<br />SCJP, SCWCD<br />I like deadlines, I love the whoosing noise they make as they go flying past - Douglas Adams
Hari babu
Ranch Hand

Joined: Jun 25, 2001
Posts: 208
I feel u should access the scheduler object using a JNDI rather than directly calling the object.
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
JMS might be an interesting approach, too. Underlying queue managers usually offer "persistent queues" or "assured delivery" that solve some problems with your singleton server availability. If the singleton is down, requests stay in queue until it comes back.
Could the singleton be in its own application that is not duplicated across the cluster?

A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
I agree. Here's the link:
subject: 'True' Singletons in Clustered EJB Servers
It's not a secret anymore!