class ZookeeperLeaderElector implements LeaderElector {

    @Override
    public boolean leaveIfNotLeader() {
        synchronized (leaderElectionProcessRef) {
            LeaderElectionProcess process = leaderElectionProcessRef.get();
            if (process == null) {
                return false;
            }
            if (process.leaveIfNotLeader()) {
                leaderElectionProcessRef.set(null);
                return true;
            }
        }
        return false;
    }

    @Inject public  ZookeeperLeaderElector(LeaderActivator leaderActivator,
                                  CuratorService curatorService,
                                  ZookeeperPaths zookeeperPaths,
                                  MasterDescription masterDescription,
                                  TitusRuntime titusRuntime);

}