public void start() {
    clusterThread.start();

    // TODO: replace with a better wait-notify
    while (membersRef.get() == null && clusterThread.isAlive()) {
      try {
        Thread.sleep(100);
      } catch (InterruptedException e) {
        throw new HazelcastException(e);
      }
    }
    initMembershipListener();
    active = true;
    // started
  }
 public void stop() {
   active = false;
   clusterThread.shutdown();
 }