import akka.actor.ActorSelection;
import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Function;
-import com.google.common.base.Supplier;
import com.google.common.collect.Iterables;
import com.google.common.util.concurrent.FluentFuture;
import com.google.common.util.concurrent.Futures;
final Collection<FluentFuture<Optional<NormalizedNode<?, ?>>>> futures = new ArrayList<>(allShardNames.size());
for (String shardName : allShardNames) {
- futures.add(singleShardRead(shardName, YangInstanceIdentifier.EMPTY));
+ futures.add(singleShardRead(shardName, YangInstanceIdentifier.empty()));
}
final ListenableFuture<List<Optional<NormalizedNode<?, ?>>>> listFuture = Futures.allAsList(futures);
final ListenableFuture<Optional<NormalizedNode<?, ?>>> aggregateFuture;
- aggregateFuture = Futures.transform(listFuture,
- (Function<List<Optional<NormalizedNode<?, ?>>>, Optional<NormalizedNode<?, ?>>>) input -> {
- try {
- return NormalizedNodeAggregator.aggregate(YangInstanceIdentifier.EMPTY, input,
- txContextFactory.getActorUtils().getSchemaContext(),
- txContextFactory.getActorUtils().getDatastoreContext().getLogicalStoreType());
- } catch (DataValidationFailedException e) {
- throw new IllegalArgumentException("Failed to aggregate", e);
- }
- }, MoreExecutors.directExecutor());
+ aggregateFuture = Futures.transform(listFuture, input -> {
+ try {
+ return NormalizedNodeAggregator.aggregate(YangInstanceIdentifier.empty(), input,
+ txContextFactory.getActorUtils().getSchemaContext(),
+ txContextFactory.getActorUtils().getDatastoreContext().getLogicalStoreType());
+ } catch (DataValidationFailedException e) {
+ throw new IllegalArgumentException("Failed to aggregate", e);
+ }
+ }, MoreExecutors.directExecutor());
return FluentFuture.from(aggregateFuture);
}
// The remote tx version is obtained the via TransactionContext which may not be available yet so
// we pass a Supplier to dynamically obtain it. Once the ready Future is resolved the
// TransactionContext is available.
- Supplier<Short> txVersionSupplier = () -> wrapper.getTransactionContext().getTransactionVersion();
-
cohorts.add(new ThreePhaseCommitCohortProxy.CohortInfo(wrapper.readyTransaction(shardNames),
- txVersionSupplier));
+ () -> wrapper.getTransactionContext().getTransactionVersion()));
}
return new ThreePhaseCommitCohortProxy(txContextFactory.getActorUtils(), cohorts, getIdentifier());