@Override
public WaveletDeltaRecord submitRequest(WaveletName waveletName, ProtocolSignedDelta signedDelta)
throws OperationException, InvalidProtocolBufferException, InvalidHashException,
PersistenceException, WaveletStateException {
awaitLoad();
acquireWriteLock();
try {
checkStateOk();
HashedVersion before = getCurrentVersion();
WaveletDeltaRecord result = transformAndApplyLocalDelta(signedDelta);
HashedVersion after = getCurrentVersion();
if (!after.equals(before)) {
Preconditions.checkState(!result.isEmpty());
Preconditions.checkState(result.getAppliedAtVersion().equals(before));
ImmutableSet<String> domainsToNotify = domainsOf(Iterables.concat(
accessSnapshot().getParticipants(),
participantsRemovedBy(result.getTransformedDelta())));
notifyOfDeltas(ImmutableList.of(result), domainsToNotify);
persist(result.getResultingVersion(), domainsToNotify);
}
return result;
} finally {
releaseWriteLock();
}
}