* 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;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@Deprecated(forRemoval = true)
public final class ProduceTransactionsHandler extends AbstractTransactionHandler {
private static final Logger LOG = LoggerFactory.getLogger(ProduceTransactionsHandler.class);
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<RpcResult<ProduceTransactionsOutput>> start(
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)));
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++;
}
@Override
- void runFailed(final Throwable cause) {
+ void runFailed(final Throwable cause, final long txId) {
closeProducer(itemProducer);
future.set(RpcResultBuilder.<ProduceTransactionsOutput>failed()
- .withError(RpcError.ErrorType.APPLICATION, "Submit failed", cause).build());
+ .withError(RpcError.ErrorType.APPLICATION, "Commit failed for tx # " + txId, cause).build());
}
@Override
}
@Override
- void runTimedOut(final Exception cause) {
+ void runTimedOut(final String cause) {
closeProducer(itemProducer);
future.set(RpcResultBuilder.<ProduceTransactionsOutput>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());
}
}