import com.google.common.base.MoreObjects;
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
-import com.google.common.base.Throwables;
import com.google.common.base.Verify;
import com.google.common.collect.Iterables;
import com.google.common.util.concurrent.CheckedFuture;
import org.opendaylight.controller.cluster.access.commands.AbstractLocalTransactionRequest;
import org.opendaylight.controller.cluster.access.commands.ClosedTransactionException;
import org.opendaylight.controller.cluster.access.commands.IncrementTransactionSequenceRequest;
+import org.opendaylight.controller.cluster.access.commands.ModifyTransactionRequest;
import org.opendaylight.controller.cluster.access.commands.TransactionAbortRequest;
import org.opendaylight.controller.cluster.access.commands.TransactionAbortSuccess;
import org.opendaylight.controller.cluster.access.commands.TransactionCanCommitSuccess;
latch.await();
} catch (InterruptedException e) {
LOG.warn("Interrupted while waiting for latch of {}", successor);
- throw Throwables.propagate(e);
+ throw new RuntimeException(e);
}
return successor;
}
// At this point the successor has completed transition and is possibly visible by the user thread, which is
// still stuck here. The successor has not seen final part of our state, nor the fact it is sealed.
// Propagate state and seal the successor.
- flushState(successor);
+ final java.util.Optional<ModifyTransactionRequest> optState = flushState();
+ if (optState.isPresent()) {
+ forwardToSuccessor(successor, optState.get(), null);
+ }
successor.predecessorSealed();
}
void sealOnly() {
parent.onTransactionSealed(this);
final boolean success = STATE_UPDATER.compareAndSet(this, OPEN, SEALED);
- Verify.verify(success, "Attempted to replay seal on {}", this);
+ Verify.verify(success, "Attempted to replay seal on %s", this);
}
/**
*/
if (SEALED.equals(prevState)) {
LOG.debug("Proxy {} reconnected while being sealed, propagating state to successor {}", this, successor);
- flushState(successor);
+ final long enqueuedTicks = parent.currentTime();
+ final java.util.Optional<ModifyTransactionRequest> optState = flushState();
+ if (optState.isPresent()) {
+ successor.handleReplayedRemoteRequest(optState.get(), null, enqueuedTicks);
+ }
if (successor.markSealed()) {
- successor.sealAndSend(Optional.of(parent.currentTime()));
+ successor.sealAndSend(Optional.of(enqueuedTicks));
}
}
}
abstract CheckedFuture<Optional<NormalizedNode<?, ?>>, ReadFailedException> doRead(YangInstanceIdentifier path);
@GuardedBy("this")
- abstract void flushState(AbstractProxyTransaction successor);
+ abstract java.util.Optional<ModifyTransactionRequest> flushState();
abstract TransactionRequest<?> abortRequest();