public void startup() {

//        Dictionary<?, ?> dict = cmPropertyPlaceholder.getConfigAdmin()
//                .getConfiguration(cmPropertyPlaceholder.getPersistentId()).getProperties();
        Dictionary<?, ?> dict = properties;
        // System.out.println("### ZOOKEEPER :: dictionary : " + dict);

        LOG.info("Staring up ZooKeeper server");

        if (dict == null) {
            LOG.info("Ignoring configuration update because updated configuration is empty.");
            shutdown();
            return;
        }


        if (main != null) {
            // stop the current instance
            shutdown();
            // then reconfigure and start again.
        }

        if (dict.get("clientPort") == null) {
            LOG.info("Ignoring configuration update because required property 'clientPort' isn't set.");
            return;
        }

        Properties props = new Properties();
        for (Enumeration<?> e = dict.keys(); e.hasMoreElements(); ) {
            Object key = e.nextElement();
            props.put(key, dict.get(key));
        }

        try {
            main = ZookeeperServerImpl.getZookeeperServer(props);

            zkMainThread = new Thread(new Runnable() {
                public void run() {
                    try {
                        main.startup();
                    } catch (IOException e) {
                        LOG.log(Level.SEVERE, "Problem running ZooKeeper server.", e);
                    }
                }
            });
            zkMainThread.start();

            LOG.info("Applied configuration update :" + props);
        } catch (Exception th) {
            LOG.log(Level.SEVERE, "Problem applying configuration update: " + props, th);
        }
    }
public void startup ( ) { Dictionary < ? , ? > dict = properties ; LOG . info ( "Staring up ZooKeeper server" ) ; if ( dict == null ) { LOG . info ( "Ignoring configuration update because updated configuration is empty." ) ; shutdown ( ) ; return ; } if ( main != null ) { shutdown ( ) ; } if ( dict . get ( "clientPort" ) == null ) { LOG . info ( "Ignoring configuration update because required property 'clientPort' isn't set." ) ; return ; } Properties props = new Properties ( ) ; for ( Enumeration < ? > e = dict . keys ( ) ; e . hasMoreElements ( ) ; ) { Object key = e . nextElement ( ) ; props . put ( key , dict . get ( key ) ) ; } try { main = ZookeeperServerImpl . getZookeeperServer ( props ) ; zkMainThread = new Thread ( new Runnable ( ) { public void run ( ) { try { main . startup ( ) ; } catch ( IOException e ) { LOG . log ( Level . SEVERE , "Problem running ZooKeeper server." , e ) ; } } } ) ; zkMainThread . start ( ) ; LOG . info ( "Applied configuration update :" + props ) ; } catch ( Exception th ) { LOG . log ( Level . SEVERE , "Problem applying configuration update: " + props , th ) ; } }
}