Changeset ddc1d7c


Ignore:
Timestamp:
Aug 20, 2012 9:26:12 PM (7 years ago)
Author:
meeh <meeh@…>
Branches:
master
Children:
7d902cc
Parents:
5bb90c6
Message:

disapproval of revision 'acc7942148f44d32fc600d2f5784d1a43496eada'

File:
1 edited

Legend:

Unmodified
Added
Removed
  • core/java/src/net/i2p/client/naming/NamingService.java

    r5bb90c6 rddc1d7c  
    3131    protected final Set<NamingServiceListener> _listeners;
    3232    protected final Set<NamingServiceUpdater> _updaters;
    33 
    34     private static NamingService instance;
    3533
    3634    /** what classname should be used as the naming service impl? */
     
    454452     * property.
    455453     *
     454     * FIXME Actually, it doesn't ensure that. Only call this once!!!
    456455     */
    457456    public static final synchronized NamingService createInstance(I2PAppContext context) {
    458         if (instance instanceof NamingService) {
    459             return instance;
    460         }
    461         String impl = context.getProperty(PROP_IMPL, DEFAULT_IMPL);
     457        NamingService instance = null;
     458        String impl = context.getProperty(PROP_IMPL, DEFAULT_IMPL);
    462459        try {
    463460            Class cls = Class.forName(impl);
    464461            Constructor con = cls.getConstructor(new Class[] { I2PAppContext.class });
    465462            instance = (NamingService)con.newInstance(new Object[] { context });
    466         } catch (Exception ex) { 
    467             Log log = context.logManager().getLog(NamingService.class); 
    468             // Blockfile may throw RuntimeException but HostsTxt won't 
    469             if (!impl.equals(BACKUP_IMPL)) { 
    470                 log.error("Cannot load naming service " + impl + ", using HostsTxtNamingService", ex); 
    471                 instance = new HostsTxtNamingService(context); 
    472             } else { 
    473                 log.error("Cannot load naming service " + impl + ", only .b32.i2p lookups will succeed", ex); 
    474                 instance = new DummyNamingService(context); 
    475             } 
    476         } 
     463        } catch (Exception ex) {
     464            Log log = context.logManager().getLog(NamingService.class);
     465            // Blockfile may throw RuntimeException but HostsTxt won't
     466            if (!impl.equals(BACKUP_IMPL)) {
     467                log.error("Cannot load naming service " + impl + ", using HostsTxtNamingService", ex);
     468                instance = new HostsTxtNamingService(context);
     469            } else {
     470                log.error("Cannot load naming service " + impl + ", only .b32.i2p lookups will succeed", ex);
     471                instance = new DummyNamingService(context);
     472            }
     473        }
    477474        return instance;
    478475    }
Note: See TracChangeset for help on using the changeset viewer.