package org.opendaylight.dsbenchmark.simpletx;
import java.util.List;
-
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
-import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
-import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
+import java.util.concurrent.ExecutionException;
import org.opendaylight.dsbenchmark.DatastoreAbstractWriter;
import org.opendaylight.dsbenchmark.DomListBuilder;
+import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
+import org.opendaylight.mdsal.dom.api.DOMDataBroker;
+import org.opendaylight.mdsal.dom.api.DOMDataTreeWriteTransaction;
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;
private final DOMDataBroker domDataBroker;
private List<MapEntryNode> list;
- public SimpletxDomWrite(DOMDataBroker domDataBroker, StartTestInput.Operation oper,
- int outerListElem, int innerListElem, long putsPerTx, DataStore dataStore ) {
+ public SimpletxDomWrite(final DOMDataBroker domDataBroker, final StartTestInput.Operation oper,
+ final int outerListElem, final int innerListElem, final long putsPerTx, final DataStore dataStore) {
super(oper, outerListElem, innerListElem, putsPerTx, dataStore);
this.domDataBroker = domDataBroker;
- LOG.info("Created SimpletxDomWrite");
+ LOG.debug("Created SimpletxDomWrite");
}
@Override
@Override
public void executeList() {
- DOMDataWriteTransaction tx = domDataBroker.newWriteOnlyTransaction();
- LogicalDatastoreType dsType = getDataStoreType();
+ final LogicalDatastoreType dsType = getDataStoreType();
+ final YangInstanceIdentifier pid =
+ YangInstanceIdentifier.builder().node(TestExec.QNAME).node(OuterList.QNAME).build();
+
+ DOMDataTreeWriteTransaction tx = domDataBroker.newWriteOnlyTransaction();
long writeCnt = 0;
- YangInstanceIdentifier pid =
- YangInstanceIdentifier.builder().node(TestExec.QNAME).node(OuterList.QNAME).build();
for (MapEntryNode element : this.list) {
YangInstanceIdentifier yid =
- pid.node(new NodeIdentifierWithPredicates(OuterList.QNAME, element.getIdentifier().getKeyValues()));
+ pid.node(NodeIdentifierWithPredicates.of(OuterList.QNAME, element.getIdentifier().asMap()));
if (oper == StartTestInput.Operation.PUT) {
tx.put(dsType, yid, element);
if (writeCnt == writesPerTx) {
try {
- tx.submit().checkedGet();
+ tx.commit().get();
txOk++;
- } catch (TransactionCommitFailedException e) {
+ } catch (final InterruptedException | ExecutionException e) {
LOG.error("Transaction failed", e);
txError++;
}
tx = domDataBroker.newWriteOnlyTransaction();
- dsType = getDataStoreType();
writeCnt = 0;
}
}
if (writeCnt != 0) {
try {
- tx.submit().checkedGet();
- } catch (TransactionCommitFailedException e) {
+ tx.commit().get();
+ } catch (final InterruptedException | ExecutionException e) {
LOG.error("Transaction failed", e);
}
}
-
}
-
}