in accord-core/src/main/java/accord/messages/ReadTxnData.java [145:190]
protected synchronized ReadNack apply(SafeCommandStore safeStore, SafeCommand safeCommand)
{
if (state != State.PENDING)
return null;
Command command = safeCommand.current();
Status status = command.status();
logger.trace("{}: setting up read with status {} on {}", txnId, status, safeStore);
switch (status) {
default:
throw new AssertionError();
case Committed:
case NotWitnessed:
case PreAccepted:
case Accepted:
case AcceptedInvalidate:
case PreCommitted:
waitingOn.set(safeStore.commandStore().id());
++waitingOnCount;
safeCommand.addListener(this);
if (status == Committed)
{
return null;
}
else
{
safeStore.progressLog().waiting(txnId, Committed.minKnown, readScope.toUnseekables());
return NotCommitted;
}
case PreApplied:
case Applied:
case Invalidated:
state = State.OBSOLETE;
return Redundant;
case ReadyToExecute:
waitingOn.set(safeStore.commandStore().id());
++waitingOnCount;
maybeRead(safeStore, safeCommand);
return null;
}
}