@Test public void testStop() throws InterruptedException { NodeImpl node = (NodeImpl) newNodeBuilder(NodeId.of("A"), new NodeEndpoint("A", "localhost", 2333)) .build(); node.start(); node.stop(); }
@Override public synchronized void stop() throws InterruptedException { if (!started) { throw new IllegalStateException("node not started"); } context.scheduler().stop(); context.log().close(); context.connector().close(); context.store().close(); context.taskExecutor().shutdown(); context.groupConfigChangeTaskExecutor().shutdown(); started = false; }
NodeImpl implements Node { @Override public synchronized void stop() throws InterruptedException { if (!started) { throw new IllegalStateException("node not started"); } context.scheduler().stop(); context.log().close(); context.connector().close(); context.store().close(); context.taskExecutor().shutdown(); context.groupConfigChangeTaskExecutor().shutdown(); started = false; } }
NodeImpl implements Node { @Override public synchronized void stop() throws InterruptedException { if (!started) { throw new IllegalStateException("node not started"); } context.scheduler().stop(); context.log().close(); context.connector().close(); context.store().close(); context.taskExecutor().shutdown(); context.groupConfigChangeTaskExecutor().shutdown(); started = false; } NodeImpl(NodeContext context); }
NodeImpl implements Node { @Override public synchronized void stop() throws InterruptedException { if (!started) { throw new IllegalStateException("node not started"); } context.scheduler().stop(); context.log().close(); context.connector().close(); context.store().close(); context.taskExecutor().shutdown(); context.groupConfigChangeTaskExecutor().shutdown(); started = false; } NodeImpl(NodeContext context); @Override synchronized void registerStateMachine(@Nonnull StateMachine stateMachine); @Override @Nonnull RoleNameAndLeaderId getRoleNameAndLeaderId(); @Override void addNodeRoleListener(@Nonnull NodeRoleListener listener); @Override synchronized void start(); @Override void appendLog(@Nonnull byte[] commandBytes); @Override @Nonnull GroupConfigChangeTaskReference addNode(@Nonnull NodeEndpoint endpoint); @Override @Nonnull GroupConfigChangeTaskReference removeNode(@Nonnull NodeId id); @Subscribe void onReceiveRequestVoteRpc(RequestVoteRpcMessage rpcMessage); @Subscribe void onReceiveRequestVoteResult(RequestVoteResult result); @Subscribe void onReceiveAppendEntriesRpc(AppendEntriesRpcMessage rpcMessage); @Subscribe void onReceiveAppendEntriesResult(AppendEntriesResultMessage resultMessage); @Subscribe void onReceiveInstallSnapshotRpc(InstallSnapshotRpcMessage rpcMessage); @Subscribe void onReceiveInstallSnapshotResult(InstallSnapshotResultMessage resultMessage); @Subscribe void onGroupConfigEntryFromLeaderAppend(GroupConfigEntryFromLeaderAppendEvent event); @Subscribe void onGroupConfigEntryCommitted(GroupConfigEntryCommittedEvent event); @Subscribe void onGroupConfigEntryBatchRemoved(GroupConfigEntryBatchRemovedEvent event); @Subscribe void onGenerateSnapshot(SnapshotGenerateEvent event); @Subscribe void onReceiveDeadEvent(DeadEvent deadEvent); @Override synchronized void stop(); }
NodeImpl implements Node { @Override public synchronized void stop() throws InterruptedException { if (!started) { throw new IllegalStateException("node not started"); } context.scheduler().stop(); context.log().close(); context.connector().close(); context.store().close(); context.taskExecutor().shutdown(); context.groupConfigChangeTaskExecutor().shutdown(); started = false; } NodeImpl(NodeContext context); @Override synchronized void registerStateMachine(@Nonnull StateMachine stateMachine); @Override @Nonnull RoleNameAndLeaderId getRoleNameAndLeaderId(); @Override void addNodeRoleListener(@Nonnull NodeRoleListener listener); @Override synchronized void start(); @Override void appendLog(@Nonnull byte[] commandBytes); @Override @Nonnull GroupConfigChangeTaskReference addNode(@Nonnull NodeEndpoint endpoint); @Override @Nonnull GroupConfigChangeTaskReference removeNode(@Nonnull NodeId id); @Subscribe void onReceiveRequestVoteRpc(RequestVoteRpcMessage rpcMessage); @Subscribe void onReceiveRequestVoteResult(RequestVoteResult result); @Subscribe void onReceiveAppendEntriesRpc(AppendEntriesRpcMessage rpcMessage); @Subscribe void onReceiveAppendEntriesResult(AppendEntriesResultMessage resultMessage); @Subscribe void onReceiveInstallSnapshotRpc(InstallSnapshotRpcMessage rpcMessage); @Subscribe void onReceiveInstallSnapshotResult(InstallSnapshotResultMessage resultMessage); @Subscribe void onGroupConfigEntryFromLeaderAppend(GroupConfigEntryFromLeaderAppendEvent event); @Subscribe void onGroupConfigEntryCommitted(GroupConfigEntryCommittedEvent event); @Subscribe void onGroupConfigEntryBatchRemoved(GroupConfigEntryBatchRemovedEvent event); @Subscribe void onGenerateSnapshot(SnapshotGenerateEvent event); @Subscribe void onReceiveDeadEvent(DeadEvent deadEvent); @Override synchronized void stop();  }