- testThread = new Thread() {
- @Override
- public void run() {
- sw.start();
- AtomicLong count = new AtomicLong();
- while(!stopThread) {
- long id = count.incrementAndGet();
- WriteTransaction tx = dataProvider.newWriteOnlyTransaction();
- CarEntry car = new CarEntryBuilder().setId(new CarId("car"+id)).build();
- tx.put(LogicalDatastoreType.CONFIGURATION,
- InstanceIdentifier.<Cars>builder(Cars.class).child(CarEntry.class, car.getKey()).build(),
- car);
- CheckedFuture<Void, TransactionCommitFailedException> future = tx.submit();
- Futures.addCallback(future, new FutureCallback<Void>() {
-
- @Override
- public void onSuccess(final Void result) {
- // Transaction succeeded
- succcessCounter.getAndIncrement();
- }
-
- @Override
- public void onFailure(final Throwable t) {
- // Transaction failed
- failureCounter.getAndIncrement();
- LOG.error("Put Cars failed", t);
- }
- });
- try {
- TimeUnit.NANOSECONDS.sleep(sleep);
- } catch (InterruptedException e) {
- break;
+ testThread = new Thread(() -> {
+ sw.start();
+ AtomicLong count = new AtomicLong();
+ while (!stopThread) {
+ long id = count.incrementAndGet();
+ WriteTransaction tx1 = dataProvider.newWriteOnlyTransaction();
+ CarEntry car = new CarEntryBuilder().setId(new CarId("car" + id)).build();
+ tx1.put(LogicalDatastoreType.CONFIGURATION,
+ InstanceIdentifier.<Cars>builder(Cars.class).child(CarEntry.class, car.getKey()).build(),
+ car);
+ CheckedFuture<Void, TransactionCommitFailedException> future = tx1.submit();
+ Futures.addCallback(future, new FutureCallback<Void>() {
+
+ @Override
+ public void onSuccess(final Void result) {
+ // Transaction succeeded
+ succcessCounter.getAndIncrement();