+abstract class SimpleShardDataTreeCohort extends ShardDataTreeCohort {
+ static final class DeadOnArrival extends SimpleShardDataTreeCohort {
+ private final Exception failure;
+
+ DeadOnArrival(final ShardDataTree dataTree, final DataTreeModification transaction,
+ final TransactionIdentifier transactionId, final Exception failure) {
+ super(dataTree, transaction, transactionId, null);
+ this.failure = Preconditions.checkNotNull(failure);
+ }
+
+ @Override
+ void throwCanCommitFailure() throws Exception {
+ throw failure;
+ }
+ }
+
+ static final class Normal extends SimpleShardDataTreeCohort {
+ Normal(final ShardDataTree dataTree, final DataTreeModification transaction,
+ final TransactionIdentifier transactionId, final CompositeDataTreeCohort userCohorts) {
+ super(dataTree, transaction, transactionId, Preconditions.checkNotNull(userCohorts));
+ }
+
+ @Override
+ void throwCanCommitFailure() {
+ // No-op
+ }
+ }
+