Search in sources :

Example 1 with FSMCaller

use of com.alipay.sofa.jraft.FSMCaller in project sofa-jraft by sofastack.

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 : LogId(com.alipay.sofa.jraft.entity.LogId) FSMCallerOptions(com.alipay.sofa.jraft.option.FSMCallerOptions) LoggerFactory(org.slf4j.LoggerFactory) LeaderChangeContext(com.alipay.sofa.jraft.entity.LeaderChangeContext) Utils(com.alipay.sofa.jraft.util.Utils) EnumOutter(com.alipay.sofa.jraft.entity.EnumOutter) ArrayList(java.util.ArrayList) LoadSnapshotClosure(com.alipay.sofa.jraft.closure.LoadSnapshotClosure) BlockingWaitStrategy(com.lmax.disruptor.BlockingWaitStrategy) LogManager(com.alipay.sofa.jraft.storage.LogManager) Closure(com.alipay.sofa.jraft.Closure) SaveSnapshotClosure(com.alipay.sofa.jraft.closure.SaveSnapshotClosure) RaftError(com.alipay.sofa.jraft.error.RaftError) TaskClosure(com.alipay.sofa.jraft.closure.TaskClosure) ConfigurationEntry(com.alipay.sofa.jraft.conf.ConfigurationEntry) EventHandler(com.lmax.disruptor.EventHandler) LogExceptionHandler(com.alipay.sofa.jraft.util.LogExceptionHandler) OnlyForTest(com.alipay.sofa.jraft.util.OnlyForTest) Logger(org.slf4j.Logger) DisruptorMetricSet(com.alipay.sofa.jraft.util.DisruptorMetricSet) PeerId(com.alipay.sofa.jraft.entity.PeerId) RaftOutter(com.alipay.sofa.jraft.entity.RaftOutter) Configuration(com.alipay.sofa.jraft.conf.Configuration) StateMachine(com.alipay.sofa.jraft.StateMachine) NamedThreadFactory(com.alipay.sofa.jraft.util.NamedThreadFactory) RingBuffer(com.lmax.disruptor.RingBuffer) DisruptorBuilder(com.alipay.sofa.jraft.util.DisruptorBuilder) ProducerType(com.lmax.disruptor.dsl.ProducerType) ClosureQueue(com.alipay.sofa.jraft.closure.ClosureQueue) Status(com.alipay.sofa.jraft.Status) CountDownLatch(java.util.concurrent.CountDownLatch) AtomicLong(java.util.concurrent.atomic.AtomicLong) List(java.util.List) EventTranslator(com.lmax.disruptor.EventTranslator) FSMCaller(com.alipay.sofa.jraft.FSMCaller) LogEntry(com.alipay.sofa.jraft.entity.LogEntry) SnapshotWriter(com.alipay.sofa.jraft.storage.snapshot.SnapshotWriter) SnapshotReader(com.alipay.sofa.jraft.storage.snapshot.SnapshotReader) EventFactory(com.lmax.disruptor.EventFactory) RaftException(com.alipay.sofa.jraft.error.RaftException) Requires(com.alipay.sofa.jraft.util.Requires) Disruptor(com.lmax.disruptor.dsl.Disruptor) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList) CountDownLatch(java.util.concurrent.CountDownLatch)

Aggregations

Closure (com.alipay.sofa.jraft.Closure)1 FSMCaller (com.alipay.sofa.jraft.FSMCaller)1 StateMachine (com.alipay.sofa.jraft.StateMachine)1 Status (com.alipay.sofa.jraft.Status)1 ClosureQueue (com.alipay.sofa.jraft.closure.ClosureQueue)1 LoadSnapshotClosure (com.alipay.sofa.jraft.closure.LoadSnapshotClosure)1 SaveSnapshotClosure (com.alipay.sofa.jraft.closure.SaveSnapshotClosure)1 TaskClosure (com.alipay.sofa.jraft.closure.TaskClosure)1 Configuration (com.alipay.sofa.jraft.conf.Configuration)1 ConfigurationEntry (com.alipay.sofa.jraft.conf.ConfigurationEntry)1 EnumOutter (com.alipay.sofa.jraft.entity.EnumOutter)1 LeaderChangeContext (com.alipay.sofa.jraft.entity.LeaderChangeContext)1 LogEntry (com.alipay.sofa.jraft.entity.LogEntry)1 LogId (com.alipay.sofa.jraft.entity.LogId)1 PeerId (com.alipay.sofa.jraft.entity.PeerId)1 RaftOutter (com.alipay.sofa.jraft.entity.RaftOutter)1 RaftError (com.alipay.sofa.jraft.error.RaftError)1 RaftException (com.alipay.sofa.jraft.error.RaftException)1 FSMCallerOptions (com.alipay.sofa.jraft.option.FSMCallerOptions)1 LogManager (com.alipay.sofa.jraft.storage.LogManager)1