Singleton Pattern in Cluster
posted 12 years ago
Yes. The rule for a singleton is that it guarentees one intance per JVM. There are patterns out there which can make sure there is only one instance of a singleton in a cluster, but for most normal cases where you would use a singleton (i.e. a small amount of read-only data needs cached for your app) having an instance per JVM is not really a problem. If you have an occasion where you must have only one instance per clustered application, you can do this with RMI - deploying the singlton as a RMI service, and looking it up through JNDI.