Singletons across multiple JVMs
843829Jan 6 2003 — edited Jan 7 2003I have an EJB application container which is spread across multiple JVMs(something like a clustered EJB container). I am using a Singleton class to hand out 'running serial numbers'. Therefore there is a Singleton class per JVM(which is not very clean but i chose this path in the absence of anything better). Each singleton comes up when it is first invoked within a JVM and reads a starting running number and a pool of numbers from the database. This way multiple Singletons will not step on each other when doling out the serial numbers and there is no need to go back to the database for every request to the 'running serial number'.
Is there some way to do some of the initialization within these Singleton's just ONCE across the multiple instances of the JVM ie. a real Singleton across multiple JVMs?
Thanks
Ramdas