From ddc1d7c6bcb40a6e2ca7af977a4938d7b974cf7e Mon Sep 17 00:00:00 2001
From: meeh <meeh@mail.i2p>
Date: Mon, 20 Aug 2012 21:26:12 +0000
Subject: [PATCH] disapproval of revision
 'acc7942148f44d32fc600d2f5784d1a43496eada'

---
 .../net/i2p/client/naming/NamingService.java  | 31 +++++++++----------
 1 file changed, 14 insertions(+), 17 deletions(-)

diff --git a/core/java/src/net/i2p/client/naming/NamingService.java b/core/java/src/net/i2p/client/naming/NamingService.java
index 38e772ddc4..327e0655b5 100644
--- a/core/java/src/net/i2p/client/naming/NamingService.java
+++ b/core/java/src/net/i2p/client/naming/NamingService.java
@@ -31,8 +31,6 @@ public abstract class NamingService {
     protected final Set<NamingServiceListener> _listeners;
     protected final Set<NamingServiceUpdater> _updaters;
 
-    private static NamingService instance;
-
     /** what classname should be used as the naming service impl? */
     public static final String PROP_IMPL = "i2p.naming.impl";
     private static final String DEFAULT_IMPL = "net.i2p.client.naming.BlockfileNamingService";
@@ -453,27 +451,26 @@ public abstract class NamingService {
      * choose the implementation from the "i2p.naming.impl" system
      * property.
      *
+     * FIXME Actually, it doesn't ensure that. Only call this once!!!
      */
     public static final synchronized NamingService createInstance(I2PAppContext context) {
-        if (instance instanceof NamingService) {
-            return instance;
-        }
-        String impl = context.getProperty(PROP_IMPL, DEFAULT_IMPL); 
+        NamingService instance = null;
+        String impl = context.getProperty(PROP_IMPL, DEFAULT_IMPL);
         try {
             Class cls = Class.forName(impl);
             Constructor con = cls.getConstructor(new Class[] { I2PAppContext.class });
             instance = (NamingService)con.newInstance(new Object[] { context });
-        } catch (Exception ex) { 
-            Log log = context.logManager().getLog(NamingService.class); 
-            // Blockfile may throw RuntimeException but HostsTxt won't 
-            if (!impl.equals(BACKUP_IMPL)) { 
-                log.error("Cannot load naming service " + impl + ", using HostsTxtNamingService", ex); 
-                instance = new HostsTxtNamingService(context); 
-            } else { 
-                log.error("Cannot load naming service " + impl + ", only .b32.i2p lookups will succeed", ex); 
-                instance = new DummyNamingService(context); 
-            } 
-        } 
+        } catch (Exception ex) {
+            Log log = context.logManager().getLog(NamingService.class);
+            // Blockfile may throw RuntimeException but HostsTxt won't
+            if (!impl.equals(BACKUP_IMPL)) {
+                log.error("Cannot load naming service " + impl + ", using HostsTxtNamingService", ex);
+                instance = new HostsTxtNamingService(context);
+            } else {
+                log.error("Cannot load naming service " + impl + ", only .b32.i2p lookups will succeed", ex);
+                instance = new DummyNamingService(context);
+            }
+        }
         return instance;
     }
 
-- 
GitLab