use of org.apache.ratis.server.storage.RaftLogIOException in project incubator-ratis by apache.
the class GRpcLogAppender method run.
@Override
public void run() {
while (isAppenderRunning()) {
if (shouldSendRequest()) {
SnapshotInfo snapshot = shouldInstallSnapshot();
if (snapshot != null) {
installSnapshot(snapshot, snapshotResponseHandler);
} else {
// keep appending log entries or sending heartbeats
try {
appendLog();
} catch (RaftLogIOException e) {
LOG.error(this + " hit IOException while loading raft log", e);
stopSender();
}
}
}
if (isAppenderRunning() && !shouldSendRequest()) {
// use lastSend time instead of lastResponse time
final long waitTime = getHeartbeatRemainingTime(follower.getLastRpcTime());
if (waitTime > 0) {
synchronized (this) {
try {
LOG.debug("{} decides to wait {}ms before appending to {}", server.getId(), waitTime, follower.getPeer());
wait(waitTime);
} catch (InterruptedException ignored) {
}
}
}
}
}
appendLogRequestObserver.onCompleted();
}
Aggregations