Fix codestyle
[openflowplugin.git] / openflowplugin-impl / src / main / java / org / opendaylight / openflowplugin / impl / util / BarrierUtil.java
index 209ff92c1bb7061b5b6ac401f14524ea4f2ed362..500dd413a2a198aad4ebf818718baca7f1420acb 100644 (file)
@@ -21,16 +21,12 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.SendBarrierInputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
 import org.opendaylight.yangtools.yang.common.RpcResult;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 /**
- * provides barrier message chaining and factory methods
+ * Provides barrier message chaining and factory methods.
  */
 public final class BarrierUtil {
 
-    private static final Logger LOG = LoggerFactory.getLogger(BarrierUtil.class);
-
 
     private BarrierUtil() {
         throw new IllegalStateException("This class should not be instantiated.");
@@ -38,14 +34,14 @@ public final class BarrierUtil {
 
 
     /**
-     * chain a barrier message - regardless of previous result and use given {@link Function} to combine
-     * original result and barrier result
+     * Chain a barrier message - regardless of previous result and use given {@link Function} to combine
+     * original result and barrier result.
      *
      * @param <T>                type of input future
      * @param input              future to chain barrier to
      * @param nodeRef            target device
      * @param transactionService barrier service
-     * @param compositeTransform
+     * @param compositeTransform composite transform
      * @return future holding both results (input and of the barrier)
      */
     public static <T> ListenableFuture<RpcResult<T>> chainBarrier(
@@ -55,14 +51,11 @@ public final class BarrierUtil {
         final MutablePair<RpcResult<T>, RpcResult<Void>> resultPair = new MutablePair<>();
 
         // store input result and append barrier
-        final ListenableFuture<RpcResult<Void>> barrierResult = Futures.transform(input,
-                new AsyncFunction<RpcResult<T>, RpcResult<Void>>() {
-                    @Override
-                    public ListenableFuture<RpcResult<Void>> apply(@Nullable final RpcResult<T> interInput) throws Exception {
-                        resultPair.setLeft(interInput);
-                        final SendBarrierInput barrierInput = createSendBarrierInput(nodeRef);
-                        return JdkFutureAdapters.listenInPoolThread(transactionService.sendBarrier(barrierInput));
-                    }
+        final ListenableFuture<RpcResult<Void>> barrierResult = Futures.transformAsync(input,
+                interInput -> {
+                    resultPair.setLeft(interInput);
+                    final SendBarrierInput barrierInput = createSendBarrierInput(nodeRef);
+                    return JdkFutureAdapters.listenInPoolThread(transactionService.sendBarrier(barrierInput));
                 });
         // store barrier result and return initiated pair
         final ListenableFuture<Pair<RpcResult<T>, RpcResult<Void>>> compositeResult = Futures.transform(
@@ -79,6 +72,8 @@ public final class BarrierUtil {
     }
 
     /**
+     * Creates barrier input.
+     *
      * @param nodeRef rpc routing context
      * @return input for {@link FlowCapableTransactionService#sendBarrier(SendBarrierInput)}
      */