title: How to create singleton java class for multiple jvm support?
body: <p>For example I have DBManager.java Singleton Class, which I have to deploy on clustered environment.
  It is a web based application, with following deployment stratergy</p>
  
  <p>Apache Load Balancer --> Tomcat 6 (3 Servers in cluster).</p>
  
  <p>I have to maintain single instance of DBManager for 3 tomcat instances.</p>
  
  <p>My code is</p>
  
  <pre><code>package com.db.util;
  public class DBManager {
      private static DBManager singleInstance;
      private DBManager () {}
      public static DBManager getSingleInstance() {
          if (singleInstance == null) {
              synchronized (DBManager.class) {
                  if (singleInstance == null) {
                      singleInstance = new DBManager ();
                  }
              }
          }
          return singleInstance;
      }
  }
  </code></pre>
  
  <p>I have been searching a solution to this problem, and found something like JGroups API.
  Can this be achieved using JGroups ? Any Idea, How to implement that ?</p>