@ThreadSafe public class Replicator extends Object implements ThreadId.OnError
| 限定符和类型 | 类和说明 |
|---|---|
static interface |
Replicator.ReplicatorStateListener
User can implement the ReplicatorStateListener interface by themselves.
|
static class |
Replicator.State
Replicator internal state
|
| 限定符和类型 | 字段和说明 |
|---|---|
protected ThreadId |
id |
protected com.alipay.sofa.jraft.core.Replicator.Stat |
statInfo |
| 构造器和说明 |
|---|
Replicator(ReplicatorOptions replicatorOptions,
RaftOptions raftOptions) |
| 限定符和类型 | 方法和说明 |
|---|---|
static long |
getLastRpcSendTimestamp(ThreadId id) |
static long |
getNextIndex(ThreadId id) |
PriorityQueue<com.alipay.sofa.jraft.core.Replicator.RpcResponse> |
getPendingResponses() |
static boolean |
join(ThreadId id) |
void |
onError(ThreadId id,
Object data,
int errorCode)
Error callback, it will be called in lock, but should take care of unlocking it.
|
static void |
sendHeartbeat(ThreadId id,
RpcResponseClosure<RpcRequests.AppendEntriesResponse> closure) |
static boolean |
sendTimeoutNowAndStop(ThreadId id,
int timeoutMs) |
static ThreadId |
start(ReplicatorOptions opts,
RaftOptions raftOptions) |
static boolean |
stop(ThreadId id) |
static boolean |
stopTransferLeadership(ThreadId id) |
String |
toString() |
static boolean |
transferLeadership(ThreadId id,
long logIndex) |
static void |
waitForCaughtUp(ThreadId id,
long maxMargin,
long dueTime,
CatchUpClosure done) |
protected com.alipay.sofa.jraft.core.Replicator.Stat statInfo
protected ThreadId id
public Replicator(ReplicatorOptions replicatorOptions, RaftOptions raftOptions)
@OnlyForTest public PriorityQueue<com.alipay.sofa.jraft.core.Replicator.RpcResponse> getPendingResponses()
public static ThreadId start(ReplicatorOptions opts, RaftOptions raftOptions)
public static void waitForCaughtUp(ThreadId id, long maxMargin, long dueTime, CatchUpClosure done)
public void onError(ThreadId id, Object data, int errorCode)
ThreadId.OnErroronError 在接口中 ThreadId.OnErrorid - the thread iddata - the dataerrorCode - the error codepublic static void sendHeartbeat(ThreadId id, RpcResponseClosure<RpcRequests.AppendEntriesResponse> closure)
public static boolean stop(ThreadId id)
public static boolean join(ThreadId id)
public static long getLastRpcSendTimestamp(ThreadId id)
public static boolean transferLeadership(ThreadId id, long logIndex)
public static boolean stopTransferLeadership(ThreadId id)
public static boolean sendTimeoutNowAndStop(ThreadId id, int timeoutMs)
public static long getNextIndex(ThreadId id)
Copyright © 2021. All rights reserved.