package org.opendaylight.dsbenchmark.txchain;
import com.google.common.util.concurrent.FutureCallback;
-import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.MoreExecutors;
+import java.util.concurrent.ExecutionException;
import org.opendaylight.controller.md.sal.binding.api.BindingTransactionChain;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.controller.md.sal.common.api.data.TransactionChain;
import org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener;
-import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
import org.opendaylight.dsbenchmark.DatastoreAbstractWriter;
+import org.opendaylight.mdsal.common.api.CommitInfo;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.StartTestInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.StartTestInput.DataStore;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.TestExec;
final long writesPerTx, final DataStore dataStore) {
super(StartTestInput.Operation.DELETE, outerListElem, innerListElem, writesPerTx, dataStore);
this.bindingDataBroker = bindingDataBroker;
- LOG.info("Created TxchainBaDelete");
+ LOG.debug("Created TxchainBaDelete");
}
@Override
public void createList() {
- LOG.info("TxchainBaDelete: creating data in the data store");
+ LOG.debug("TxchainBaDelete: creating data in the data store");
// Dump the whole list into the data store in a single transaction
// with <outerListElem> PUTs on the transaction
if (writeCnt == writesPerTx) {
txSubmitted++;
- Futures.addCallback(tx.submit(), new FutureCallback<Void>() {
+ tx.commit().addCallback(new FutureCallback<CommitInfo>() {
@Override
- public void onSuccess(final Void result) {
+ public void onSuccess(final CommitInfo result) {
txOk++;
}
LOG.error("Transaction failed, {}", t);
txError++;
}
- });
+ }, MoreExecutors.directExecutor());
tx = chain.newWriteOnlyTransaction();
writeCnt = 0;
}
if (writeCnt > 0) {
txSubmitted++;
}
- tx.submit().checkedGet();
- } catch (TransactionCommitFailedException e) {
+ tx.commit().get();
+ } catch (final InterruptedException | ExecutionException e) {
LOG.error("Transaction failed", e);
}
try {
chain.close();
- } catch (IllegalStateException e) {
+ } catch (final IllegalStateException e) {
LOG.error("Transaction close failed,", e);
}
- LOG.info("Transactions: submitted {}, completed {}", txSubmitted, (txOk + txError));
+ LOG.debug("Transactions: submitted {}, completed {}", txSubmitted, txOk + txError);
}
@Override
@Override
public void onTransactionChainSuccessful(final TransactionChain<?, ?> chain) {
- LOG.info("TxchainBaDelete closed successfully, chain {}", chain);
+ LOG.debug("TxchainBaDelete closed successfully, chain {}", chain);
}
}