Index: /trunk/src/VBox/Main/glue/glue-java.xsl
===================================================================
--- /trunk/src/VBox/Main/glue/glue-java.xsl	(revision 31165)
+++ /trunk/src/VBox/Main/glue/glue-java.xsl	(revision 31166)
@@ -2510,10 +2510,10 @@
     }
 
-    private static VirtualBoxManager mgr;
-
-    public static synchronized VirtualBoxManager getInstance(String home)
-    {
-        if (mgr != null)
-            return mgr;
+    private static boolean hasInstance = false;
+
+    public static synchronized VirtualBoxManager createInstance(String home)
+    {
+        if (hasInstance)
+            throw new VBoxException(null, "only one instance at the time allowed");
 
         if (home == null)
@@ -2531,6 +2531,7 @@
         }
 
-        mgr = new VirtualBoxManager(mozilla, servMgr);
-        return mgr;
+        hasInstance = true;
+
+        return new VirtualBoxManager(mozilla, servMgr);
     }
 
@@ -2545,4 +2546,5 @@
         mozilla.shutdownXPCOM(servMgr);
         mozilla = null;
+        hasInstance = false;
     }
 
@@ -3006,7 +3008,7 @@
         ISession s = getSessionObject();
         m.lockMachine(s, LockType.Shared);
-        return s;       
-    }
-   
+        return s;
+    }
+
     public void closeMachineSession(ISession s)
     {
@@ -3015,16 +3017,13 @@
     }
 
-    private static VirtualBoxManager mgr;
-
-    public static synchronized VirtualBoxManager getInstance(String home)
-    {
-        if (mgr != null)
-            return mgr;
-
-        if (home == null)
-            home = System.getProperty("vbox.home");
-
-        mgr = new VirtualBoxManager();
-        return mgr;
+    private static boolean hasInstance = false;
+
+    public static synchronized VirtualBoxManager createInstance(String home)
+    {
+        if (hasInstance)
+          throw new VBoxException(null, "only one instance at the time allowed");
+
+        hasInstance = true;
+        return new VirtualBoxManager();
     }
 
@@ -3032,5 +3031,5 @@
     {
         deinitPerThread();
-        mgr = null;
+        hasInstance = false;
     }
 
@@ -3207,5 +3206,5 @@
             List<T2> ret = new ArrayList<T2>(values.size());
             for (T1 v : values) {
-                // static method is called with null this                
+                // static method is called with null this
                 ret.add((T2)fromValue.invoke(null, v.name()));
             }
@@ -3460,13 +3459,7 @@
     }
 
-    private static VirtualBoxManager mgr;
-
-    public static synchronized VirtualBoxManager getInstance(String home)
-    {
-        if (mgr != null)
-            return mgr;
-
-        mgr = new VirtualBoxManager();
-        return mgr;
+    public static synchronized VirtualBoxManager createInstance(String home)
+    {
+        return new VirtualBoxManager();
     }
 
Index: /trunk/src/VBox/Main/glue/tests/TestVBox.java
===================================================================
--- /trunk/src/VBox/Main/glue/tests/TestVBox.java	(revision 31165)
+++ /trunk/src/VBox/Main/glue/tests/TestVBox.java	(revision 31166)
@@ -96,7 +96,27 @@
     }
 
+    static void testMultiServer()
+    {
+        VirtualBoxManager mgr1 = VirtualBoxManager.createInstance(null);
+        VirtualBoxManager mgr2 = VirtualBoxManager.createInstance(null);
+
+        try {
+            mgr1.connect("http://i7:18083", "", "");
+            mgr2.connect("http://main:18083", "", "");
+
+            String mach1 =  mgr1.getVBox().getMachines().get(0).getName();
+            String mach2 =  mgr2.getVBox().getMachines().get(0).getName();
+
+            mgr1.startVm(mach1, null, 7000);
+            mgr2.startVm(mach2, null, 7000);
+        } finally {
+            mgr1.cleanup();
+            mgr2.cleanup();
+        }
+    }
+
     public static void main(String[] args)
     {
-        VirtualBoxManager mgr = VirtualBoxManager.getInstance(null);
+        VirtualBoxManager mgr = VirtualBoxManager.createInstance(null);
 
         boolean ws = false;
