sal-distributed-datastore: use lambdas 85/57185/2
authorStephen Kitt <skitt@redhat.com>
Tue, 16 May 2017 15:51:25 +0000 (17:51 +0200)
committerRobert Varga <nite@hq.sk>
Wed, 17 May 2017 09:04:10 +0000 (09:04 +0000)
This series of patches uses lambdas instead of anonymous classes for
functional interfaces when possible. Lambdas are replaced with method
references when appropriate.

Change-Id: Ib397cbe0e0179f2f47ef10f13301b604dc6db88b
Signed-off-by: Stephen Kitt <skitt@redhat.com>
16 files changed:
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/actors/dds/AbstractDataStoreClientActor.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/databroker/actors/dds/LocalProxyTransaction.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/AbstractFrontendHistory.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/CompositeDataTreeCohort.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/RemoteTransactionContextSupport.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/entityownership/EntityOwnershipListenerSupport.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/sharding/ShardedDataTreeActor.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/databroker/ConcurrentDOMDataBrokerTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/AbstractShardTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerRegistrationProxyTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DataTreeChangeListenerProxyTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreIntegrationTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardDataTreeMocking.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/TransactionChainProxyTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/shardmanager/ShardManagerTest.java

index 5e7fade..1143bab 100644 (file)
@@ -24,7 +24,7 @@ import scala.concurrent.Await;
 import scala.concurrent.duration.Duration;
 
 public abstract class AbstractDataStoreClientActor extends AbstractClientActor {
-    private static final Function1<ActorRef, ?> GET_CLIENT_FACTORY = ExplicitAsk.toScala(t -> new GetClientRequest(t));
+    private static final Function1<ActorRef, ?> GET_CLIENT_FACTORY = ExplicitAsk.toScala(GetClientRequest::new);
 
     private final ActorContext actorContext;
 
index b228293..00b29e4 100644 (file)
@@ -87,9 +87,8 @@ abstract class LocalProxyTransaction extends AbstractProxyTransaction {
 
     @Override
     final void doAbort() {
-        sendAbort(new AbortLocalTransactionRequest(identifier, localActor()), response -> {
-            LOG.debug("Transaction {} abort completed with {}", identifier, response);
-        });
+        sendAbort(new AbortLocalTransactionRequest(identifier, localActor()),
+            response -> LOG.debug("Transaction {} abort completed with {}", identifier, response));
     }
 
     @Override
index 6ca5888..f6dee7c 100644 (file)
@@ -156,16 +156,14 @@ abstract class AbstractFrontendHistory implements Identifiable<LocalHistoryIdent
 
     void destroy(final long sequence, final RequestEnvelope envelope, final long now) {
         LOG.debug("{}: closing history {}", persistenceId(), getIdentifier());
-        tree.closeTransactionChain(getIdentifier(), () -> {
-            envelope.sendSuccess(new LocalHistorySuccess(getIdentifier(), sequence), readTime() - now);
-        });
+        tree.closeTransactionChain(getIdentifier(),
+            () -> envelope.sendSuccess(new LocalHistorySuccess(getIdentifier(), sequence), readTime() - now));
     }
 
     void purge(final long sequence, final RequestEnvelope envelope, final long now) {
         LOG.debug("{}: purging history {}", persistenceId(), getIdentifier());
-        tree.purgeTransactionChain(getIdentifier(), () -> {
-            envelope.sendSuccess(new LocalHistorySuccess(getIdentifier(), sequence), readTime() - now);
-        });
+        tree.purgeTransactionChain(getIdentifier(),
+            () -> envelope.sendSuccess(new LocalHistorySuccess(getIdentifier(), sequence), readTime() - now));
     }
 
     private FrontendTransaction createTransaction(final TransactionRequest<?> request, final TransactionIdentifier id)
index 338ae64..e8c0567 100644 (file)
@@ -224,7 +224,7 @@ class CompositeDataTreeCohort {
 
         final Iterable<Object> results;
         try {
-            results = Await.result(Futures.sequence(Lists.transform(futures, e -> e.getValue()),
+            results = Await.result(Futures.sequence(Lists.transform(futures, Entry::getValue),
                 ExecutionContexts.global()), timeout.duration());
         } catch (TimeoutException e) {
             successfulFromPrevious = null;
index 1e0d127..5bafef8 100644 (file)
@@ -187,7 +187,7 @@ final class RemoteTransactionContextSupport {
 
                 getActorContext().getActorSystem().scheduler().scheduleOnce(
                     FiniteDuration.create(scheduleInterval, TimeUnit.MILLISECONDS),
-                    () -> tryFindPrimaryShard(), getActorContext().getClientDispatcher());
+                        this::tryFindPrimaryShard, getActorContext().getClientDispatcher());
                 return;
             }
         }
index d2b4dd3..84a58d9 100644 (file)
@@ -119,8 +119,8 @@ class EntityOwnershipListenerSupport extends EntityOwnershipChangePublisher {
         try {
             Collection<DOMEntityOwnershipListener> listeners = entityTypeListenerMap.get(entity.getType());
             if (!listeners.isEmpty()) {
-                notifyListeners(entity, wasOwner, isOwner, hasOwner, listeners.stream().map(
-                    listener -> listenerActorMap.get(listener)).collect(Collectors.toList()));
+                notifyListeners(entity, wasOwner, isOwner, hasOwner,
+                        listeners.stream().map(listenerActorMap::get).collect(Collectors.toList()));
             }
         } finally {
             listenerLock.readLock().unlock();
index 671fbb8..224ca0b 100644 (file)
@@ -246,12 +246,12 @@ public class ShardedDataTreeActor extends AbstractUntypedPersistentActor {
         final CompletableFuture<Void> combinedFuture = CompletableFuture.allOf(
                 futures.toArray(new CompletableFuture[futures.size()]));
 
-        combinedFuture.thenRun(() -> {
-            sender.tell(new Status.Success(null), noSender());
-        }).exceptionally(throwable -> {
-            sender.tell(new Status.Failure(throwable), self());
-            return null;
-        });
+        combinedFuture
+                .thenRun(() -> sender.tell(new Success(null), noSender()))
+                .exceptionally(throwable -> {
+                    sender.tell(new Status.Failure(throwable), self());
+                    return null;
+                });
     }
 
     private void onNotifyProducerCreated(final NotifyProducerCreated message) {
index 8aca70d..bef18ff 100644 (file)
@@ -116,14 +116,11 @@ public class ConcurrentDOMDataBrokerTest {
         Answer<ListenableFuture<Boolean>> asyncCanCommit = invocation -> {
             final SettableFuture<Boolean> future = SettableFuture.create();
             if (doAsync) {
-                new Thread() {
-                    @Override
-                    public void run() {
-                        Uninterruptibles.awaitUninterruptibly(asyncCanCommitContinue,
-                                10, TimeUnit.SECONDS);
-                        future.set(true);
-                    }
-                }.start();
+                new Thread(() -> {
+                    Uninterruptibles.awaitUninterruptibly(asyncCanCommitContinue,
+                            10, TimeUnit.SECONDS);
+                    future.set(true);
+                }).start();
             } else {
                 future.set(true);
             }
index 3a67658..4e29d4d 100644 (file)
@@ -206,9 +206,8 @@ public abstract class AbstractShardTest extends AbstractActorTest {
             return null;
         }).when(mock).validate(any(DataTreeModification.class));
 
-        doAnswer(invocation -> {
-            return actual.prepare(invocation.getArgumentAt(0, DataTreeModification.class));
-        }).when(mock).prepare(any(DataTreeModification.class));
+        doAnswer(invocation -> actual.prepare(invocation.getArgumentAt(0, DataTreeModification.class))).when(
+                mock).prepare(any(DataTreeModification.class));
 
         doAnswer(invocation -> {
             actual.commit(invocation.getArgumentAt(0, DataTreeCandidate.class));
@@ -220,13 +219,9 @@ public abstract class AbstractShardTest extends AbstractActorTest {
             return null;
         }).when(mock).setSchemaContext(any(SchemaContext.class));
 
-        doAnswer(invocation -> {
-            return actual.takeSnapshot();
-        }).when(mock).takeSnapshot();
+        doAnswer(invocation -> actual.takeSnapshot()).when(mock).takeSnapshot();
 
-        doAnswer(invocation -> {
-            return actual.getRootPath();
-        }).when(mock).getRootPath();
+        doAnswer(invocation -> actual.getRootPath()).when(mock).getRootPath();
 
         return mock;
     }
index 64f088f..fdebed1 100644 (file)
@@ -81,13 +81,7 @@ public class DataChangeListenerRegistrationProxyTest extends AbstractActorTest {
 
                 final YangInstanceIdentifier path = YangInstanceIdentifier.of(TestModel.TEST_QNAME);
                 final DataChangeScope scope = AsyncDataBroker.DataChangeScope.ONE;
-                new Thread() {
-                    @Override
-                    public void run() {
-                        proxy.init(path, scope);
-                    }
-
-                }.start();
+                new Thread(() -> proxy.init(path, scope)).start();
 
                 FiniteDuration timeout = duration("5 seconds");
                 FindLocalShard findLocalShard = expectMsgClass(timeout, FindLocalShard.class);
@@ -141,13 +135,7 @@ public class DataChangeListenerRegistrationProxyTest extends AbstractActorTest {
 
                 final YangInstanceIdentifier path = YangInstanceIdentifier.of(TestModel.TEST_QNAME);
                 final DataChangeScope scope = AsyncDataBroker.DataChangeScope.ONE;
-                new Thread() {
-                    @Override
-                    public void run() {
-                        proxy.init(path, scope);
-                    }
-
-                }.start();
+                new Thread(() -> proxy.init(path, scope)).start();
 
                 FiniteDuration timeout = duration("5 seconds");
                 FindLocalShard findLocalShard = expectMsgClass(timeout, FindLocalShard.class);
@@ -198,13 +186,7 @@ public class DataChangeListenerRegistrationProxyTest extends AbstractActorTest {
 
                 final YangInstanceIdentifier path = YangInstanceIdentifier.of(TestModel.TEST_QNAME);
                 final DataChangeScope scope = AsyncDataBroker.DataChangeScope.ONE;
-                new Thread() {
-                    @Override
-                    public void run() {
-                        proxy.init(path, scope);
-                    }
-
-                }.start();
+                new Thread(() -> proxy.init(path, scope)).start();
 
                 FiniteDuration timeout = duration("5 seconds");
                 FindLocalShard findLocalShard = expectMsgClass(timeout, FindLocalShard.class);
@@ -231,13 +213,7 @@ public class DataChangeListenerRegistrationProxyTest extends AbstractActorTest {
 
                 final YangInstanceIdentifier path = YangInstanceIdentifier.of(TestModel.TEST_QNAME);
                 final DataChangeScope scope = AsyncDataBroker.DataChangeScope.ONE;
-                new Thread() {
-                    @Override
-                    public void run() {
-                        proxy.init(path, scope);
-                    }
-
-                }.start();
+                new Thread(() -> proxy.init(path, scope)).start();
 
                 FiniteDuration timeout = duration("5 seconds");
                 FindLocalShard findLocalShard = expectMsgClass(timeout, FindLocalShard.class);
index 927f929..c66c3cd 100644 (file)
@@ -60,13 +60,7 @@ public class DataTreeChangeListenerProxyTest extends AbstractActorTest {
                 final DataTreeChangeListenerProxy<DOMDataTreeChangeListener> proxy = new DataTreeChangeListenerProxy<>(
                         actorContext, mockListener, path);
 
-                new Thread() {
-                    @Override
-                    public void run() {
-                        proxy.init("shard-1");
-                    }
-
-                }.start();
+                new Thread(() -> proxy.init("shard-1")).start();
 
                 FiniteDuration timeout = duration("5 seconds");
                 FindLocalShard findLocalShard = expectMsgClass(timeout, FindLocalShard.class);
@@ -119,13 +113,7 @@ public class DataTreeChangeListenerProxyTest extends AbstractActorTest {
                 final DataTreeChangeListenerProxy<ClusteredDOMDataTreeChangeListener> proxy =
                         new DataTreeChangeListenerProxy<>(actorContext, mockClusteredListener, path);
 
-                new Thread() {
-                    @Override
-                    public void run() {
-                        proxy.init("shard-1");
-                    }
-
-                }.start();
+                new Thread(() -> proxy.init("shard-1")).start();
 
                 FiniteDuration timeout = duration("5 seconds");
                 FindLocalShard findLocalShard = expectMsgClass(timeout, FindLocalShard.class);
@@ -154,13 +142,7 @@ public class DataTreeChangeListenerProxyTest extends AbstractActorTest {
                 final DataTreeChangeListenerProxy<DOMDataTreeChangeListener> proxy = new DataTreeChangeListenerProxy<>(
                         actorContext, mockListener, path);
 
-                new Thread() {
-                    @Override
-                    public void run() {
-                        proxy.init("shard-1");
-                    }
-
-                }.start();
+                new Thread(() -> proxy.init("shard-1")).start();
 
                 FiniteDuration timeout = duration("5 seconds");
                 FindLocalShard findLocalShard = expectMsgClass(timeout, FindLocalShard.class);
@@ -186,13 +168,7 @@ public class DataTreeChangeListenerProxyTest extends AbstractActorTest {
                 final DataTreeChangeListenerProxy<DOMDataTreeChangeListener> proxy = new DataTreeChangeListenerProxy<>(
                         actorContext, mockListener, path);
 
-                new Thread() {
-                    @Override
-                    public void run() {
-                        proxy.init("shard-1");
-                    }
-
-                }.start();
+                new Thread(() -> proxy.init("shard-1")).start();
 
                 FiniteDuration timeout = duration("5 seconds");
                 FindLocalShard findLocalShard = expectMsgClass(timeout, FindLocalShard.class);
index 2cd2b29..7773556 100644 (file)
@@ -363,28 +363,25 @@ public class DistributedDataStoreIntegrationTest {
                     final AtomicReference<DOMStoreThreePhaseCommitCohort> txCohort = new AtomicReference<>();
                     final AtomicReference<Exception> caughtEx = new AtomicReference<>();
                     final CountDownLatch txReady = new CountDownLatch(1);
-                    final Thread txThread = new Thread() {
-                        @Override
-                        public void run() {
-                            try {
-                                writeTx.write(TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME));
+                    final Thread txThread = new Thread(() -> {
+                        try {
+                            writeTx.write(TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME));
 
-                                writeTx.merge(TestModel.OUTER_LIST_PATH,
-                                        ImmutableNodes.mapNodeBuilder(TestModel.OUTER_LIST_QNAME).build());
+                            writeTx.merge(TestModel.OUTER_LIST_PATH,
+                                    ImmutableNodes.mapNodeBuilder(TestModel.OUTER_LIST_QNAME).build());
 
-                                writeTx.write(listEntryPath,
-                                        ImmutableNodes.mapEntry(TestModel.OUTER_LIST_QNAME, TestModel.ID_QNAME, 1));
+                            writeTx.write(listEntryPath,
+                                    ImmutableNodes.mapEntry(TestModel.OUTER_LIST_QNAME, TestModel.ID_QNAME, 1));
 
-                                writeTx.delete(listEntryPath);
+                            writeTx.delete(listEntryPath);
 
-                                txCohort.set(writeTx.ready());
-                            } catch (Exception e) {
-                                caughtEx.set(e);
-                            } finally {
-                                txReady.countDown();
-                            }
+                            txCohort.set(writeTx.ready());
+                        } catch (Exception e) {
+                            caughtEx.set(e);
+                        } finally {
+                            txReady.countDown();
                         }
-                    };
+                    });
 
                     txThread.start();
 
@@ -460,23 +457,20 @@ public class DistributedDataStoreIntegrationTest {
                             txReadFuture = new AtomicReference<>();
                     final AtomicReference<Exception> caughtEx = new AtomicReference<>();
                     final CountDownLatch txReadsDone = new CountDownLatch(1);
-                    final Thread txThread = new Thread() {
-                        @Override
-                        public void run() {
-                            try {
-                                readWriteTx.write(TestModel.TEST_PATH,
-                                        ImmutableNodes.containerNode(TestModel.TEST_QNAME));
+                    final Thread txThread = new Thread(() -> {
+                        try {
+                            readWriteTx.write(TestModel.TEST_PATH,
+                                    ImmutableNodes.containerNode(TestModel.TEST_QNAME));
 
-                                txExistsFuture.set(readWriteTx.exists(TestModel.TEST_PATH));
+                            txExistsFuture.set(readWriteTx.exists(TestModel.TEST_PATH));
 
-                                txReadFuture.set(readWriteTx.read(TestModel.TEST_PATH));
-                            } catch (Exception e) {
-                                caughtEx.set(e);
-                            } finally {
-                                txReadsDone.countDown();
-                            }
+                            txReadFuture.set(readWriteTx.read(TestModel.TEST_PATH));
+                        } catch (Exception e) {
+                            caughtEx.set(e);
+                        } finally {
+                            txReadsDone.countDown();
                         }
-                    };
+                    });
 
                     txThread.start();
 
index e2dc814..0e1dd44 100644 (file)
@@ -127,33 +127,25 @@ public final class ShardDataTreeMocking {
 
     @SuppressWarnings("unchecked")
     public static ShardDataTreeCohort failedCanCommit(final ShardDataTreeCohort mock) {
-        doAnswer(invocation -> {
-            return invokeFailure(invocation);
-        }).when(mock).canCommit(any(FutureCallback.class));
+        doAnswer(ShardDataTreeMocking::invokeFailure).when(mock).canCommit(any(FutureCallback.class));
         return mock;
     }
 
     @SuppressWarnings("unchecked")
     public static ShardDataTreeCohort failedPreCommit(final ShardDataTreeCohort mock) {
-        doAnswer(invocation -> {
-            return invokeFailure(invocation);
-        }).when(mock).preCommit(any(FutureCallback.class));
+        doAnswer(ShardDataTreeMocking::invokeFailure).when(mock).preCommit(any(FutureCallback.class));
         return mock;
     }
 
     @SuppressWarnings("unchecked")
     public static ShardDataTreeCohort failedCommit(final ShardDataTreeCohort mock) {
-        doAnswer(invocation -> {
-            return invokeFailure(invocation);
-        }).when(mock).commit(any(FutureCallback.class));
+        doAnswer(ShardDataTreeMocking::invokeFailure).when(mock).commit(any(FutureCallback.class));
         return mock;
     }
 
     @SuppressWarnings("unchecked")
     public static ShardDataTreeCohort successfulCanCommit(final ShardDataTreeCohort mock) {
-        doAnswer(invocation -> {
-            return invokeSuccess(invocation, null);
-        }).when(mock).canCommit(any(FutureCallback.class));
+        doAnswer(invocation -> invokeSuccess(invocation, null)).when(mock).canCommit(any(FutureCallback.class));
 
         return mock;
     }
@@ -165,9 +157,7 @@ public final class ShardDataTreeMocking {
     @SuppressWarnings("unchecked")
     public static ShardDataTreeCohort successfulPreCommit(final ShardDataTreeCohort mock,
             final DataTreeCandidate candidate) {
-        doAnswer(invocation -> {
-            return invokeSuccess(invocation, candidate);
-        }).when(mock).preCommit(any(FutureCallback.class));
+        doAnswer(invocation -> invokeSuccess(invocation, candidate)).when(mock).preCommit(any(FutureCallback.class));
 
         return mock;
     }
@@ -178,9 +168,7 @@ public final class ShardDataTreeMocking {
 
     @SuppressWarnings("unchecked")
     public static ShardDataTreeCohort successfulCommit(final ShardDataTreeCohort mock, final UnsignedLong index) {
-        doAnswer(invocation -> {
-            return invokeSuccess(invocation, index);
-        }).when(mock).commit(any(FutureCallback.class));
+        doAnswer(invocation -> invokeSuccess(invocation, index)).when(mock).commit(any(FutureCallback.class));
 
         return mock;
     }
index ce2a43f..f566ba8 100644 (file)
@@ -198,14 +198,11 @@ public class ShardTest extends AbstractShardTest {
                             // original ElectionTimeout message to proceed with the election.
                             firstElectionTimeout = false;
                             final ActorRef self = getSelf();
-                            new Thread() {
-                                @Override
-                                public void run() {
-                                    Uninterruptibles.awaitUninterruptibly(
-                                            onChangeListenerRegistered, 5, TimeUnit.SECONDS);
-                                    self.tell(message, self);
-                                }
-                            }.start();
+                            new Thread(() -> {
+                                Uninterruptibles.awaitUninterruptibly(
+                                        onChangeListenerRegistered, 5, TimeUnit.SECONDS);
+                                self.tell(message, self);
+                            }).start();
 
                             onFirstElectionTimeout.countDown();
                         } else {
@@ -307,14 +304,11 @@ public class ShardTest extends AbstractShardTest {
                         if (message instanceof ElectionTimeout && firstElectionTimeout) {
                             firstElectionTimeout = false;
                             final ActorRef self = getSelf();
-                            new Thread() {
-                                @Override
-                                public void run() {
-                                    Uninterruptibles.awaitUninterruptibly(
-                                            onChangeListenerRegistered, 5, TimeUnit.SECONDS);
-                                    self.tell(message, self);
-                                }
-                            }.start();
+                            new Thread(() -> {
+                                Uninterruptibles.awaitUninterruptibly(
+                                        onChangeListenerRegistered, 5, TimeUnit.SECONDS);
+                                self.tell(message, self);
+                            }).start();
 
                             onFirstElectionTimeout.countDown();
                         } else {
index 78266df..9fd0849 100644 (file)
@@ -152,18 +152,15 @@ public class TransactionChainProxyTest extends AbstractTransactionProxyTest {
 
             final AtomicReference<Exception> caughtEx = new AtomicReference<>();
             final CountDownLatch write2Complete = new CountDownLatch(1);
-            new Thread() {
-                @Override
-                public void run() {
-                    try {
-                        writeTx2.write(TestModel.OUTER_LIST_PATH, writeNode2);
-                    } catch (Exception e) {
-                        caughtEx.set(e);
-                    } finally {
-                        write2Complete.countDown();
-                    }
+            new Thread(() -> {
+                try {
+                    writeTx2.write(TestModel.OUTER_LIST_PATH, writeNode2);
+                } catch (Exception e) {
+                    caughtEx.set(e);
+                } finally {
+                    write2Complete.countDown();
                 }
-            }.start();
+            }).start();
 
             assertEquals("Tx 2 write should've completed", true, write2Complete.await(5, TimeUnit.SECONDS));
 
@@ -224,18 +221,15 @@ public class TransactionChainProxyTest extends AbstractTransactionProxyTest {
 
             final AtomicReference<Exception> caughtEx = new AtomicReference<>();
             final CountDownLatch write2Complete = new CountDownLatch(1);
-            new Thread() {
-                @Override
-                public void run() {
-                    try {
-                        writeTx2.write(TestModel.OUTER_LIST_PATH, writeNode2);
-                    } catch (Exception e) {
-                        caughtEx.set(e);
-                    } finally {
-                        write2Complete.countDown();
-                    }
+            new Thread(() -> {
+                try {
+                    writeTx2.write(TestModel.OUTER_LIST_PATH, writeNode2);
+                } catch (Exception e) {
+                    caughtEx.set(e);
+                } finally {
+                    write2Complete.countDown();
                 }
-            }.start();
+            }).start();
 
             assertEquals("Tx 2 write should've completed", true, write2Complete.await(5, TimeUnit.SECONDS));
 
index 6e37a97..f40374b 100644 (file)
@@ -1328,7 +1328,7 @@ public class ShardManagerTest extends AbstractShardManagerTest {
         assertEquals("getType", shardMrgIDSuffix, datastoreSnapshot.getType());
         assertNull("Expected null ShardManagerSnapshot", datastoreSnapshot.getShardManagerSnapshot());
 
-        Function<ShardSnapshot, String> shardNameTransformer = s -> s.getName();
+        Function<ShardSnapshot, String> shardNameTransformer = ShardSnapshot::getName;
 
         assertEquals("Shard names", Sets.newHashSet("shard1", "shard2"), Sets.newHashSet(
                 Lists.transform(datastoreSnapshot.getShardSnapshots(), shardNameTransformer)));

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.