Example usage for org.apache.zookeeper.server ZKDatabase commit

List of usage examples for org.apache.zookeeper.server ZKDatabase commit

Introduction

In this page you can find the example usage for org.apache.zookeeper.server ZKDatabase commit.

Prototype

public void commit() throws IOException 

Source Link

Document

commit to the underlying transaction log

Usage

From source file:com.netflix.curator.test.TestingServer.java

License:Apache License

/**
 * Stop the server without deleting the temp directory
 *//*www.j  a  v  a2s  . c  om*/
public void stop() {
    if (!isStopped.compareAndSet(false, true)) {
        return;
    }

    ZKDatabase zkDb = server.getZKDatabase();
    try {
        zkDb.commit();
        zkDb.close();
    } catch (Throwable e) {
        System.err.println("Error closing logs");
        e.printStackTrace();
    }
    try {
        server.shutdown();
        ServerHelper.shutdownFactory(factory);
    } catch (Throwable e) {
        System.err.println("Error shutting down server");
        e.printStackTrace();
    }
}