Search in sources :

Example 1 with OnlyForTest

use of io.dingodb.raft.util.OnlyForTest in project dingo by dingodb.

the class FSMCallerImpl method flush.

/**
 * Flush all events in disruptor.
 */
@OnlyForTest
void flush() throws InterruptedException {
    final CountDownLatch latch = new CountDownLatch(1);
    enqueueTask((task, sequence) -> {
        task.type = TaskType.FLUSH;
        task.shutdownLatch = latch;
    });
    latch.await();
}
Also used : CountDownLatch(java.util.concurrent.CountDownLatch) OnlyForTest(io.dingodb.raft.util.OnlyForTest)

Example 2 with OnlyForTest

use of io.dingodb.raft.util.OnlyForTest in project dingo by dingodb.

the class ReadOnlyServiceImpl method flush.

/**
 * Flush all events in disruptor.
 */
@OnlyForTest
void flush() throws InterruptedException {
    final CountDownLatch latch = new CountDownLatch(1);
    this.readIndexQueue.publishEvent((task, sequence) -> task.shutdownLatch = latch);
    latch.await();
}
Also used : CountDownLatch(java.util.concurrent.CountDownLatch) OnlyForTest(io.dingodb.raft.util.OnlyForTest)

Aggregations

OnlyForTest (io.dingodb.raft.util.OnlyForTest)2 CountDownLatch (java.util.concurrent.CountDownLatch)2