import com.google.common.primitives.UnsignedLong;
import com.google.common.util.concurrent.FutureCallback;
import java.util.Collection;
import com.google.common.primitives.UnsignedLong;
import com.google.common.util.concurrent.FutureCallback;
import java.util.Collection;
import org.opendaylight.controller.cluster.access.commands.AbortLocalTransactionRequest;
import org.opendaylight.controller.cluster.access.commands.CommitLocalTransactionRequest;
import org.opendaylight.controller.cluster.access.commands.ExistsTransactionRequest;
import org.opendaylight.controller.cluster.access.commands.AbortLocalTransactionRequest;
import org.opendaylight.controller.cluster.access.commands.CommitLocalTransactionRequest;
import org.opendaylight.controller.cluster.access.commands.ExistsTransactionRequest;
import org.opendaylight.controller.cluster.access.concepts.RuntimeRequestException;
import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
import org.opendaylight.controller.cluster.access.concepts.UnsupportedRequestException;
import org.opendaylight.controller.cluster.access.concepts.RuntimeRequestException;
import org.opendaylight.controller.cluster.access.concepts.TransactionIdentifier;
import org.opendaylight.controller.cluster.access.concepts.UnsupportedRequestException;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
+import org.opendaylight.yangtools.yang.data.tree.api.DataTreeCandidate;
+import org.opendaylight.yangtools.yang.data.tree.api.DataTreeModification;
final ReadWriteShardDataTreeTransaction openTransaction;
Open(final ReadWriteShardDataTreeTransaction openTransaction) {
final ReadWriteShardDataTreeTransaction openTransaction;
Open(final ReadWriteShardDataTreeTransaction openTransaction) {
final DataTreeModification sealedModification;
Sealed(final DataTreeModification sealedModification) {
final DataTreeModification sealedModification;
Sealed(final DataTreeModification sealedModification) {
private FrontendReadWriteTransaction(final AbstractFrontendHistory history, final TransactionIdentifier id,
final ReadWriteShardDataTreeTransaction transaction) {
super(history, id);
private FrontendReadWriteTransaction(final AbstractFrontendHistory history, final TransactionIdentifier id,
final ReadWriteShardDataTreeTransaction transaction) {
super(history, id);
}
private FrontendReadWriteTransaction(final AbstractFrontendHistory history, final TransactionIdentifier id,
final DataTreeModification mod) {
super(history, id);
}
private FrontendReadWriteTransaction(final AbstractFrontendHistory history, final TransactionIdentifier id,
final DataTreeModification mod) {
super(history, id);
- @Nullable TransactionSuccess<?> doHandleRequest(final TransactionRequest<?> request, final RequestEnvelope envelope,
+ TransactionSuccess<?> doHandleRequest(final TransactionRequest<?> request, final RequestEnvelope envelope,
final long now) throws RequestException {
if (request instanceof ModifyTransactionRequest) {
return handleModifyTransaction((ModifyTransactionRequest) request, envelope, now);
final long now) throws RequestException {
if (request instanceof ModifyTransactionRequest) {
return handleModifyTransaction((ModifyTransactionRequest) request, envelope, now);
recordAndSendSuccess(envelope, now, new TransactionAbortSuccess(getIdentifier(), sequence));
finishAbort();
}
recordAndSendSuccess(envelope, now, new TransactionAbortSuccess(getIdentifier(), sequence));
finishAbort();
}
case READY:
ready.stage = CommitStage.CAN_COMMIT_PENDING;
LOG.debug("{}: Transaction {} initiating canCommit", persistenceId(), getIdentifier());
case READY:
ready.stage = CommitStage.CAN_COMMIT_PENDING;
LOG.debug("{}: Transaction {} initiating canCommit", persistenceId(), getIdentifier());
case READY:
ready.stage = CommitStage.CAN_COMMIT_PENDING;
LOG.debug("{}: Transaction {} initiating direct canCommit", persistenceId(), getIdentifier());
case READY:
ready.stage = CommitStage.CAN_COMMIT_PENDING;
LOG.debug("{}: Transaction {} initiating direct canCommit", persistenceId(), getIdentifier());
if (optFailure.isPresent()) {
state = new Ready(history().createFailedCohort(getIdentifier(), sealedModification, optFailure.get()));
} else {
if (optFailure.isPresent()) {
state = new Ready(history().createFailedCohort(getIdentifier(), sealedModification, optFailure.get()));
} else {
- private ExistsTransactionSuccess handleExistsTransaction(final ExistsTransactionRequest request)
- throws RequestException {
- final Optional<NormalizedNode<?, ?>> data = checkOpen().getSnapshot().readNode(request.getPath());
+ private ExistsTransactionSuccess handleExistsTransaction(final ExistsTransactionRequest request) {
+ final Optional<NormalizedNode> data = checkOpen().getSnapshot().readNode(request.getPath());
return recordSuccess(request.getSequence(), new ExistsTransactionSuccess(getIdentifier(), request.getSequence(),
data.isPresent()));
}
return recordSuccess(request.getSequence(), new ExistsTransactionSuccess(getIdentifier(), request.getSequence(),
data.isPresent()));
}
- private ReadTransactionSuccess handleReadTransaction(final ReadTransactionRequest request)
- throws RequestException {
- final Optional<NormalizedNode<?, ?>> data = checkOpen().getSnapshot().readNode(request.getPath());
+ private ReadTransactionSuccess handleReadTransaction(final ReadTransactionRequest request) {
+ final Optional<NormalizedNode> data = checkOpen().getSnapshot().readNode(request.getPath());
return recordSuccess(request.getSequence(), new ReadTransactionSuccess(getIdentifier(), request.getSequence(),
data));
}
return recordSuccess(request.getSequence(), new ReadTransactionSuccess(getIdentifier(), request.getSequence(),
data));
}
final RequestEnvelope envelope, final long now) throws RequestException {
// We need to examine the persistence protocol first to see if this is an idempotent request. If there is no
// protocol, there is nothing for us to do.
final RequestEnvelope envelope, final long now) throws RequestException {
// We need to examine the persistence protocol first to see if this is an idempotent request. If there is no
// protocol, there is nothing for us to do.
if (!maybeProto.isPresent()) {
applyModifications(request.getModifications());
return replyModifySuccess(request.getSequence());
if (!maybeProto.isPresent()) {
applyModifications(request.getModifications());
return replyModifySuccess(request.getSequence());
- Preconditions.checkState(state instanceof Open, "%s expect to be open, is in state %s", getIdentifier(),
- state);
+ checkState(state instanceof Open, "%s expect to be open, is in state %s", getIdentifier(), state);
- Preconditions.checkState(state instanceof Ready, "%s expect to be ready, is in state %s", getIdentifier(),
- state);
+ checkState(state instanceof Ready, "%s expect to be ready, is in state %s", getIdentifier(), state);
- Preconditions.checkState(state instanceof Sealed, "%s expect to be sealed, is in state %s", getIdentifier(),
- state);
+ checkState(state instanceof Sealed, "%s expect to be sealed, is in state %s", getIdentifier(), state);