X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsamples%2Fclustering-test-app%2Fprovider%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fclustering%2Fit%2Fprovider%2Fimpl%2FProduceTransactionsHandler.java;h=232391209b506d076fe202641a3e4fcdcdf1b004;hb=0cb5ce07fc959deed2e7887ed22dfde81cb2c9a2;hp=99e48b2980975c5d281c5c4a23fbcb7a4a6fdb23;hpb=aea716f562ae010af4687812fab27af03f8a2a26;p=controller.git diff --git a/opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/impl/ProduceTransactionsHandler.java b/opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/impl/ProduceTransactionsHandler.java index 99e48b2980..232391209b 100644 --- a/opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/impl/ProduceTransactionsHandler.java +++ b/opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/impl/ProduceTransactionsHandler.java @@ -5,10 +5,10 @@ * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ - package org.opendaylight.controller.clustering.it.provider.impl; -import com.google.common.base.Preconditions; +import static java.util.Objects.requireNonNull; + import com.google.common.util.concurrent.FluentFuture; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; @@ -58,8 +58,8 @@ public final class ProduceTransactionsHandler extends AbstractTransactionHandler private ProduceTransactionsHandler(final DOMDataTreeProducer producer, final DOMDataTreeIdentifier idListItem, final ProduceTransactionsInput input) { super(input); - this.itemProducer = Preconditions.checkNotNull(producer); - this.idListItem = Preconditions.checkNotNull(idListItem); + this.itemProducer = requireNonNull(producer); + this.idListItem = requireNonNull(idListItem); } public static ListenableFuture> start( @@ -67,7 +67,7 @@ public final class ProduceTransactionsHandler extends AbstractTransactionHandler final String id = input.getId(); LOG.debug("Filling the item list {} with initial values.", id); - final YangInstanceIdentifier idListWithKey = ID_INT_YID.node(new NodeIdentifierWithPredicates(ID_INT, ID, id)); + final YangInstanceIdentifier idListWithKey = ID_INT_YID.node(NodeIdentifierWithPredicates.of(ID_INT, ID, id)); final DOMDataTreeProducer itemProducer = domDataTreeService.createProducer( Collections.singleton(new DOMDataTreeIdentifier(LogicalDatastoreType.CONFIGURATION, idListWithKey))); @@ -112,7 +112,7 @@ public final class ProduceTransactionsHandler extends AbstractTransactionHandler final DOMDataTreeCursorAwareTransaction tx = itemProducer.createTransaction(false); final DOMDataTreeWriteCursor cursor = tx.createCursor(idListItem); - final NodeIdentifierWithPredicates entryId = new NodeIdentifierWithPredicates(ITEM, NUMBER, i); + final NodeIdentifierWithPredicates entryId = NodeIdentifierWithPredicates.of(ITEM, NUMBER, i); if (usedValues.contains(i)) { LOG.debug("Deleting item: {}", i); deleteTx++; @@ -135,10 +135,10 @@ public final class ProduceTransactionsHandler extends AbstractTransactionHandler } @Override - void runFailed(final Throwable cause) { + void runFailed(final Throwable cause, final long txId) { closeProducer(itemProducer); future.set(RpcResultBuilder.failed() - .withError(RpcError.ErrorType.APPLICATION, "Submit failed", cause).build()); + .withError(RpcError.ErrorType.APPLICATION, "Commit failed for tx # " + txId, cause).build()); } @Override @@ -154,10 +154,9 @@ public final class ProduceTransactionsHandler extends AbstractTransactionHandler } @Override - void runTimedOut(final Exception cause) { + void runTimedOut(final String cause) { closeProducer(itemProducer); future.set(RpcResultBuilder.failed() - .withError(RpcError.ErrorType.APPLICATION, - "Final submit was timed out by the test provider or was interrupted", cause).build()); + .withError(RpcError.ErrorType.APPLICATION, cause).build()); } }