sal-dom-broker-config: use lambdas 87/57187/4
authorStephen Kitt <skitt@redhat.com>
Tue, 16 May 2017 15:51:32 +0000 (17:51 +0200)
committerTom Pantelis <tompantelis@gmail.com>
Fri, 15 Sep 2017 20:28:10 +0000 (20:28 +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: Iaf552c1e280034f8a465b46b9092a7df0cec5409
Signed-off-by: Stephen Kitt <skitt@redhat.com>
opendaylight/md-sal/sal-dom-broker-config/src/main/java/org/opendaylight/controller/config/yang/md/sal/dom/impl/DomBrokerImplModule.java
opendaylight/md-sal/sal-dom-broker-config/src/main/java/org/opendaylight/controller/config/yang/md/sal/dom/impl/DomInmemoryDataBrokerModule.java

index 86dcf80..1adf404 100644 (file)
@@ -92,15 +92,12 @@ public final class DomBrokerImplModule extends org.opendaylight.controller.confi
         services.putInstance(DOMMountPointService.class, mountService);
 
         BrokerImpl broker = new BrokerImpl(domRpcService, domRpcProvider, services);
-        broker.setDeactivator(new AutoCloseable() {
-            @Override
-            public void close() {
-                for(AutoCloseable ac: closeables) {
-                    try {
-                        ac.close();
-                    } catch(Exception e) {
-                        LOG.warn("Exception while closing {}", ac, e);
-                    }
+        broker.setDeactivator(() -> {
+            for (AutoCloseable ac : closeables) {
+                try {
+                    ac.close();
+                } catch (Exception e) {
+                    LOG.warn("Exception while closing {}", ac, e);
                 }
             }
         });
index 581a645..37ac3de 100644 (file)
@@ -122,14 +122,7 @@ public final class DomInmemoryDataBrokerModule extends
             mBeans.add(commitFutureStatsMXBean);
         }
 
-        sdb.setCloseable(new AutoCloseable() {
-            @Override
-            public void close() {
-                for(AbstractMXBean mBean: mBeans) {
-                    mBean.unregisterMBean();
-                }
-            }
-        });
+        sdb.setCloseable(() -> mBeans.forEach(AbstractMXBean::unregisterMBean));
 
         return sdb;
     }

©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.