use of org.apache.ignite.raft.jraft.closure.ClosureQueueImpl in project ignite-3 by apache.
the class NodeImpl method initFSMCaller.
private boolean initFSMCaller(final LogId bootstrapId) {
if (this.fsmCaller == null) {
LOG.error("Fail to init fsm caller, null instance, bootstrapId={}.", bootstrapId);
return false;
}
this.closureQueue = new ClosureQueueImpl(this.getOptions());
final FSMCallerOptions opts = new FSMCallerOptions();
opts.setAfterShutdown(status -> afterShutdown());
opts.setLogManager(this.logManager);
opts.setFsm(this.options.getFsm());
opts.setClosureQueue(this.closureQueue);
opts.setNode(this);
opts.setBootstrapId(bootstrapId);
opts.setRaftMessagesFactory(raftOptions.getRaftMessagesFactory());
opts.setfSMCallerExecutorDisruptor(options.getfSMCallerExecutorDisruptor());
opts.setGroupId(groupId);
return this.fsmCaller.init(opts);
}
use of org.apache.ignite.raft.jraft.closure.ClosureQueueImpl in project ignite-3 by apache.
the class FSMCallerTest method setup.
@BeforeEach
public void setup() {
this.fsmCaller = new FSMCallerImpl();
NodeOptions options = new NodeOptions();
executor = JRaftUtils.createExecutor("test-executor-", Utils.cpus());
options.setCommonExecutor(executor);
this.closureQueue = new ClosureQueueImpl(options);
opts = new FSMCallerOptions();
Mockito.when(this.node.getNodeMetrics()).thenReturn(new NodeMetrics(false));
Mockito.when(this.node.getOptions()).thenReturn(options);
opts.setNode(this.node);
opts.setFsm(this.fsm);
opts.setLogManager(this.logManager);
opts.setBootstrapId(new LogId(10, 1));
opts.setClosureQueue(this.closureQueue);
opts.setRaftMessagesFactory(new RaftMessagesFactory());
opts.setGroupId("TestSrv");
opts.setfSMCallerExecutorDisruptor(disruptor = new StripedDisruptor<>("TestFSMDisruptor", 1024, () -> new FSMCallerImpl.ApplyTask(), 1));
assertTrue(this.fsmCaller.init(opts));
}
use of org.apache.ignite.raft.jraft.closure.ClosureQueueImpl in project ignite-3 by apache.
the class BallotBoxTest method setup.
@BeforeEach
public void setup() {
BallotBoxOptions opts = new BallotBoxOptions();
NodeOptions options = new NodeOptions();
executor = JRaftUtils.createExecutor("test-executor-", Utils.cpus());
options.setCommonExecutor(executor);
this.closureQueue = new ClosureQueueImpl(options);
opts.setClosureQueue(this.closureQueue);
opts.setWaiter(this.waiter);
box = new BallotBox();
assertTrue(box.init(opts));
}
Aggregations