Search in sources :

Example 1 with FSMCaller

use of io.dingodb.raft.FSMCaller in project dingo by dingodb.

the class FSMCallerImpl method shutdown.

@Override
public synchronized void shutdown() {
    if (this.shutdownLatch != null) {
        return;
    }
    LOG.info("Shutting down FSMCaller...");
    if (this.taskQueue != null) {
        final CountDownLatch latch = new CountDownLatch(1);
        this.shutdownLatch = latch;
        Utils.runInThread(() -> this.taskQueue.publishEvent((task, sequence) -> {
            task.reset();
            task.type = TaskType.SHUTDOWN;
            task.shutdownLatch = latch;
        }));
    }
    doShutdown();
}
Also used : RaftException(io.dingodb.raft.error.RaftException) FSMCallerOptions(io.dingodb.raft.option.FSMCallerOptions) Requires(io.dingodb.raft.util.Requires) RaftError(io.dingodb.raft.error.RaftError) SnapshotReader(io.dingodb.raft.storage.snapshot.SnapshotReader) LogId(io.dingodb.raft.entity.LogId) LoggerFactory(org.slf4j.LoggerFactory) Describer(io.dingodb.raft.util.Describer) LogEntry(io.dingodb.raft.entity.LogEntry) LogExceptionHandler(io.dingodb.raft.util.LogExceptionHandler) ArrayList(java.util.ArrayList) SnapshotWriter(io.dingodb.raft.storage.snapshot.SnapshotWriter) BlockingWaitStrategy(com.lmax.disruptor.BlockingWaitStrategy) TaskClosure(io.dingodb.raft.closure.TaskClosure) ConfigurationEntry(io.dingodb.raft.conf.ConfigurationEntry) StateMachine(io.dingodb.raft.StateMachine) LogManager(io.dingodb.raft.storage.LogManager) OnlyForTest(io.dingodb.raft.util.OnlyForTest) EventHandler(com.lmax.disruptor.EventHandler) DisruptorMetricSet(io.dingodb.raft.util.DisruptorMetricSet) Logger(org.slf4j.Logger) NamedThreadFactory(io.dingodb.raft.util.NamedThreadFactory) ClosureQueue(io.dingodb.raft.closure.ClosureQueue) LoadSnapshotClosure(io.dingodb.raft.closure.LoadSnapshotClosure) RingBuffer(com.lmax.disruptor.RingBuffer) Closure(io.dingodb.raft.Closure) ProducerType(com.lmax.disruptor.dsl.ProducerType) Status(io.dingodb.raft.Status) Configuration(io.dingodb.raft.conf.Configuration) Utils(io.dingodb.raft.util.Utils) RaftOutter(io.dingodb.raft.entity.RaftOutter) FSMCaller(io.dingodb.raft.FSMCaller) DisruptorBuilder(io.dingodb.raft.util.DisruptorBuilder) EnumOutter(io.dingodb.raft.entity.EnumOutter) CountDownLatch(java.util.concurrent.CountDownLatch) AtomicLong(java.util.concurrent.atomic.AtomicLong) List(java.util.List) EventTranslator(com.lmax.disruptor.EventTranslator) PeerId(io.dingodb.raft.entity.PeerId) LeaderChangeContext(io.dingodb.raft.entity.LeaderChangeContext) SaveSnapshotClosure(io.dingodb.raft.closure.SaveSnapshotClosure) EventFactory(com.lmax.disruptor.EventFactory) Disruptor(com.lmax.disruptor.dsl.Disruptor) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList) CountDownLatch(java.util.concurrent.CountDownLatch)

Aggregations

BlockingWaitStrategy (com.lmax.disruptor.BlockingWaitStrategy)1 EventFactory (com.lmax.disruptor.EventFactory)1 EventHandler (com.lmax.disruptor.EventHandler)1 EventTranslator (com.lmax.disruptor.EventTranslator)1 RingBuffer (com.lmax.disruptor.RingBuffer)1 Disruptor (com.lmax.disruptor.dsl.Disruptor)1 ProducerType (com.lmax.disruptor.dsl.ProducerType)1 Closure (io.dingodb.raft.Closure)1 FSMCaller (io.dingodb.raft.FSMCaller)1 StateMachine (io.dingodb.raft.StateMachine)1 Status (io.dingodb.raft.Status)1 ClosureQueue (io.dingodb.raft.closure.ClosureQueue)1 LoadSnapshotClosure (io.dingodb.raft.closure.LoadSnapshotClosure)1 SaveSnapshotClosure (io.dingodb.raft.closure.SaveSnapshotClosure)1 TaskClosure (io.dingodb.raft.closure.TaskClosure)1 Configuration (io.dingodb.raft.conf.Configuration)1 ConfigurationEntry (io.dingodb.raft.conf.ConfigurationEntry)1 EnumOutter (io.dingodb.raft.entity.EnumOutter)1 LeaderChangeContext (io.dingodb.raft.entity.LeaderChangeContext)1 LogEntry (io.dingodb.raft.entity.LogEntry)1