Reduce use of JdkFutureAdapters 26/80526/8
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 21 Feb 2019 18:01:20 +0000 (19:01 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 18 Jun 2019 14:47:12 +0000 (16:47 +0200)
All of our infra is on ListenableFuture these days, there is no
point in squashing that to Future and then going back to
ListenableFuture.

Change-Id: I887a4bab29465c90202a66a352b7ffe1f63d6e6e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
25 files changed:
applications/bulk-o-matic/src/main/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/SalBulkFlowServiceImpl.java
applications/forwardingrules-sync/src/main/java/org/opendaylight/openflowplugin/applications/frsync/ForwardingRulesAddCommitter.java
applications/forwardingrules-sync/src/main/java/org/opendaylight/openflowplugin/applications/frsync/ForwardingRulesRemoveCommitter.java
applications/forwardingrules-sync/src/main/java/org/opendaylight/openflowplugin/applications/frsync/ForwardingRulesUpdateCommitter.java
applications/forwardingrules-sync/src/main/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/FlowForwarder.java
applications/forwardingrules-sync/src/main/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/GroupForwarder.java
applications/forwardingrules-sync/src/main/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/MeterForwarder.java
applications/forwardingrules-sync/src/main/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/SyncPlanPushStrategyFlatBatchImpl.java
applications/forwardingrules-sync/src/main/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/SyncPlanPushStrategyIncrementalImpl.java
applications/forwardingrules-sync/src/main/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/TableForwarder.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/connection/HandshakeManagerImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/connection/listener/HandshakeListenerImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/role/RoleContextImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/RoleService.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/batch/FlatBatchFlowAdapters.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/batch/FlatBatchGroupAdapters.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/batch/FlatBatchMeterAdapters.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/sal/SalBundleServiceImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/sal/SalFlatBatchServiceImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/sal/SalFlowsBatchServiceImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/sal/SalGroupsBatchServiceImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/sal/SalMetersBatchServiceImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/services/sal/SalRoleServiceImpl.java
openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/util/BarrierUtil.java
test-common/src/main/java/org/opendaylight/openflowplugin/testcommon/DropTestRpcSender.java

index de20636798bbb261cefc354444167bd3ddd8736b..9d77f05407c049d868e68cbf811586565ae3ce7c 100644 (file)
@@ -12,7 +12,6 @@ import com.google.common.base.MoreObjects;
 import com.google.common.base.Preconditions;
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.JdkFutureAdapters;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.MoreExecutors;
 import com.google.common.util.concurrent.SettableFuture;
@@ -22,7 +21,6 @@ import java.util.Collections;
 import java.util.List;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.ForkJoinPool;
-import java.util.concurrent.Future;
 import javax.management.InstanceAlreadyExistsException;
 import javax.management.MBeanRegistrationException;
 import javax.management.MBeanServer;
@@ -171,8 +169,7 @@ public class SalBulkFlowServiceImpl implements SalBulkFlowService {
             final NodeRef nodeRef = bulkFlow.getNode();
             flowInputBuilder.setNode(nodeRef);
             flowInputBuilder.setTableId(bulkFlow.getTableId());
-            Future<RpcResult<AddFlowOutput>> rpcAddFlowResult = flowService.addFlow(flowInputBuilder.build());
-            bulkResults.add(JdkFutureAdapters.listenInPoolThread(rpcAddFlowResult));
+            bulkResults.add(flowService.addFlow(flowInputBuilder.build()));
         }
         return Futures.transform(handleResultFuture(Futures.allAsList(bulkResults)), voidRpcResult -> {
             if (voidRpcResult.isSuccessful()) {
@@ -231,8 +228,7 @@ public class SalBulkFlowServiceImpl implements SalBulkFlowService {
             final NodeRef nodeRef = bulkFlow.getNode();
             flowInputBuilder.setNode(nodeRef);
             flowInputBuilder.setTableId(bulkFlow.getTableId());
-            Future<RpcResult<RemoveFlowOutput>> rpcAddFlowResult = flowService.removeFlow(flowInputBuilder.build());
-            bulkResults.add(JdkFutureAdapters.listenInPoolThread(rpcAddFlowResult));
+            bulkResults.add(flowService.removeFlow(flowInputBuilder.build()));
         }
         return Futures.transform(handleResultFuture(Futures.allAsList(bulkResults)), voidRpcResult -> {
             if (voidRpcResult.isSuccessful()) {
index 11e399c62e22bb409384f01eeae77f4e32abcabd..bb724d7b7b430de7212bd258ff07551f5d5bcbfd 100644 (file)
@@ -1,4 +1,4 @@
-/**
+/*
  * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
@@ -8,7 +8,7 @@
 
 package org.opendaylight.openflowplugin.applications.frsync;
 
-import java.util.concurrent.Future;
+import com.google.common.util.concurrent.ListenableFuture;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
@@ -28,6 +28,7 @@ public interface ForwardingRulesAddCommitter<D extends DataObject, A extends Dat
      * @param nodeIdent  - Node InstanceIdentifier
      * @return RpcResult of action
      */
-    Future<RpcResult<A>> add(InstanceIdentifier<D> identifier, D add, InstanceIdentifier<FlowCapableNode> nodeIdent);
+    ListenableFuture<RpcResult<A>> add(InstanceIdentifier<D> identifier, D add,
+            InstanceIdentifier<FlowCapableNode> nodeIdent);
 
 }
index 04f6554ad1fc7a8b4c3565c79ad833be5e6278ee..9e65f2f169b401bba22d2fdce43a39df4c17c787 100644 (file)
@@ -1,4 +1,4 @@
-/**
+/*
  * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
@@ -8,7 +8,7 @@
 
 package org.opendaylight.openflowplugin.applications.frsync;
 
-import java.util.concurrent.Future;
+import com.google.common.util.concurrent.ListenableFuture;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
@@ -28,6 +28,7 @@ public interface ForwardingRulesRemoveCommitter<D extends DataObject, R extends
      * @param nodeIdent  - Node InstanceIdentifier
      * @return RpcResult of action
      */
-    Future<RpcResult<R>> remove(InstanceIdentifier<D> identifier, D del, InstanceIdentifier<FlowCapableNode> nodeIdent);
+    ListenableFuture<RpcResult<R>> remove(InstanceIdentifier<D> identifier, D del,
+            InstanceIdentifier<FlowCapableNode> nodeIdent);
 
 }
index 3302a28ad62b7a8333d4db18a9bcf95763d97452..ebc6bca9502effded71229f5cdefce180aefd39f 100644 (file)
@@ -1,14 +1,13 @@
-/**
+/*
  * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.openflowplugin.applications.frsync;
 
-import java.util.concurrent.Future;
+import com.google.common.util.concurrent.ListenableFuture;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
@@ -29,7 +28,7 @@ public interface ForwardingRulesUpdateCommitter<D extends DataObject, U extends
      * @param nodeIdent  - Node InstanceIdentifier
      * @return RpcResult of action
      */
-    Future<RpcResult<U>> update(InstanceIdentifier<D> identifier, D original, D update,
+    ListenableFuture<RpcResult<U>> update(InstanceIdentifier<D> identifier, D original, D update,
                                 InstanceIdentifier<FlowCapableNode> nodeIdent);
 
 
index e97d83587cfcb5ebc1cbbb386ce75b1759b72bee..3b231db64e0f6a16bfb45e5674abacd60f188589 100644 (file)
@@ -9,7 +9,7 @@
 package org.opendaylight.openflowplugin.applications.frsync.impl.strategy;
 
 import com.google.common.base.Preconditions;
-import java.util.concurrent.Future;
+import com.google.common.util.concurrent.ListenableFuture;
 import org.opendaylight.openflowplugin.applications.frsync.ForwardingRulesCommitter;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table;
@@ -50,7 +50,7 @@ public class FlowForwarder implements ForwardingRulesCommitter<Flow, AddFlowOutp
     }
 
     @Override
-    public Future<RpcResult<RemoveFlowOutput>> remove(final InstanceIdentifier<Flow> identifier,
+    public ListenableFuture<RpcResult<RemoveFlowOutput>> remove(final InstanceIdentifier<Flow> identifier,
                                                       final Flow removeDataObj,
                                                       final InstanceIdentifier<FlowCapableNode> nodeIdent) {
         LOG.trace("Forwarding Flow REMOVE request Tbl id, node Id {} {}",
@@ -74,13 +74,13 @@ public class FlowForwarder implements ForwardingRulesCommitter<Flow, AddFlowOutp
     }
 
     @Override
-    public Future<RpcResult<UpdateFlowOutput>> update(final InstanceIdentifier<Flow> identifier,
+    public ListenableFuture<RpcResult<UpdateFlowOutput>> update(final InstanceIdentifier<Flow> identifier,
                                                       final Flow original, final Flow update,
                                                       final InstanceIdentifier<FlowCapableNode> nodeIdent) {
         LOG.trace("Forwarding Flow UPDATE request [Tbl id, node Id {} {} {}",
                 identifier, nodeIdent, update);
 
-        final Future<RpcResult<UpdateFlowOutput>> output;
+        final ListenableFuture<RpcResult<UpdateFlowOutput>> output;
         final TableKey tableKey = identifier.firstKeyOf(Table.class);
         if (tableIdValidationPrecondition(tableKey, update)) {
             final UpdateFlowInputBuilder builder = new UpdateFlowInputBuilder();
@@ -103,13 +103,13 @@ public class FlowForwarder implements ForwardingRulesCommitter<Flow, AddFlowOutp
     }
 
     @Override
-    public Future<RpcResult<AddFlowOutput>> add(final InstanceIdentifier<Flow> identifier,
+    public ListenableFuture<RpcResult<AddFlowOutput>> add(final InstanceIdentifier<Flow> identifier,
                                                 final Flow addDataObj,
                                                 final InstanceIdentifier<FlowCapableNode> nodeIdent) {
         LOG.trace("Forwarding the Flow ADD request [Tbl id, node Id {} {} {}",
                 identifier, nodeIdent, addDataObj);
 
-        final Future<RpcResult<AddFlowOutput>> output;
+        final ListenableFuture<RpcResult<AddFlowOutput>> output;
         final TableKey tableKey = identifier.firstKeyOf(Table.class);
         if (tableIdValidationPrecondition(tableKey, addDataObj)) {
             final AddFlowInputBuilder builder = new AddFlowInputBuilder(addDataObj);
index be8a93127ed0515e899f697b8ff43ac2fb9e4f3d..19eaabf11df135dfe21365d49925325375868dbc 100644 (file)
@@ -8,7 +8,7 @@
 
 package org.opendaylight.openflowplugin.applications.frsync.impl.strategy;
 
-import java.util.concurrent.Future;
+import com.google.common.util.concurrent.ListenableFuture;
 import org.opendaylight.openflowplugin.applications.frsync.ForwardingRulesCommitter;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupInputBuilder;
@@ -43,7 +43,7 @@ public class GroupForwarder implements ForwardingRulesCommitter<Group, AddGroupO
     }
 
     @Override
-    public Future<RpcResult<RemoveGroupOutput>> remove(final InstanceIdentifier<Group> identifier,
+    public ListenableFuture<RpcResult<RemoveGroupOutput>> remove(final InstanceIdentifier<Group> identifier,
             final Group removeDataObj, final InstanceIdentifier<FlowCapableNode> nodeIdent) {
         LOG.trace("Forwarding Table REMOVE request [Tbl id, node Id {} {}",
                 identifier, nodeIdent);
@@ -58,7 +58,7 @@ public class GroupForwarder implements ForwardingRulesCommitter<Group, AddGroupO
     }
 
     @Override
-    public Future<RpcResult<UpdateGroupOutput>> update(final InstanceIdentifier<Group> identifier,
+    public ListenableFuture<RpcResult<UpdateGroupOutput>> update(final InstanceIdentifier<Group> identifier,
                                                        final Group original, final Group update,
                                                        final InstanceIdentifier<FlowCapableNode> nodeIdent) {
         LOG.trace("Forwarding Group UPDATE request [Tbl id, node Id {} {} {}",
@@ -75,8 +75,8 @@ public class GroupForwarder implements ForwardingRulesCommitter<Group, AddGroupO
     }
 
     @Override
-    public Future<RpcResult<AddGroupOutput>> add(final InstanceIdentifier<Group> identifier, final Group addDataObj,
-                                                 final InstanceIdentifier<FlowCapableNode> nodeIdent) {
+    public ListenableFuture<RpcResult<AddGroupOutput>> add(final InstanceIdentifier<Group> identifier,
+            final Group addDataObj, final InstanceIdentifier<FlowCapableNode> nodeIdent) {
         LOG.trace("Forwarding Group ADD request [Tbl id, node Id {} {} {}",
                 identifier, nodeIdent, addDataObj);
 
index e28725315d1941c9c15ee8a6b20d9a1327a087b0..7e2d00772bc3d71f06482d8e169aac8791f17019 100644 (file)
@@ -8,7 +8,7 @@
 
 package org.opendaylight.openflowplugin.applications.frsync.impl.strategy;
 
-import java.util.concurrent.Future;
+import com.google.common.util.concurrent.ListenableFuture;
 import org.opendaylight.openflowplugin.applications.frsync.ForwardingRulesCommitter;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.Meter;
@@ -43,7 +43,7 @@ public class MeterForwarder implements ForwardingRulesCommitter<Meter, AddMeterO
     }
 
     @Override
-    public Future<RpcResult<RemoveMeterOutput>> remove(final InstanceIdentifier<Meter> identifier,
+    public ListenableFuture<RpcResult<RemoveMeterOutput>> remove(final InstanceIdentifier<Meter> identifier,
             final Meter removeDataObj, final InstanceIdentifier<FlowCapableNode> nodeIdent) {
 
         LOG.trace("Received the Meter REMOVE request [Tbl id, node Id {} {}",
@@ -57,7 +57,7 @@ public class MeterForwarder implements ForwardingRulesCommitter<Meter, AddMeterO
     }
 
     @Override
-    public Future<RpcResult<UpdateMeterOutput>> update(final InstanceIdentifier<Meter> identifier,
+    public ListenableFuture<RpcResult<UpdateMeterOutput>> update(final InstanceIdentifier<Meter> identifier,
                                                        final Meter original, final Meter update,
                                                        final InstanceIdentifier<FlowCapableNode> nodeIdent) {
         LOG.trace("Received the Meter UPDATE request [Tbl id, node Id {} {} {}",
@@ -74,8 +74,8 @@ public class MeterForwarder implements ForwardingRulesCommitter<Meter, AddMeterO
     }
 
     @Override
-    public Future<RpcResult<AddMeterOutput>> add(final InstanceIdentifier<Meter> identifier, final Meter addDataObj,
-                                                 final InstanceIdentifier<FlowCapableNode> nodeIdent) {
+    public ListenableFuture<RpcResult<AddMeterOutput>> add(final InstanceIdentifier<Meter> identifier,
+            final Meter addDataObj, final InstanceIdentifier<FlowCapableNode> nodeIdent) {
         LOG.trace("Received the Meter ADD request [Tbl id, node Id {} {} {}",
                 identifier, nodeIdent, addDataObj);
 
index 900d7e8b666610aa7b7c75d67d22f1ba8ceaf025..4557c9c658563977fdcd4b903544de6511a7a6ca 100644 (file)
@@ -14,14 +14,12 @@ import com.google.common.collect.PeekingIterator;
 import com.google.common.collect.Range;
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.JdkFutureAdapters;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.MoreExecutors;
 import java.util.ArrayList;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.concurrent.Future;
 import org.opendaylight.openflowplugin.applications.frsync.SyncPlanPushStrategy;
 import org.opendaylight.openflowplugin.applications.frsync.util.ItemSyncBox;
 import org.opendaylight.openflowplugin.applications.frsync.util.PathUtil;
@@ -140,15 +138,15 @@ public class SyncPlanPushStrategyFlatBatchImpl implements SyncPlanPushStrategy {
                     .setBatch(batchBag)
                     .build();
 
-            final Future<RpcResult<ProcessFlatBatchOutput>> rpcResultFuture =
+            final ListenableFuture<RpcResult<ProcessFlatBatchOutput>> rpcResultFuture =
                     flatBatchService.processFlatBatch(flatBatchInput);
 
             if (LOG.isDebugEnabled()) {
-                Futures.addCallback(JdkFutureAdapters.listenInPoolThread(rpcResultFuture),
-                        createCounterCallback(batchBag, batchOrder, counters), MoreExecutors.directExecutor());
+                Futures.addCallback(rpcResultFuture, createCounterCallback(batchBag, batchOrder, counters),
+                    MoreExecutors.directExecutor());
             }
 
-            return Futures.transform(JdkFutureAdapters.listenInPoolThread(rpcResultFuture),
+            return Futures.transform(rpcResultFuture,
                     ReconcileUtil.createRpcResultToVoidFunction("flat-batch"),
                     MoreExecutors.directExecutor());
         }, MoreExecutors.directExecutor());
index cecfef05e1327ec18199bb560fe5ca12486d5c68..edc463d89ac99e0cc9590b36c951fa957cb1d118 100644 (file)
@@ -1,16 +1,14 @@
-/**
+/*
  * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
  */
-
 package org.opendaylight.openflowplugin.applications.frsync.impl.strategy;
 
 import com.google.common.collect.Iterables;
 import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.JdkFutureAdapters;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.MoreExecutors;
 import java.util.ArrayList;
@@ -159,8 +157,7 @@ public class SyncPlanPushStrategyIncrementalImpl implements SyncPlanPushStrategy
                 LOG.trace("adding flow {} in table {} - absent on device {} match{}",
                         flow.getId(), tableKey, nodeId, flow.getMatch());
 
-                allResults.add(JdkFutureAdapters.listenInPoolThread(
-                        flowForwarder.add(flowIdent, flow, nodeIdent)));
+                allResults.add(flowForwarder.add(flowIdent, flow, nodeIdent));
                 flowCrudCounts.incAdded();
             }
 
@@ -173,8 +170,7 @@ public class SyncPlanPushStrategyIncrementalImpl implements SyncPlanPushStrategy
                 LOG.trace("flow {} in table {} - needs update on device {} match{}",
                         updatedFlow.getId(), tableKey, nodeId, updatedFlow.getMatch());
 
-                allUpdateResults.add(JdkFutureAdapters.listenInPoolThread(
-                        flowForwarder.update(flowIdent, existingFlow, updatedFlow, nodeIdent)));
+                allUpdateResults.add(flowForwarder.update(flowIdent, existingFlow, updatedFlow, nodeIdent));
                 flowCrudCounts.incUpdated();
             }
         }
@@ -214,8 +210,7 @@ public class SyncPlanPushStrategyIncrementalImpl implements SyncPlanPushStrategy
             for (final Flow flow : flowsPerTable.getValue().getItemsToPush()) {
                 final KeyedInstanceIdentifier<Flow, FlowKey> flowIdent =
                         tableIdent.child(Flow.class, flow.key());
-                allResults.add(JdkFutureAdapters.listenInPoolThread(
-                        flowForwarder.remove(flowIdent, flow, nodeIdent)));
+                allResults.add(flowForwarder.remove(flowIdent, flow, nodeIdent));
                 flowCrudCounts.incRemoved();
             }
         }
@@ -248,8 +243,7 @@ public class SyncPlanPushStrategyIncrementalImpl implements SyncPlanPushStrategy
                     meter.getMeterId(), nodeId);
             final KeyedInstanceIdentifier<Meter, MeterKey> meterIdent =
                     nodeIdent.child(Meter.class, meter.key());
-            allResults.add(JdkFutureAdapters.listenInPoolThread(
-                    meterForwarder.remove(meterIdent, meter, nodeIdent)));
+            allResults.add(meterForwarder.remove(meterIdent, meter, nodeIdent));
             meterCrudCounts.incRemoved();
         }
 
@@ -305,7 +299,7 @@ public class SyncPlanPushStrategyIncrementalImpl implements SyncPlanPushStrategy
         List<ListenableFuture<RpcResult<RemoveGroupOutput>>> allResults = new ArrayList<>();
         for (Group group : groupsPortion.getItemsToPush()) {
             final KeyedInstanceIdentifier<Group, GroupKey> groupIdent = nodeIdent.child(Group.class, group.key());
-            allResults.add(JdkFutureAdapters.listenInPoolThread(groupForwarder.remove(groupIdent, group, nodeIdent)));
+            allResults.add(groupForwarder.remove(groupIdent, group, nodeIdent));
         }
 
         final ListenableFuture<RpcResult<Void>> singleVoidResult = Futures.transform(
@@ -356,7 +350,7 @@ public class SyncPlanPushStrategyIncrementalImpl implements SyncPlanPushStrategy
 
         for (Group group : groupsPortion.getItemsToPush()) {
             final KeyedInstanceIdentifier<Group, GroupKey> groupIdent = nodeIdent.child(Group.class, group.key());
-            allResults.add(JdkFutureAdapters.listenInPoolThread(groupForwarder.add(groupIdent, group, nodeIdent)));
+            allResults.add(groupForwarder.add(groupIdent, group, nodeIdent));
 
         }
 
@@ -365,8 +359,7 @@ public class SyncPlanPushStrategyIncrementalImpl implements SyncPlanPushStrategy
             final Group group = groupTuple.getUpdated();
 
             final KeyedInstanceIdentifier<Group, GroupKey> groupIdent = nodeIdent.child(Group.class, group.key());
-            allUpdateResults.add(JdkFutureAdapters.listenInPoolThread(
-                    groupForwarder.update(groupIdent, existingGroup, group, nodeIdent)));
+            allUpdateResults.add(groupForwarder.update(groupIdent, existingGroup, group, nodeIdent));
         }
 
         final ListenableFuture<RpcResult<Void>> singleVoidAddResult = Futures.transform(
@@ -406,8 +399,7 @@ public class SyncPlanPushStrategyIncrementalImpl implements SyncPlanPushStrategy
             final KeyedInstanceIdentifier<Meter, MeterKey> meterIdent = nodeIdent.child(Meter.class, meter.key());
             LOG.debug("adding meter {} - absent on device {}",
                     meter.getMeterId(), nodeId);
-            allResults.add(JdkFutureAdapters.listenInPoolThread(
-                    meterForwarder.add(meterIdent, meter, nodeIdent)));
+            allResults.add(meterForwarder.add(meterIdent, meter, nodeIdent));
             meterCrudCounts.incAdded();
         }
 
@@ -416,8 +408,7 @@ public class SyncPlanPushStrategyIncrementalImpl implements SyncPlanPushStrategy
             final Meter updated = meterTuple.getUpdated();
             final KeyedInstanceIdentifier<Meter, MeterKey> meterIdent = nodeIdent.child(Meter.class, updated.key());
             LOG.trace("meter {} - needs update on device {}", updated.getMeterId(), nodeId);
-            allUpdateResults.add(JdkFutureAdapters.listenInPoolThread(
-                    meterForwarder.update(meterIdent, existingMeter, updated, nodeIdent)));
+            allUpdateResults.add(meterForwarder.update(meterIdent, existingMeter, updated, nodeIdent));
             meterCrudCounts.incUpdated();
         }
 
index 92c1ad51b3af5cb03c381a2647fb6ca4a24278c0..351a86ba403de2fd876fceb4ee82c4c81e1d7b2c 100644 (file)
@@ -8,8 +8,8 @@
 
 package org.opendaylight.openflowplugin.applications.frsync.impl.strategy;
 
+import com.google.common.util.concurrent.ListenableFuture;
 import java.util.Collections;
-import java.util.concurrent.Future;
 import org.opendaylight.openflowplugin.applications.frsync.ForwardingRulesUpdateCommitter;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table;
@@ -41,7 +41,7 @@ public class TableForwarder implements ForwardingRulesUpdateCommitter<TableFeatu
     }
 
     @Override
-    public Future<RpcResult<UpdateTableOutput>> update(final InstanceIdentifier<TableFeatures> identifier,
+    public ListenableFuture<RpcResult<UpdateTableOutput>> update(final InstanceIdentifier<TableFeatures> identifier,
                                                        final TableFeatures original, final TableFeatures update,
                                                        final InstanceIdentifier<FlowCapableNode> nodeIdent) {
         LOG.debug("Forwarding Table Update request [Tbl id, node Id {} {}",
index 32b3b615a36724080f58f3d5499aed6d3fefe430..ccba07f55a60cd21780debed74cc300d288c32ec 100644 (file)
@@ -10,14 +10,12 @@ package org.opendaylight.openflowplugin.impl.connection;
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.JdkFutureAdapters;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.MoreExecutors;
 import com.google.common.util.concurrent.SettableFuture;
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import java.util.List;
 import java.util.Objects;
-import java.util.concurrent.Future;
 import org.opendaylight.openflowjava.protocol.api.connection.ConnectionAdapter;
 import org.opendaylight.openflowplugin.api.OFConstants;
 import org.opendaylight.openflowplugin.api.openflow.md.core.ErrorHandler;
@@ -329,11 +327,7 @@ public class HandshakeManagerImpl implements HandshakeManager {
         LOG.debug("sending hello message: version{}, xid={}, version bitmap={}", helloVersion, helloXid,
                   MessageFactory.digVersions(helloInput.getElements()));
 
-        Future<RpcResult<HelloOutput>> helloResult = connectionAdapter.hello(helloInput);
-
-        ListenableFuture<RpcResult<HelloOutput>> rpcResultListenableFuture
-                = JdkFutureAdapters.listenInPoolThread(helloResult);
-        Futures.addCallback(rpcResultListenableFuture, new FutureCallback<RpcResult<HelloOutput>>() {
+        Futures.addCallback(connectionAdapter.hello(helloInput), new FutureCallback<RpcResult<HelloOutput>>() {
             @Override
             public void onSuccess(RpcResult<HelloOutput> result) {
                 if (result.isSuccessful()) {
@@ -382,9 +376,8 @@ public class HandshakeManagerImpl implements HandshakeManager {
         GetFeaturesInputBuilder featuresBuilder = new GetFeaturesInputBuilder();
         featuresBuilder.setVersion(version).setXid(xid);
         LOG.debug("sending feature request for version={} and xid={}", version, xid);
-        Future<RpcResult<GetFeaturesOutput>> featuresFuture = connectionAdapter.getFeatures(featuresBuilder.build());
 
-        Futures.addCallback(JdkFutureAdapters.listenInPoolThread(featuresFuture),
+        Futures.addCallback(connectionAdapter.getFeatures(featuresBuilder.build()),
                 new FutureCallback<RpcResult<GetFeaturesOutput>>() {
                     @Override
                     public void onSuccess(RpcResult<GetFeaturesOutput> rpcFeatures) {
index 5fb017a9ce7f291792f2a063ea918e11e52195ee..c1b3520c812718c93662f971f46e1e6c1ace0d27 100644 (file)
@@ -10,7 +10,6 @@ package org.opendaylight.openflowplugin.impl.connection.listener;
 
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.JdkFutureAdapters;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.MoreExecutors;
 import org.opendaylight.openflowplugin.api.openflow.connection.ConnectionContext;
@@ -104,8 +103,7 @@ public class HandshakeListenerImpl implements HandshakeListener {
                 .setXid(xid)
                 .setVersion(version)
                 .build();
-        return JdkFutureAdapters.listenInPoolThread(
-                this.connectionContext.getConnectionAdapter().barrier(barrierInput));
+        return this.connectionContext.getConnectionAdapter().barrier(barrierInput);
     }
 
     @Override
index 4356007af249a08ae828e1409581702670660dc1..4e5ea5ad8a2501a398c35c432c70e737458038f1 100644 (file)
@@ -9,7 +9,6 @@ package org.opendaylight.openflowplugin.impl.role;
 
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.JdkFutureAdapters;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.MoreExecutors;
 import io.netty.util.HashedWheelTimer;
@@ -19,7 +18,6 @@ import java.util.Collection;
 import java.util.HashSet;
 import java.util.concurrent.CancellationException;
 import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicReference;
 import javax.annotation.Nonnull;
@@ -161,7 +159,7 @@ public class RoleContextImpl implements RoleContext {
                     .setNode(new NodeRef(deviceInfo.getNodeInstanceIdentifier()))
                     .build();
 
-            final Future<RpcResult<SetRoleOutput>> setRoleOutputFuture = roleService.setRole(setRoleInput);
+            final ListenableFuture<RpcResult<SetRoleOutput>> setRoleOutputFuture = roleService.setRole(setRoleInput);
 
             final TimerTask timerTask = timeout -> {
                 if (!setRoleOutputFuture.isDone()) {
@@ -172,7 +170,7 @@ public class RoleContextImpl implements RoleContext {
             };
 
             timer.newTimeout(timerTask, SET_ROLE_TIMEOUT, TimeUnit.MILLISECONDS);
-            return JdkFutureAdapters.listenInPoolThread(setRoleOutputFuture);
+            return setRoleOutputFuture;
         }
 
         LOG.info("Device: {} with version: {} does not support role {}", deviceInfo, deviceInfo.getVersion(), newRole);
index ff642d73668bce060a3476cca708e96477e3c24a..86e9a31d5921b56b615388c8e5c2f479a19dd7f0 100644 (file)
@@ -15,7 +15,6 @@ import com.google.common.util.concurrent.SettableFuture;
 import java.math.BigInteger;
 import java.util.Collection;
 import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
 import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
 import org.opendaylight.openflowplugin.api.openflow.device.Xid;
@@ -53,7 +52,7 @@ public class RoleService extends AbstractSimpleService<RoleRequestInputBuilder,
         return input.build();
     }
 
-    public Future<BigInteger> getGenerationIdFromDevice(final Short version) {
+    public ListenableFuture<BigInteger> getGenerationIdFromDevice(final Short version) {
         LOG.info("getGenerationIdFromDevice called for device: {}", getDeviceInfo().getNodeId().getValue());
 
         // send a dummy no-change role request to get the generation-id of the switch
@@ -97,8 +96,7 @@ public class RoleService extends AbstractSimpleService<RoleRequestInputBuilder,
     }
 
 
-    public Future<RpcResult<SetRoleOutput>> submitRoleChange(final OfpRole ofpRole,
-                                                             final Short version,
+    public ListenableFuture<RpcResult<SetRoleOutput>> submitRoleChange(final OfpRole ofpRole, final Short version,
                                                              final BigInteger generationId) {
         LOG.info("submitRoleChange called for device:{}, role:{}",
                 getDeviceInfo().getNodeId(), ofpRole);
index 9c634b30413b9fc9b7912e22a46947dcfa019354..c8854c755a7e3756cf5e3c1444d7bf17bcce8819 100644 (file)
@@ -11,12 +11,10 @@ package org.opendaylight.openflowplugin.impl.services.batch;
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Function;
 import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.JdkFutureAdapters;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.MoreExecutors;
 import java.util.ArrayList;
 import java.util.List;
-import java.util.concurrent.Future;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.ProcessFlatBatchOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.ProcessFlatBatchOutputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.batch.batch.choice.flat.batch.add.flow._case.FlatBatchAddFlow;
@@ -168,10 +166,9 @@ public final class FlatBatchFlowAdapters {
      * @return ListenableFuture with converted result {@link ProcessFlatBatchOutput}
      */
     public static <T extends BatchFlowOutputListGrouping> ListenableFuture<RpcResult<ProcessFlatBatchOutput>>
-        convertFlowBatchFutureForChain(final Future<RpcResult<T>> resultUpdateFlowFuture,
+        convertFlowBatchFutureForChain(final ListenableFuture<RpcResult<T>> resultUpdateFlowFuture,
                                    final int currentOffset) {
-        return Futures.transform(JdkFutureAdapters.listenInPoolThread(resultUpdateFlowFuture),
-                FlatBatchFlowAdapters.convertBatchFlowResult(currentOffset),
+        return Futures.transform(resultUpdateFlowFuture, FlatBatchFlowAdapters.convertBatchFlowResult(currentOffset),
                 MoreExecutors.directExecutor());
     }
 }
index c0de5ebaa97519c0600577869ede892790807f09..bf38a2c49918df07e00be246320e45159252a70a 100644 (file)
@@ -11,12 +11,10 @@ package org.opendaylight.openflowplugin.impl.services.batch;
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Function;
 import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.JdkFutureAdapters;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.MoreExecutors;
 import java.util.ArrayList;
 import java.util.List;
-import java.util.concurrent.Future;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.ProcessFlatBatchOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.ProcessFlatBatchOutputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.batch.batch.choice.flat.batch.add.group._case.FlatBatchAddGroup;
@@ -127,17 +125,14 @@ public final class FlatBatchGroupAdapters {
     @VisibleForTesting
     static <T extends BatchGroupOutputListGrouping> Function<RpcResult<T>, RpcResult<ProcessFlatBatchOutput>>
         convertBatchGroupResult(final int stepOffset) {
-        return new Function<RpcResult<T>, RpcResult<ProcessFlatBatchOutput>>() {
-            @Override
-            public RpcResult<ProcessFlatBatchOutput> apply(final RpcResult<T> input) {
-                List<BatchFailure> batchFailures = wrapBatchGroupFailuresForFlat(input, stepOffset);
-                ProcessFlatBatchOutputBuilder outputBuilder =
-                        new ProcessFlatBatchOutputBuilder().setBatchFailure(batchFailures);
-                return RpcResultBuilder.<ProcessFlatBatchOutput>status(input.isSuccessful())
-                                       .withRpcErrors(input.getErrors())
-                                       .withResult(outputBuilder.build())
-                                       .build();
-            }
+        return input -> {
+            List<BatchFailure> batchFailures = wrapBatchGroupFailuresForFlat(input, stepOffset);
+            ProcessFlatBatchOutputBuilder outputBuilder =
+                    new ProcessFlatBatchOutputBuilder().setBatchFailure(batchFailures);
+            return RpcResultBuilder.<ProcessFlatBatchOutput>status(input.isSuccessful())
+                                   .withRpcErrors(input.getErrors())
+                                   .withResult(outputBuilder.build())
+                                   .build();
         };
     }
 
@@ -167,10 +162,9 @@ public final class FlatBatchGroupAdapters {
      * @return ListenableFuture with converted result {@link ProcessFlatBatchOutput}
      */
     public static <T extends BatchGroupOutputListGrouping> ListenableFuture<RpcResult<ProcessFlatBatchOutput>>
-        convertGroupBatchFutureForChain(final Future<RpcResult<T>> resultUpdateGroupFuture,
+        convertGroupBatchFutureForChain(final ListenableFuture<RpcResult<T>> resultUpdateGroupFuture,
                                     final int currentOffset) {
-        return Futures.transform(JdkFutureAdapters.listenInPoolThread(resultUpdateGroupFuture),
-                FlatBatchGroupAdapters.convertBatchGroupResult(currentOffset),
-                MoreExecutors.directExecutor());
+        return Futures.transform(resultUpdateGroupFuture,
+                FlatBatchGroupAdapters.convertBatchGroupResult(currentOffset), MoreExecutors.directExecutor());
     }
 }
index 584498dcbdc3527788e8fe7596d4b4747cd8cbeb..cccdea3423a2fd8c4c9809eca4ca8485fd168394 100644 (file)
@@ -11,12 +11,10 @@ package org.opendaylight.openflowplugin.impl.services.batch;
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Function;
 import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.JdkFutureAdapters;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.MoreExecutors;
 import java.util.ArrayList;
 import java.util.List;
-import java.util.concurrent.Future;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.ProcessFlatBatchOutput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.ProcessFlatBatchOutputBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.input.batch.batch.choice.flat.batch.add.meter._case.FlatBatchAddMeter;
@@ -167,9 +165,9 @@ public final class FlatBatchMeterAdapters {
      * @return ListenableFuture with converted result {@link ProcessFlatBatchOutput}
      */
     public static <T extends BatchMeterOutputListGrouping> ListenableFuture<RpcResult<ProcessFlatBatchOutput>>
-        convertMeterBatchFutureForChain(final Future<RpcResult<T>> resultUpdateMeterFuture,
+        convertMeterBatchFutureForChain(final ListenableFuture<RpcResult<T>> resultUpdateMeterFuture,
                                     final int currentOffset) {
-        return Futures.transform(JdkFutureAdapters.listenInPoolThread(resultUpdateMeterFuture),
+        return Futures.transform(resultUpdateMeterFuture,
                 FlatBatchMeterAdapters.convertBatchMeterResult(currentOffset),
                 MoreExecutors.directExecutor());
     }
index 232dce1618711e3247bc9f12a537e9f2bda78b2a..688ea8544729330ab75cc03fb816beb8b1721a8c 100644 (file)
@@ -10,7 +10,6 @@ package org.opendaylight.openflowplugin.impl.services.sal;
 import com.google.common.base.Preconditions;
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.JdkFutureAdapters;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.MoreExecutors;
 import com.google.common.util.concurrent.SettableFuture;
@@ -76,9 +75,7 @@ public class SalBundleServiceImpl implements SalBundleService {
             dataBuilder.setBundleInnerMessage(message.getBundleInnerMessage());
             experimenterInputBuilder.setExperimenterMessageOfChoice(
                     bundleAddMessageBuilder.setSalAddMessageData(dataBuilder.build()).build());
-            ListenableFuture<RpcResult<SendExperimenterOutput>> res = JdkFutureAdapters
-                    .listenInPoolThread(experimenterMessageService.sendExperimenter(experimenterInputBuilder.build()));
-            partialResults.add(res);
+            partialResults.add(experimenterMessageService.sendExperimenter(experimenterInputBuilder.build()));
         }
         return processResults(partialResults);
     }
index 5603e4c402f56f0347e3e9efb175f84dcc6b9c6c..f4e0c4be800aa74e1f3ff14bc72cc31c1357a150 100644 (file)
@@ -15,7 +15,6 @@ import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.MoreExecutors;
 import java.util.ArrayList;
 import java.util.List;
-import java.util.concurrent.Future;
 import org.opendaylight.openflowplugin.impl.services.batch.BatchPlanStep;
 import org.opendaylight.openflowplugin.impl.services.batch.BatchStepJob;
 import org.opendaylight.openflowplugin.impl.services.batch.FlatBatchFlowAdapters;
@@ -102,7 +101,7 @@ public class SalFlatBatchServiceImpl implements SalFlatBatchService {
             firedJobs.add(Futures.transformAsync(chainSummaryResult, batchJob.getStepFunction(),
                     MoreExecutors.directExecutor()));
             // if barrier after actual job is needed or it is the last job -> merge fired job results with chain result
-            if ((batchJob.getPlanStep().isBarrierAfter()) || (i == batchJobsChain.size() - 1)) {
+            if (batchJob.getPlanStep().isBarrierAfter() || i == batchJobsChain.size() - 1) {
                 firedJobs.add(0, chainSummaryResult);
                 chainSummaryResult = FlatBatchUtil.mergeJobsResultsFutures(firedJobs);
                 firedJobs.clear();
@@ -144,14 +143,14 @@ public class SalFlatBatchServiceImpl implements SalFlatBatchService {
             case FLOW_ADD:
                 final AddFlowsBatchInput addFlowsBatchInput =
                         FlatBatchFlowAdapters.adaptFlatBatchAddFlow(planStep, node);
-                final Future<RpcResult<AddFlowsBatchOutput>> resultAddFlowFuture =
+                final ListenableFuture<RpcResult<AddFlowsBatchOutput>> resultAddFlowFuture =
                         salFlowService.addFlowsBatch(addFlowsBatchInput);
                 chainOutput = FlatBatchFlowAdapters.convertFlowBatchFutureForChain(resultAddFlowFuture, currentOffset);
                 break;
             case FLOW_REMOVE:
                 final RemoveFlowsBatchInput removeFlowsBatchInput =
                         FlatBatchFlowAdapters.adaptFlatBatchRemoveFlow(planStep, node);
-                final Future<RpcResult<RemoveFlowsBatchOutput>> resultRemoveFlowFuture =
+                final ListenableFuture<RpcResult<RemoveFlowsBatchOutput>> resultRemoveFlowFuture =
                         salFlowService.removeFlowsBatch(removeFlowsBatchInput);
                 chainOutput =
                         FlatBatchFlowAdapters.convertFlowBatchFutureForChain(resultRemoveFlowFuture, currentOffset);
@@ -159,7 +158,7 @@ public class SalFlatBatchServiceImpl implements SalFlatBatchService {
             case FLOW_UPDATE:
                 final UpdateFlowsBatchInput updateFlowsBatchInput =
                         FlatBatchFlowAdapters.adaptFlatBatchUpdateFlow(planStep, node);
-                final Future<RpcResult<UpdateFlowsBatchOutput>> resultUpdateFlowFuture =
+                final ListenableFuture<RpcResult<UpdateFlowsBatchOutput>> resultUpdateFlowFuture =
                         salFlowService.updateFlowsBatch(updateFlowsBatchInput);
                 chainOutput =
                         FlatBatchFlowAdapters.convertFlowBatchFutureForChain(resultUpdateFlowFuture, currentOffset);
@@ -167,7 +166,7 @@ public class SalFlatBatchServiceImpl implements SalFlatBatchService {
             case GROUP_ADD:
                 final AddGroupsBatchInput addGroupsBatchInput =
                         FlatBatchGroupAdapters.adaptFlatBatchAddGroup(planStep, node);
-                final Future<RpcResult<AddGroupsBatchOutput>> resultAddGroupFuture =
+                final ListenableFuture<RpcResult<AddGroupsBatchOutput>> resultAddGroupFuture =
                         salGroupService.addGroupsBatch(addGroupsBatchInput);
                 chainOutput =
                         FlatBatchGroupAdapters.convertGroupBatchFutureForChain(resultAddGroupFuture, currentOffset);
@@ -175,7 +174,7 @@ public class SalFlatBatchServiceImpl implements SalFlatBatchService {
             case GROUP_REMOVE:
                 final RemoveGroupsBatchInput removeGroupsBatchInput =
                         FlatBatchGroupAdapters.adaptFlatBatchRemoveGroup(planStep, node);
-                final Future<RpcResult<RemoveGroupsBatchOutput>> resultRemoveGroupFuture =
+                final ListenableFuture<RpcResult<RemoveGroupsBatchOutput>> resultRemoveGroupFuture =
                         salGroupService.removeGroupsBatch(removeGroupsBatchInput);
                 chainOutput =
                         FlatBatchGroupAdapters.convertGroupBatchFutureForChain(resultRemoveGroupFuture, currentOffset);
@@ -183,7 +182,7 @@ public class SalFlatBatchServiceImpl implements SalFlatBatchService {
             case GROUP_UPDATE:
                 final UpdateGroupsBatchInput updateGroupsBatchInput =
                         FlatBatchGroupAdapters.adaptFlatBatchUpdateGroup(planStep, node);
-                final Future<RpcResult<UpdateGroupsBatchOutput>> resultUpdateGroupFuture =
+                final ListenableFuture<RpcResult<UpdateGroupsBatchOutput>> resultUpdateGroupFuture =
                         salGroupService.updateGroupsBatch(updateGroupsBatchInput);
                 chainOutput =
                         FlatBatchGroupAdapters.convertGroupBatchFutureForChain(resultUpdateGroupFuture, currentOffset);
@@ -191,7 +190,7 @@ public class SalFlatBatchServiceImpl implements SalFlatBatchService {
             case METER_ADD:
                 final AddMetersBatchInput addMetersBatchInput =
                         FlatBatchMeterAdapters.adaptFlatBatchAddMeter(planStep, node);
-                final Future<RpcResult<AddMetersBatchOutput>> resultAddMeterFuture =
+                final ListenableFuture<RpcResult<AddMetersBatchOutput>> resultAddMeterFuture =
                         salMeterService.addMetersBatch(addMetersBatchInput);
                 chainOutput =
                         FlatBatchMeterAdapters.convertMeterBatchFutureForChain(resultAddMeterFuture, currentOffset);
@@ -199,7 +198,7 @@ public class SalFlatBatchServiceImpl implements SalFlatBatchService {
             case METER_REMOVE:
                 final RemoveMetersBatchInput removeMetersBatchInput =
                         FlatBatchMeterAdapters.adaptFlatBatchRemoveMeter(planStep, node);
-                final Future<RpcResult<RemoveMetersBatchOutput>> resultRemoveMeterFuture =
+                final ListenableFuture<RpcResult<RemoveMetersBatchOutput>> resultRemoveMeterFuture =
                         salMeterService.removeMetersBatch(removeMetersBatchInput);
                 chainOutput =
                         FlatBatchMeterAdapters.convertMeterBatchFutureForChain(resultRemoveMeterFuture, currentOffset);
@@ -207,7 +206,7 @@ public class SalFlatBatchServiceImpl implements SalFlatBatchService {
             case METER_UPDATE:
                 final UpdateMetersBatchInput updateMetersBatchInput =
                         FlatBatchMeterAdapters.adaptFlatBatchUpdateMeter(planStep, node);
-                final Future<RpcResult<UpdateMetersBatchOutput>> resultUpdateMeterFuture =
+                final ListenableFuture<RpcResult<UpdateMetersBatchOutput>> resultUpdateMeterFuture =
                         salMeterService.updateMetersBatch(updateMetersBatchInput);
                 chainOutput =
                         FlatBatchMeterAdapters.convertMeterBatchFutureForChain(resultUpdateMeterFuture, currentOffset);
index 5c8e61848df24b5958119a2f8fc5c6b01300b99b..cbc28902edd1c2d9d851955bb1c27c1291355e74 100644 (file)
@@ -9,7 +9,6 @@ package org.opendaylight.openflowplugin.impl.services.sal;
 
 import com.google.common.base.Preconditions;
 import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.JdkFutureAdapters;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.MoreExecutors;
 import java.util.ArrayList;
@@ -76,7 +75,7 @@ public class SalFlowsBatchServiceImpl implements SalFlowsBatchService {
                     .setFlowRef(createFlowRef(input.getNode(), batchFlow))
                     .setNode(input.getNode())
                     .build();
-            resultsLot.add(JdkFutureAdapters.listenInPoolThread(salFlowService.removeFlow(removeFlowInput)));
+            resultsLot.add(salFlowService.removeFlow(removeFlowInput));
         }
 
         final ListenableFuture<RpcResult<List<BatchFailedFlowsOutput>>> commonResult =
@@ -104,7 +103,7 @@ public class SalFlowsBatchServiceImpl implements SalFlowsBatchService {
                     .setFlowRef(createFlowRef(input.getNode(), batchFlow))
                     .setNode(input.getNode())
                     .build();
-            resultsLot.add(JdkFutureAdapters.listenInPoolThread(salFlowService.addFlow(addFlowInput)));
+            resultsLot.add(salFlowService.addFlow(addFlowInput));
         }
 
         final ListenableFuture<RpcResult<List<BatchFailedFlowsOutput>>> commonResult =
@@ -146,7 +145,7 @@ public class SalFlowsBatchServiceImpl implements SalFlowsBatchService {
                     .setFlowRef(createFlowRef(input.getNode(), batchFlow))
                     .setNode(input.getNode())
                     .build();
-            resultsLot.add(JdkFutureAdapters.listenInPoolThread(salFlowService.updateFlow(updateFlowInput)));
+            resultsLot.add(salFlowService.updateFlow(updateFlowInput));
         }
 
         final ListenableFuture<RpcResult<List<BatchFailedFlowsOutput>>> commonResult =
index 8225e940659be1539431ac62a8ce0f90fa297256..fcfd26c788f49d57f5424ec3f202810d9c8e4bf5 100644 (file)
@@ -10,7 +10,6 @@ package org.opendaylight.openflowplugin.impl.services.sal;
 
 import com.google.common.base.Preconditions;
 import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.JdkFutureAdapters;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.MoreExecutors;
 import java.util.ArrayList;
@@ -80,7 +79,7 @@ public class SalGroupsBatchServiceImpl implements SalGroupsBatchService {
                     .setOriginalGroup(new OriginalGroupBuilder(batchGroup.getOriginalBatchedGroup()).build())
                     .setUpdatedGroup(new UpdatedGroupBuilder(batchGroup.getUpdatedBatchedGroup()).build())
                     .setGroupRef(createGroupRef(input.getNode(), batchGroup)).setNode(input.getNode()).build();
-            resultsLot.add(JdkFutureAdapters.listenInPoolThread(salGroupService.updateGroup(updateGroupInput)));
+            resultsLot.add(salGroupService.updateGroup(updateGroupInput));
         }
 
         final Iterable<Group> groups = batchUpdateGroups.stream()
@@ -110,7 +109,7 @@ public class SalGroupsBatchServiceImpl implements SalGroupsBatchService {
         for (BatchAddGroups addGroup : input.getBatchAddGroups()) {
             final AddGroupInput addGroupInput = new AddGroupInputBuilder(addGroup)
                     .setGroupRef(createGroupRef(input.getNode(), addGroup)).setNode(input.getNode()).build();
-            resultsLot.add(JdkFutureAdapters.listenInPoolThread(salGroupService.addGroup(addGroupInput)));
+            resultsLot.add(salGroupService.addGroup(addGroupInput));
         }
 
         final ListenableFuture<RpcResult<List<BatchFailedGroupsOutput>>> commonResult = Futures
@@ -137,7 +136,7 @@ public class SalGroupsBatchServiceImpl implements SalGroupsBatchService {
         for (BatchRemoveGroups addGroup : input.getBatchRemoveGroups()) {
             final RemoveGroupInput removeGroupInput = new RemoveGroupInputBuilder(addGroup)
                     .setGroupRef(createGroupRef(input.getNode(), addGroup)).setNode(input.getNode()).build();
-            resultsLot.add(JdkFutureAdapters.listenInPoolThread(salGroupService.removeGroup(removeGroupInput)));
+            resultsLot.add(salGroupService.removeGroup(removeGroupInput));
         }
 
         final ListenableFuture<RpcResult<List<BatchFailedGroupsOutput>>> commonResult = Futures
index f2f1f2cc0cbc6d54c60a514265282a334dd7ad52..90e83399badc7cb4430f6234a486035e2aacd227 100644 (file)
@@ -10,7 +10,6 @@ package org.opendaylight.openflowplugin.impl.services.sal;
 
 import com.google.common.base.Preconditions;
 import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.JdkFutureAdapters;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.MoreExecutors;
 import java.util.ArrayList;
@@ -82,7 +81,7 @@ public class SalMetersBatchServiceImpl implements SalMetersBatchService {
                     .setMeterRef(createMeterRef(input.getNode(), batchMeter))
                     .setNode(input.getNode())
                     .build();
-            resultsLot.add(JdkFutureAdapters.listenInPoolThread(salMeterService.updateMeter(updateMeterInput)));
+            resultsLot.add(salMeterService.updateMeter(updateMeterInput));
         }
 
         final Iterable<Meter> meters = batchUpdateMeters.stream()
@@ -114,7 +113,7 @@ public class SalMetersBatchServiceImpl implements SalMetersBatchService {
                     .setMeterRef(createMeterRef(input.getNode(), addMeter))
                     .setNode(input.getNode())
                     .build();
-            resultsLot.add(JdkFutureAdapters.listenInPoolThread(salMeterService.addMeter(addMeterInput)));
+            resultsLot.add(salMeterService.addMeter(addMeterInput));
         }
 
         final ListenableFuture<RpcResult<List<BatchFailedMetersOutput>>> commonResult =
@@ -144,7 +143,7 @@ public class SalMetersBatchServiceImpl implements SalMetersBatchService {
                     .setMeterRef(createMeterRef(input.getNode(), addMeter))
                     .setNode(input.getNode())
                     .build();
-            resultsLot.add(JdkFutureAdapters.listenInPoolThread(salMeterService.removeMeter(removeMeterInput)));
+            resultsLot.add(salMeterService.removeMeter(removeMeterInput));
         }
 
         final ListenableFuture<RpcResult<List<BatchFailedMetersOutput>>> commonResult =
index 15079311a25f302cce8a0b99bc34ae9ea6a6f3b9..8a48d9637865c9775e909555a2e0daacea35926a 100644 (file)
@@ -1,4 +1,4 @@
-/**
+/*
  * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
  *
  * This program and the accompanying materials are made available under the
@@ -9,11 +9,9 @@ package org.opendaylight.openflowplugin.impl.services.sal;
 
 import com.google.common.base.Preconditions;
 import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.JdkFutureAdapters;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.MoreExecutors;
 import java.math.BigInteger;
-import java.util.concurrent.Future;
 import org.opendaylight.openflowplugin.api.openflow.connection.ConnectionContext.CONNECTION_STATE;
 import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
 import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
@@ -80,17 +78,13 @@ public final class SalRoleServiceImpl extends AbstractSimpleService<SetRoleInput
     private ListenableFuture<RpcResult<SetRoleOutput>> tryToChangeRole(final OfpRole role) {
         LOG.info("RoleChangeTask called on device:{} OFPRole:{}", getDeviceInfo().getNodeId().getValue(), role);
 
-        final Future<BigInteger> generationFuture = roleService.getGenerationIdFromDevice(getVersion());
-
-        return Futures.transformAsync(JdkFutureAdapters.listenInPoolThread(generationFuture), generationId -> {
+        return Futures.transformAsync(roleService.getGenerationIdFromDevice(getVersion()), generationId -> {
             LOG.debug("RoleChangeTask, GenerationIdFromDevice from device {} is {}",
                     getDeviceInfo().getNodeId().getValue(), generationId);
             final BigInteger nextGenerationId = getNextGenerationId(generationId);
             LOG.debug("nextGenerationId received from device:{} is {}",
                     getDeviceInfo().getNodeId().getValue(), nextGenerationId);
-            final Future<RpcResult<SetRoleOutput>> submitRoleFuture =
-                    roleService.submitRoleChange(role, getVersion(), nextGenerationId);
-            return JdkFutureAdapters.listenInPoolThread(submitRoleFuture);
+            return roleService.submitRoleChange(role, getVersion(), nextGenerationId);
         }, MoreExecutors.directExecutor());
     }
 
index 09bf3596fa9d5d782e1524e70a45646677996da9..5ba0697b480ff645de775add38947068f891c441 100644 (file)
@@ -10,7 +10,6 @@ package org.opendaylight.openflowplugin.impl.util;
 
 import com.google.common.base.Function;
 import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.JdkFutureAdapters;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.MoreExecutors;
 import org.apache.commons.lang3.tuple.MutablePair;
@@ -55,7 +54,7 @@ public final class BarrierUtil {
             interInput -> {
                 resultPair.setLeft(interInput);
                 final SendBarrierInput barrierInput = createSendBarrierInput(nodeRef);
-                return JdkFutureAdapters.listenInPoolThread(transactionService.sendBarrier(barrierInput));
+                return transactionService.sendBarrier(barrierInput);
             }, MoreExecutors.directExecutor());
         // store barrier result and return initiated pair
         final ListenableFuture<Pair<RpcResult<T>, RpcResult<SendBarrierOutput>>> compositeResult = Futures.transform(
index fac568b683802cb7fa32f504ba4b6a76d72c0579..134a9804061358ae930f0744620f109b10c8f78f 100644 (file)
@@ -9,7 +9,6 @@ package org.opendaylight.openflowplugin.testcommon;
 
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.JdkFutureAdapters;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.MoreExecutors;
 import java.math.BigInteger;
@@ -100,8 +99,7 @@ public class DropTestRpcSender extends AbstractDropTest {
         if (LOG.isDebugEnabled()) {
             LOG.debug("onPacketReceived - About to write flow (via SalFlowService) {}", flow);
         }
-        ListenableFuture<RpcResult<AddFlowOutput>> result =
-                JdkFutureAdapters.listenInPoolThread(flowService.addFlow(flow));
+        ListenableFuture<RpcResult<AddFlowOutput>> result = flowService.addFlow(flow);
         Futures.addCallback(result, new FutureCallback<RpcResult<AddFlowOutput>>() {
             @Override
             public void onSuccess(final RpcResult<AddFlowOutput> result) {