Search in sources :

Example 1 with SmartServiceState

use of org.smartdata.common.SmartServiceState in project SSM by Intel-bigdata.

the class TestEmptyMiniSmartCluster method waitTillSSMExitSafeMode.

public void waitTillSSMExitSafeMode() throws Exception {
    SmartAdmin client = new SmartAdmin(conf);
    long start = System.currentTimeMillis();
    int retry = 5;
    while (true) {
        try {
            SmartServiceState state = client.getServiceState();
            if (state != SmartServiceState.SAFEMODE) {
                break;
            }
            int secs = (int) (System.currentTimeMillis() - start) / 1000;
            System.out.println("Waited for " + secs + " seconds ...");
            Thread.sleep(1000);
        } catch (Exception e) {
            if (retry <= 0) {
                throw e;
            }
            retry--;
        }
    }
}
Also used : SmartAdmin(org.smartdata.admin.SmartAdmin) SmartServiceState(org.smartdata.common.SmartServiceState)

Aggregations

SmartAdmin (org.smartdata.admin.SmartAdmin)1 SmartServiceState (org.smartdata.common.SmartServiceState)1