code: private void takeLeadership() {
      context.setLeader(context.getCluster().member().id());
      context.getClusterState().getRemoteMemberStates().forEach(m -> m.resetState(context.getLog()));
    }
docs: Sets the current node as the cluster leader.