public static void start(final int port) {
        try {
            testingServer = new TestingServer(port, new File(String.format("target/test_zk_data/%s/", System.nanoTime())));
        } catch (final Exception ex) {
            ex.printStackTrace();
        } finally {
            Runtime.getRuntime().addShutdownHook(new Thread() {

                @Override
                public void run() {
                    try {
                        Thread.sleep(1000L);
                        testingServer.close();
                    } catch (final InterruptedException | IOException ex) {
                    }
                }
            });
        }
    }
public static void start(final int port) {
        try {
            testingServer = new TestingServer(port, new File(String.format("target/test_zk_data/%s/", System.nanoTime())));
        } catch (final Exception ex) {
            ex.printStackTrace();
        } finally {
            Runtime.getRuntime().addShutdownHook(new Thread() {

                @Override
                public void run() {
                    try {
                        Thread.sleep(1000L);
                        testingServer.close();
                    } catch (final InterruptedException | IOException ex) {
                    }
                }
            });
        }
    }
public static void start ( final int port ) { try { testingServer = new TestingServer ( port , new File ( String . format ( "target/test_zk_data/%s/" , System . nanoTime ( ) ) ) ) ; } catch ( final Exception ex ) { ex . printStackTrace ( ) ; } finally { Runtime . getRuntime ( ) . addShutdownHook ( new Thread ( ) { @ Override public void run ( ) { try { Thread . sleep ( 1000L ) ; testingServer . close ( ) ; } catch ( final InterruptedException | IOException ex ) { } } } ) ; } }
内存版的内嵌Zookeeper.

@param port Zookeeper的通信端口号
内存版的内嵌Zookeeper .