Is there any best pratice for implementing a singleton object in the clustered environment ?
It is not recomended to use singleton when you have shared information, example: session information.
There are several ways to have something act like a singleton - all of them are based on central storage or replicated data.
A few ideas - all of them with huge implications to your application design:
- Use a DB to store your data.
- Use a SFSB (not recommed).
- Use local singletons with synchronisation in background via JMS/RMI ...
- Use JNDI (Serialized Objects or ResourceFactories or equal)