Search in sources :

Example 1 with ServerNotReadyException

use of org.apache.ratis.protocol.exceptions.ServerNotReadyException in project incubator-ratis by apache.

the class RaftServerImpl method preAppendEntriesAsync.

private void preAppendEntriesAsync(RaftPeerId leaderId, RaftGroupId leaderGroupId, long leaderTerm, TermIndex previous, long leaderCommit, boolean initializing, LogEntryProto... entries) throws IOException {
    CodeInjectionForTesting.execute(APPEND_ENTRIES, getId(), leaderId, leaderTerm, previous, leaderCommit, initializing, entries);
    assertLifeCycleState(LifeCycle.States.STARTING_OR_RUNNING);
    if (!startComplete.get()) {
        throw new ServerNotReadyException(getMemberId() + ": The server role is not yet initialized.");
    }
    assertGroup(leaderId, leaderGroupId);
    try {
        validateEntries(leaderTerm, previous, entries);
    } catch (IllegalArgumentException e) {
        throw new IOException(e);
    }
}
Also used : RaftLogIOException(org.apache.ratis.server.raftlog.RaftLogIOException) IOException(java.io.IOException) ServerNotReadyException(org.apache.ratis.protocol.exceptions.ServerNotReadyException)

Aggregations

IOException (java.io.IOException)1 ServerNotReadyException (org.apache.ratis.protocol.exceptions.ServerNotReadyException)1 RaftLogIOException (org.apache.ratis.server.raftlog.RaftLogIOException)1