import static com.google.common.base.Verify.verifyNotNull;
import com.google.common.util.concurrent.FluentFuture;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.util.Optional;
import java.util.OptionalLong;
import java.util.function.BiConsumer;
final DataTreeSnapshot snapshot) {
super(parent, identifier, false);
- if (snapshot instanceof FailedDataTreeModification) {
- final var failed = (FailedDataTreeModification) snapshot;
+ if (snapshot instanceof FailedDataTreeModification failed) {
recordedFailure = failed.cause();
modification = failed;
} else {
} catch (Exception e) {
LOG.debug("Failed to instantiate modification for {}", identifier, e);
recordedFailure = e;
- mod = new FailedDataTreeModification(snapshot.getEffectiveModelContext(), e);
+ mod = new FailedDataTreeModification(snapshot.modelContext(), e);
}
modification = mod;
}
sealOnly();
}
- switch (maybeProtocol.get()) {
+ switch (maybeProtocol.orElseThrow()) {
case ABORT:
sendMethod.accept(new AbortLocalTransactionRequest(getIdentifier(), localActor()), cb);
break;
sendMethod.accept(commitRequest(true), cb);
break;
default:
- throw new IllegalArgumentException("Unhandled protocol " + maybeProtocol.get());
+ throw new IllegalArgumentException("Unhandled protocol " + maybeProtocol.orElseThrow());
}
}
}
closedException = this::abortedException;
}
+ @SuppressFBWarnings(value = "THROWS_METHOD_THROWS_RUNTIMEEXCEPTION", justification = "Replay of recorded failure")
private @NonNull CursorAwareDataTreeModification getModification() {
if (closedException != null) {
throw closedException.get();