Example usage for org.apache.cassandra.tools BootstrapMonitor awaitCompletion

List of usage examples for org.apache.cassandra.tools BootstrapMonitor awaitCompletion

Introduction

In this page you can find the example usage for org.apache.cassandra.tools BootstrapMonitor awaitCompletion.

Prototype

public void awaitCompletion() throws InterruptedException 

Source Link

Usage

From source file:com.wenyu.utils.ClusterToolNodeProbe.java

License:Apache License

public void resumeBootstrap(PrintStream out) throws IOException {
    BootstrapMonitor monitor = new BootstrapMonitor(out);
    try {//from w w  w  . j  a v  a  2  s .c om
        jmxc.addConnectionNotificationListener(monitor, null, null);
        ssProxy.addNotificationListener(monitor, null, null);
        if (ssProxy.resumeBootstrap()) {
            out.println("Resuming bootstrap");
            monitor.awaitCompletion();
        } else {
            out.println("Node is already bootstrapped.");
        }
    } catch (Exception e) {
        throw new IOException(e);
    } finally {
        try {
            ssProxy.removeNotificationListener(monitor);
            jmxc.removeConnectionNotificationListener(monitor);
        } catch (Throwable e) {
            out.println("Exception occurred during clean-up. " + e);
        }
    }
}