public synchronized void join()

in modules/raft/src/main/java/org/apache/ignite/raft/jraft/core/NodeImpl.java [3158:3219]


    public synchronized void join() throws InterruptedException {
        if (this.shutdownLatch != null) {
            if (this.readOnlyService != null) {
                this.readOnlyService.join();
            }
            if (this.logManager != null) {
                this.logManager.join();
            }
            if (this.snapshotExecutor != null) {
                this.snapshotExecutor.join();
            }
            if (this.wakingCandidate != null) {
                Replicator.join(this.wakingCandidate);
            }
            this.shutdownLatch.await();
            this.applyDisruptor.unsubscribe(getNodeId());
            this.shutdownLatch = null;
        }
        if (this.fsmCaller != null) {
            this.fsmCaller.join();
        }

        // Stop and reset non shared pools.
        NodeOptions opts = getOptions();

        if (opts.getScheduler() != null && !opts.isSharedPools()) {
            opts.getScheduler().shutdown();
        }
        if (opts.getElectionTimer() != null && !opts.isSharedPools()) {
            opts.getElectionTimer().stop();
        }
        if (opts.getVoteTimer() != null && !opts.isSharedPools()) {
            opts.getVoteTimer().stop();
        }
        if (opts.getStepDownTimer() != null && !opts.isSharedPools()) {
            opts.getStepDownTimer().stop();
        }
        if (opts.getSnapshotTimer() != null && !opts.isSharedPools()) {
            opts.getSnapshotTimer().stop();
        }
        if (opts.getCommonExecutor() != null && !opts.isSharedPools()) {
            ExecutorServiceHelper.shutdownAndAwaitTermination(opts.getCommonExecutor());
        }
        if (opts.getStripedExecutor() != null && !opts.isSharedPools()) {
            opts.getStripedExecutor().shutdownGracefully();
        }
        if (opts.getClientExecutor() != null && !opts.isSharedPools()) {
            ExecutorServiceHelper.shutdownAndAwaitTermination(opts.getClientExecutor());
        }
        if (opts.getfSMCallerExecutorDisruptor() != null && (!opts.isSharedPools() || ownFsmCallerExecutorDisruptorConfig != null)) {
            opts.getfSMCallerExecutorDisruptor().shutdown();
        }
        if (opts.getNodeApplyDisruptor() != null && !opts.isSharedPools()) {
            opts.getNodeApplyDisruptor().shutdown();
        }
        if (opts.getReadOnlyServiceDisruptor() != null && !opts.isSharedPools()) {
            opts.getReadOnlyServiceDisruptor().shutdown();
        }
        if (opts.getLogManagerDisruptor() != null && !opts.isSharedPools()) {
            opts.getLogManagerDisruptor().shutdown();
        }
    }