mantis-control-plane/mantis-control-plane-server/src/main/java/io/mantisrx/master/zk/LeaderElector.java [64:97]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        this.leaderPath = leaderPath;
    }

    @Override
    public void start() {
        if (started) {
            return;
        }
        started = true;

        try {
            Stat pathStat = curator.checkExists().forPath(leaderPath);
            // Create the path only if the path does not exist
            if(pathStat == null) {
                curator.create()
                    .creatingParentsIfNeeded()
                    .withMode(CreateMode.PERSISTENT)
                    .forPath(leaderPath);
            }

            leaderLatch.start();
        } catch (Exception e) {
            throw new IllegalStateException("Failed to create a leader elector for master: "+e.getMessage(), e);
        }
    }

    @Override
    public void shutdown() {
        try {
            leaderLatch.close();
        } catch (IOException e) {
            logger.warn("Failed to close the leader latch: "+e.getMessage(), e);
        }finally {
            started = false;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



mantis-control-plane/mantis-control-plane-server/src/main/java/io/mantisrx/master/zk/ZookeeperLeaderElector.java [59:92]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        this.leaderPath = leaderPath;
    }

    @Override
    public void start() {
        if (started) {
            return;
        }
        started = true;

        try {
            Stat pathStat = curator.checkExists().forPath(leaderPath);
            // Create the path only if the path does not exist
            if(pathStat == null) {
                curator.create()
                    .creatingParentsIfNeeded()
                    .withMode(CreateMode.PERSISTENT)
                    .forPath(leaderPath);
            }

            leaderLatch.start();
        } catch (Exception e) {
            throw new IllegalStateException("Failed to create a leader elector for master: "+e.getMessage(), e);
        }
    }

    @Override
    public void shutdown() {
        try {
            leaderLatch.close();
        } catch (IOException e) {
            logger.warn("Failed to close the leader latch: "+e.getMessage(), e);
        }finally {
            started = false;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



