*/
package org.opendaylight.controller.cluster.datastore;
-import akka.actor.ActorSelection;
import akka.dispatch.OnComplete;
import java.util.List;
+import org.opendaylight.controller.cluster.datastore.messages.PrimaryShardInfo;
import org.opendaylight.controller.cluster.datastore.utils.ActorContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Stores the ready Futures from the previous Tx in the chain.
*/
- private final List<Future<ActorSelection>> previousReadyFutures;
+ private final List<Future<Object>> previousReadyFutures;
/**
* Stores the ready Futures from this transaction when it is readied.
*/
- private volatile List<Future<ActorSelection>> readyFutures;
+ private volatile List<Future<Object>> readyFutures;
ChainedTransactionProxy(ActorContext actorContext, TransactionType transactionType,
- String transactionChainId, List<Future<ActorSelection>> previousReadyFutures) {
+ String transactionChainId, List<Future<Object>> previousReadyFutures) {
super(actorContext, transactionType, transactionChainId);
this.previousReadyFutures = previousReadyFutures;
}
- List<Future<ActorSelection>> getReadyFutures() {
+ List<Future<Object>> getReadyFutures() {
return readyFutures;
}
return readyFutures != null;
}
+ @SuppressWarnings({ "unchecked", "rawtypes" })
@Override
- public AbstractThreePhaseCommitCohort ready() {
- final AbstractThreePhaseCommitCohort ret = super.ready();
- readyFutures = ret.getCohortFutures();
+ public AbstractThreePhaseCommitCohort<?> ready() {
+ final AbstractThreePhaseCommitCohort<?> ret = super.ready();
+ readyFutures = (List)ret.getCohortFutures();
LOG.debug("onTransactionReady {} pending readyFutures size {} chain {}", getIdentifier(),
readyFutures.size(), getTransactionChainId());
return ret;
* previous Tx's ready operations haven't completed yet.
*/
@Override
- protected Future<ActorSelection> sendFindPrimaryShardAsync(final String shardName) {
+ protected Future<PrimaryShardInfo> sendFindPrimaryShardAsync(final String shardName) {
// Check if there are any previous ready Futures, otherwise let the super class handle it.
if(previousReadyFutures.isEmpty()) {
return super.sendFindPrimaryShardAsync(shardName);
}
// Combine the ready Futures into 1.
- Future<Iterable<ActorSelection>> combinedFutures = akka.dispatch.Futures.sequence(
+ Future<Iterable<Object>> combinedFutures = akka.dispatch.Futures.sequence(
previousReadyFutures, getActorContext().getClientDispatcher());
// Add a callback for completion of the combined Futures.
- final Promise<ActorSelection> returnPromise = akka.dispatch.Futures.promise();
- OnComplete<Iterable<ActorSelection>> onComplete = new OnComplete<Iterable<ActorSelection>>() {
+ final Promise<PrimaryShardInfo> returnPromise = akka.dispatch.Futures.promise();
+ OnComplete<Iterable<Object>> onComplete = new OnComplete<Iterable<Object>>() {
@Override
- public void onComplete(Throwable failure, Iterable<ActorSelection> notUsed) {
+ public void onComplete(Throwable failure, Iterable<Object> notUsed) {
if(failure != null) {
// A Ready Future failed so fail the returned Promise.
returnPromise.failure(failure);