Replace deprecated Futures.addCallback by the newer version 50/64050/1
authorDavid Suarez <david.suarez.fuentes@gmail.com>
Mon, 9 Oct 2017 08:21:47 +0000 (10:21 +0200)
committerDavid Suarez <david.suarez.fuentes@gmail.com>
Mon, 9 Oct 2017 08:21:47 +0000 (10:21 +0200)
The method addCallback(ListenableFuture<V> future,
FutureCallback<? super V> callback) is deprecated and will be replaced
by a new its new version addCallback(ListenableFuture<V> future,
FutureCallback<? super V> callback, Executor executor) in April 2018.

Some other minor changes to pass the new version of checkstyle.

Change-Id: I0aaf43e913ab241fd74e53ff91d7852e77b699b3
Signed-off-by: David Suarez <david.suarez.fuentes@gmail.com>
23 files changed:
netconf/mdsal-netconf-monitoring/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/monitoring/MonitoringToMdsalWriter.java
netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/notification/NotificationToMdsalWriter.java
netconf/mdsal-netconf-yang-library/src/main/java/org/opendaylight/netconf/mdsal/yang/library/SchemaServiceToMdsalWriter.java
netconf/netconf-console/src/main/java/org/opendaylight/netconf/console/impl/NetconfCommandsImpl.java
netconf/netconf-netty-util/src/test/java/org/opendaylight/netconf/nettyutil/handler/ssh/client/AsyncSshHandlerTest.java
netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/NetconfTopologyManager.java
netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/RemoteDeviceConnectorImpl.java
netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/actors/NetconfNodeActor.java
netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/actors/ReadAdapter.java
netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/actors/WriteAdapter.java
netconf/netconf-topology/src/main/java/org/opendaylight/netconf/topology/AbstractNetconfTopology.java
netconf/netconf-topology/src/main/java/org/opendaylight/netconf/topology/impl/NetconfConnectorFactoryImpl.java
netconf/netconf-topology/src/main/java/org/opendaylight/netconf/topology/impl/NetconfTopologyImpl.java
netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/NetconfDevice.java
netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/KeepaliveSalFacade.java
netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/NetconfDeviceTopologyAdapter.java
netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/tx/AbstractWriteTx.java
netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/tx/WriteCandidateTx.java
netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/util/NetconfBaseOps.java
netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/util/NetconfTopologyRPCProvider.java
netconf/yanglib/src/main/java/org/opendaylight/yanglib/impl/YangLibProvider.java
restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/impl/BatchedExistenceCheck.java
restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/impl/BrokerFacade.java

index 30e2655924086de8b934c3e1833a77effffbbbed..0bd79fde0ce6a734ca8540e0738dcf64a87347ee 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.controller.config.yang.netconf.mdsal.monitoring;
 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.MoreExecutors;
 import java.util.Collection;
 import java.util.function.Consumer;
 import javax.annotation.Nullable;
@@ -112,7 +113,7 @@ public final class MonitoringToMdsalWriter implements AutoCloseable, NetconfMoni
             public void onFailure(Throwable throwable) {
                 LOG.warn("Unable to update netconf state", throwable);
             }
-        });
+        }, MoreExecutors.directExecutor());
     }
 
     private static void updateSessions(WriteTransaction tx, Collection<Session> sessions) {
index 1535b987f983eb718aee58984bc0511d78f1d755..d5ba353fe64ab4ed812c330c859d0104ddfe826a 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.controller.config.yang.netconf.mdsal.notification;
 import com.google.common.util.concurrent.CheckedFuture;
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.MoreExecutors;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
@@ -61,7 +62,7 @@ public final class NotificationToMdsalWriter implements AutoCloseable, NetconfNo
             public void onFailure(Throwable throwable) {
                 LOG.warn("Unable to clear streams", throwable);
             }
-        });
+        }, MoreExecutors.directExecutor());
 
         notificationRegistration.close();
     }
index 9690ad3e243354ec7294d2c494b417845857186f..d0d383a2bb0dbfe28f2d59ef3cf94f4dc2aa163b 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.netconf.mdsal.yang.library;
 import com.google.common.collect.Lists;
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.MoreExecutors;
 import java.util.List;
 import java.util.Set;
 import java.util.concurrent.atomic.AtomicInteger;
@@ -91,7 +92,7 @@ public class SchemaServiceToMdsalWriter implements SchemaContextListener, AutoCl
             public void onFailure(final Throwable throwable) {
                 LOG.warn("Failed to update modules state", throwable);
             }
-        });
+        }, MoreExecutors.directExecutor());
     }
 
     private ModulesState createModuleStateFromModules(final Set<Module> modules) {
index 47417bc7372597cb9825bd5d6f723d72b13bbcfb..763cbf6050fce640d8c621dc4f8e77bed87ef873 100644 (file)
@@ -12,6 +12,7 @@ import com.google.common.base.Strings;
 import com.google.common.collect.ImmutableList;
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.MoreExecutors;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -160,7 +161,7 @@ public class NetconfCommandsImpl implements NetconfCommands {
                 LOG.error("Failed to created NetconfNode={}", netconfNode);
                 throw new RuntimeException(throwable);
             }
-        });
+        }, MoreExecutors.directExecutor());
     }
 
     @Override
@@ -242,7 +243,7 @@ public class NetconfCommandsImpl implements NetconfCommands {
                     LOG.error("Failed to updated NetconfNode={}", netconfNode);
                     throw new RuntimeException(throwable);
                 }
-            });
+            }, MoreExecutors.directExecutor());
 
             return "NETCONF node: " + netconfNodeId + " updated successfully.";
         } else {
index f1806b43cef396659dea16e04f50aa9d6c19d8ed..df9ece7dd92983cfd72285b789a1055f7d843f83 100644 (file)
@@ -25,6 +25,7 @@ import static org.mockito.Mockito.verifyZeroInteractions;
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
+import com.google.common.util.concurrent.MoreExecutors;
 import com.google.common.util.concurrent.SettableFuture;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
@@ -120,7 +121,7 @@ public class AsyncSshHandlerTest {
             public void onSuccess(final SshFutureListener<AuthFuture> result) {
                 sshAuthListener = result;
             }
-        });
+        }, MoreExecutors.directExecutor());
         doReturn(authFuture).when(authHandler).authenticate(any(ClientSession.class));
     }
 
@@ -169,7 +170,7 @@ public class AsyncSshHandlerTest {
             public void onSuccess(final SshFutureListener<ConnectFuture> result) {
                 sshConnectListener = result;
             }
-        });
+        }, MoreExecutors.directExecutor());
         doReturn(connectFuture).when(sshClient).connect("usr", remoteAddress);
     }
 
@@ -227,7 +228,7 @@ public class AsyncSshHandlerTest {
                 doReturn(true).when(asyncOut).isClosed();
                 result.operationComplete(mockedReadFuture);
             }
-        });
+        }, MoreExecutors.directExecutor());
 
         final IoOutputStream asyncIn = getMockedIoOutputStream();
         final ChannelSubsystem subsystemChannel = getMockedSubsystemChannel(asyncOut, asyncIn);
@@ -256,7 +257,7 @@ public class AsyncSshHandlerTest {
                         .removeListener(Matchers.<SshFutureListener<IoReadFuture>>any());
                 result.operationComplete(mockedReadFuture);
             }
-        });
+        }, MoreExecutors.directExecutor());
 
         final IoOutputStream asyncIn = getMockedIoOutputStream();
         final ChannelSubsystem subsystemChannel = getMockedSubsystemChannel(asyncOut, asyncIn);
@@ -308,7 +309,7 @@ public class AsyncSshHandlerTest {
                 doReturn(true).when(asyncIn).isClosed();
                 result.operationComplete(ioWriteFuture);
             }
-        });
+        }, MoreExecutors.directExecutor());
 
         final ChannelSubsystem subsystemChannel = getMockedSubsystemChannel(asyncOut, asyncIn);
         final ClientSession sshSession = getMockedSshSession(subsystemChannel);
@@ -463,7 +464,7 @@ public class AsyncSshHandlerTest {
                 doReturn(true).when(closeFuture).isClosed();
                 result.operationComplete(closeFuture);
             }
-        });
+        }, MoreExecutors.directExecutor());
         doReturn(closeFuture).when(sshSession).close(false);
 
         doReturn(subsystemChannel).when(sshSession).createSubsystemChannel(anyString());
@@ -484,7 +485,7 @@ public class AsyncSshHandlerTest {
             public void onSuccess(final SshFutureListener<OpenFuture> result) {
                 sshChannelOpenListener = result;
             }
-        });
+        }, MoreExecutors.directExecutor());
 
         doReturn(asyncOut).when(subsystemChannel).getAsyncOut();
 
@@ -504,7 +505,7 @@ public class AsyncSshHandlerTest {
             public void onSuccess(final SshFutureListener<IoWriteFuture> result) {
                 result.operationComplete(ioWriteFuture);
             }
-        });
+        }, MoreExecutors.directExecutor());
 
         doReturn(ioWriteFuture).when(mock).write(any(Buffer.class));
         doReturn(false).when(mock).isClosed();
@@ -527,7 +528,7 @@ public class AsyncSshHandlerTest {
             public void onSuccess(final SshFutureListener<IoReadFuture> result) {
                 result.operationComplete(ioReadFuture);
             }
-        });
+        }, MoreExecutors.directExecutor());
 
         doReturn(ioReadFuture).when(mock).read(any(Buffer.class));
         doReturn(false).when(mock).isClosed();
index 1018be37cd88f70baa40415e04a7249769f7dcb5..48f063e92049400aa34995a201e3d27da2d67a51 100644 (file)
@@ -13,6 +13,7 @@ import akka.util.Timeout;
 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.MoreExecutors;
 import io.netty.util.concurrent.EventExecutor;
 import java.util.Collection;
 import java.util.HashMap;
@@ -255,7 +256,7 @@ public class NetconfTopologyManager
             public void onFailure(@Nonnull final Throwable throwable) {
                 LOG.error("Unable to initialize netconf-topology, {}", throwable);
             }
-        });
+        }, MoreExecutors.directExecutor());
 
         LOG.debug("Registering datastore listener");
         return dataBroker.registerDataTreeChangeListener(
index acf3854a83c7289b3b9bd91ae56b1b2217043d16..826342d23f2f4fe12881860238d385c74eb4dc60 100644 (file)
@@ -16,6 +16,7 @@ import com.google.common.collect.Lists;
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
+import com.google.common.util.concurrent.MoreExecutors;
 import io.netty.util.concurrent.EventExecutor;
 import java.math.BigDecimal;
 import java.net.InetSocketAddress;
@@ -124,7 +125,7 @@ public class RemoteDeviceConnectorImpl implements RemoteDeviceConnector {
             public void onFailure(@Nullable final Throwable throwable) {
                 LOG.error("{}: Connector failed, {}", remoteDeviceId, throwable);
             }
-        });
+        }, MoreExecutors.directExecutor());
     }
 
     @SuppressWarnings("checkstyle:IllegalCatch")
index 6d1e7717168bdf1780c42400909566ba1d04281e..2e46cd4a1bfbb033f2b5948116503124eb3bf567 100644 (file)
@@ -15,6 +15,7 @@ import akka.util.Timeout;
 import com.google.common.util.concurrent.CheckedFuture;
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.MoreExecutors;
 import java.io.IOException;
 import java.util.List;
 import java.util.stream.Collectors;
@@ -214,7 +215,7 @@ public class NetconfNodeActor extends UntypedActor {
             public void onFailure(@Nonnull final Throwable throwable) {
                 sender.tell(throwable, getSelf());
             }
-        });
+        }, MoreExecutors.directExecutor());
     }
 
     private void invokeSlaveRpc(final SchemaPath schemaPath, final NormalizedNodeMessage normalizedNodeMessage,
@@ -242,7 +243,7 @@ public class NetconfNodeActor extends UntypedActor {
             public void onFailure(@Nonnull final Throwable throwable) {
                 recipient.tell(throwable, getSelf());
             }
-        });
+        }, MoreExecutors.directExecutor());
     }
 
     private void registerSlaveMountPoint(final ActorRef masterReference) {
@@ -268,7 +269,7 @@ public class NetconfNodeActor extends UntypedActor {
             public void onFailure(@Nonnull final Throwable throwable) {
                 LOG.error("{}: Failed to register mount point: {}", id, throwable);
             }
-        });
+        }, MoreExecutors.directExecutor());
     }
 
     private DOMRpcService getDOMRpcService(final ActorRef masterReference) {
index d36062459d35670fe61ed5bd56890b62103a4dae..3d881e65def18fd6ff0a15c21064922e8a2bee45 100644 (file)
@@ -13,6 +13,7 @@ import com.google.common.base.Optional;
 import com.google.common.util.concurrent.CheckedFuture;
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.MoreExecutors;
 import javax.annotation.Nonnull;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
@@ -67,7 +68,7 @@ class ReadAdapter {
             public void onFailure(@Nonnull final Throwable throwable) {
                 sender.tell(throwable, self);
             }
-        });
+        }, MoreExecutors.directExecutor());
     }
 
     private void exists(final YangInstanceIdentifier path, final LogicalDatastoreType store, final ActorRef sender,
@@ -87,6 +88,6 @@ class ReadAdapter {
             public void onFailure(@Nonnull final Throwable throwable) {
                 sender.tell(throwable, self);
             }
-        });
+        }, MoreExecutors.directExecutor());
     }
 }
index 4cf51eead297a3fbaff603a23ab22df699227a68..08ca01bb960b4c77426d7490f166048c541a8b08 100644 (file)
@@ -13,6 +13,7 @@ import akka.actor.ActorRef;
 import com.google.common.util.concurrent.CheckedFuture;
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.MoreExecutors;
 import javax.annotation.Nonnull;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
@@ -50,7 +51,7 @@ class WriteAdapter {
             public void onFailure(@Nonnull final Throwable throwable) {
                 requester.tell(throwable, self);
             }
-        });
+        }, MoreExecutors.directExecutor());
     }
 
     public void handle(final Object message, final ActorRef sender, final ActorContext context, final ActorRef self) {
index 4362b92e645cf67aff50e4c7c666b0ebcd32b106..d430ce2f1c4cc2243cd12c0adfddbeaa513358ef 100644 (file)
@@ -15,6 +15,7 @@ import com.google.common.collect.Lists;
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
+import com.google.common.util.concurrent.MoreExecutors;
 import io.netty.util.concurrent.EventExecutor;
 import java.io.File;
 import java.math.BigDecimal;
@@ -244,7 +245,7 @@ public abstract class AbstractNetconfTopology implements NetconfTopology {
                 LOG.error("Connector for : " + nodeId.getValue() + " failed");
                 // remove this node from active connectors?
             }
-        });
+        }, MoreExecutors.directExecutor());
 
         return future;
     }
index c925a8828f012ceaa3ca7d4e6315cdb37205ba55..c644286504d6248fb034bffd700df7b455c42126 100644 (file)
@@ -10,6 +10,7 @@ package org.opendaylight.netconf.topology.impl;
 import com.google.common.util.concurrent.CheckedFuture;
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.MoreExecutors;
 import javax.annotation.Nullable;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
@@ -90,7 +91,7 @@ public class NetconfConnectorFactoryImpl implements NetconfConnectorFactory {
             public void onFailure(final Throwable throwable) {
                 LOG.error("Node {} creation failed: {}", instanceName, throwable);
             }
-        });
+        }, MoreExecutors.directExecutor());
         return node;
     }
 }
\ No newline at end of file
index 263e524bd7541a10a28ce10a6eff13223ae272e2..a17369f144accdd5b3e9f89ead6910a7d0162d8a 100644 (file)
@@ -10,6 +10,7 @@ package org.opendaylight.netconf.topology.impl;
 
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.MoreExecutors;
 import io.netty.util.concurrent.EventExecutor;
 import java.util.Collection;
 import javax.annotation.Nonnull;
@@ -96,7 +97,7 @@ public class NetconfTopologyImpl extends AbstractNetconfTopology
             public void onFailure(final Throwable throwable) {
                 LOG.error("Unable to initialize netconf-topology, {}", throwable);
             }
-        });
+        }, MoreExecutors.directExecutor());
 
         LOG.debug("Registering datastore listener");
         datastoreListenerRegistration =
index b78011460e4e81f4544c79863184e7f7089ea429..22fa4cb92ed49cbd25c38ed9fa119b3f814b0783 100644 (file)
@@ -165,7 +165,7 @@ public class NetconfDevice
             }
         };
 
-        Futures.addCallback(sourceResolverFuture, resolvedSourceCallback);
+        Futures.addCallback(sourceResolverFuture, resolvedSourceCallback, MoreExecutors.directExecutor());
     }
 
     private void registerToBaseNetconfStream(final NetconfDeviceRpc deviceRpc,
@@ -206,7 +206,7 @@ public class NetconfDevice
                 LOG.warn("Unable to subscribe to base notification stream. Schemas will not be reloaded on the fly",
                         throwable);
             }
-        });
+        }, MoreExecutors.directExecutor());
     }
 
     private boolean shouldListenOnSchemaChange(final NetconfSessionPreferences remoteSessionCapabilities) {
index b77e7269e553ae6dc11837c4ef45ab309e3dccc9..a92ad42c709044a031e9c65095358a4c16b665fd 100644 (file)
@@ -16,6 +16,7 @@ import com.google.common.base.Preconditions;
 import com.google.common.util.concurrent.CheckedFuture;
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.MoreExecutors;
 import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.ScheduledFuture;
 import java.util.concurrent.TimeUnit;
@@ -191,7 +192,8 @@ public final class KeepaliveSalFacade implements RemoteDeviceHandler<NetconfSess
                 if (previousKeepalive != null && !previousKeepalive.isDone()) {
                     onFailure(new IllegalStateException("Previous keepalive timed out"));
                 } else {
-                    Futures.addCallback(currentDeviceRpc.invokeRpc(PATH, KEEPALIVE_PAYLOAD), this);
+                    Futures.addCallback(currentDeviceRpc.invokeRpc(PATH, KEEPALIVE_PAYLOAD), this,
+                                        MoreExecutors.directExecutor());
                 }
             } catch (NullPointerException e) {
                 LOG.debug("{}: Skipping keepalive while reconnecting", id);
@@ -296,7 +298,8 @@ public final class KeepaliveSalFacade implements RemoteDeviceHandler<NetconfSess
                                                                       final NormalizedNode<?, ?> input) {
             final CheckedFuture<DOMRpcResult, DOMRpcException> domRpcResultDOMRpcExceptionCheckedFuture =
                     deviceRpc.invokeRpc(type, input);
-            Futures.addCallback(domRpcResultDOMRpcExceptionCheckedFuture, resetKeepaliveTask);
+            Futures.addCallback(domRpcResultDOMRpcExceptionCheckedFuture, resetKeepaliveTask,
+                                MoreExecutors.directExecutor());
 
             final RequestTimeoutTask timeoutTask = new RequestTimeoutTask(domRpcResultDOMRpcExceptionCheckedFuture);
             executor.schedule(timeoutTask, defaultRequestTimeoutMillis, TimeUnit.MILLISECONDS);
index 7667ba28bcb924a904175e9e32fd3e7dbebead17..41609b89c4fdd52950b336440adc643a52ee786b 100644 (file)
@@ -12,6 +12,7 @@ import com.google.common.base.Preconditions;
 import com.google.common.util.concurrent.CheckedFuture;
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.MoreExecutors;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
@@ -242,8 +243,7 @@ public final class NetconfDeviceTopologyAdapter implements AutoCloseable {
                 throw new IllegalStateException(
                         id + "  Transaction(" + txType + ") not committed correctly", throwable);
             }
-        });
-
+        }, MoreExecutors.directExecutor());
     }
 
     private static Node getNodeWithId(final RemoteDeviceId id) {
index 14926d99f20d0e45b494c572970ecd04ab924b13..7d6dd3e9e862f3cc8e41caea0428f0e98563d3b1 100644 (file)
@@ -14,6 +14,7 @@ import com.google.common.collect.Lists;
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
+import com.google.common.util.concurrent.MoreExecutors;
 import com.google.common.util.concurrent.SettableFuture;
 import java.util.List;
 import java.util.concurrent.CopyOnWriteArrayList;
@@ -169,7 +170,7 @@ public abstract class AbstractWriteTx implements DOMDataWriteTransaction {
             public void onFailure(final Throwable throwable) {
                 listeners.forEach(listener -> listener.onTransactionFailed(AbstractWriteTx.this, throwable));
             }
-        });
+        }, MoreExecutors.directExecutor());
         return result;
     }
 
@@ -218,7 +219,7 @@ public abstract class AbstractWriteTx implements DOMDataWriteTransaction {
                                 DocumentedException.ErrorSeverity.ERROR);
                 transformed.setException(exception);
             }
-        });
+        }, MoreExecutors.directExecutor());
 
         return transformed;
     }
index febbff6cec99aebe12942a64b0935ea64129a612..1d429022c1da73a611224a993030f2f2fa776987 100644 (file)
@@ -15,6 +15,7 @@ import com.google.common.util.concurrent.CheckedFuture;
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
+import com.google.common.util.concurrent.MoreExecutors;
 import javax.annotation.Nullable;
 import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
@@ -131,7 +132,7 @@ public class WriteCandidateTx extends AbstractWriteTx {
                 // cleanup is trying to do unlock, but this will fail
                 cleanup();
             }
-        });
+        }, MoreExecutors.directExecutor());
 
         return txResult;
     }
index debd460936ecfb524da81fd2385688a47138fd28..3dee33869ede81d72aa3f8572c8ef43d5f77be8c 100644 (file)
@@ -33,6 +33,7 @@ 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.ListenableFuture;
+import com.google.common.util.concurrent.MoreExecutors;
 import org.opendaylight.controller.md.sal.dom.api.DOMRpcResult;
 import org.opendaylight.controller.md.sal.dom.api.DOMRpcService;
 import org.opendaylight.netconf.sal.connect.netconf.sal.KeepaliveSalFacade.KeepaliveDOMRpcService;
@@ -79,14 +80,14 @@ public final class NetconfBaseOps {
 
         final ListenableFuture<DOMRpcResult> future =
                 rpc.invokeRpc(toPath(NETCONF_LOCK_QNAME), getLockContent(datastore));
-        Futures.addCallback(future, callback);
+        Futures.addCallback(future, callback, MoreExecutors.directExecutor());
         return future;
     }
 
     public ListenableFuture<DOMRpcResult> lockCandidate(final FutureCallback<DOMRpcResult> callback) {
         final ListenableFuture<DOMRpcResult> future =
                 rpc.invokeRpc(toPath(NETCONF_LOCK_QNAME), getLockContent(NETCONF_CANDIDATE_QNAME));
-        Futures.addCallback(future, callback);
+        Futures.addCallback(future, callback, MoreExecutors.directExecutor());
         return future;
     }
 
@@ -94,7 +95,7 @@ public final class NetconfBaseOps {
     public ListenableFuture<DOMRpcResult> lockRunning(final FutureCallback<DOMRpcResult> callback) {
         final ListenableFuture<DOMRpcResult> future =
                 rpc.invokeRpc(toPath(NETCONF_LOCK_QNAME), getLockContent(NETCONF_RUNNING_QNAME));
-        Futures.addCallback(future, callback);
+        Futures.addCallback(future, callback, MoreExecutors.directExecutor());
         return future;
     }
 
@@ -104,21 +105,21 @@ public final class NetconfBaseOps {
 
         final ListenableFuture<DOMRpcResult> future =
                 rpc.invokeRpc(toPath(NETCONF_UNLOCK_QNAME), getUnLockContent(datastore));
-        Futures.addCallback(future, callback);
+        Futures.addCallback(future, callback, MoreExecutors.directExecutor());
         return future;
     }
 
     public ListenableFuture<DOMRpcResult> unlockRunning(final FutureCallback<DOMRpcResult> callback) {
         final ListenableFuture<DOMRpcResult> future =
                 rpc.invokeRpc(toPath(NETCONF_UNLOCK_QNAME), getUnLockContent(NETCONF_RUNNING_QNAME));
-        Futures.addCallback(future, callback);
+        Futures.addCallback(future, callback, MoreExecutors.directExecutor());
         return future;
     }
 
     public ListenableFuture<DOMRpcResult> unlockCandidate(final FutureCallback<DOMRpcResult> callback) {
         final ListenableFuture<DOMRpcResult> future =
                 rpc.invokeRpc(toPath(NETCONF_UNLOCK_QNAME), getUnLockContent(NETCONF_CANDIDATE_QNAME));
-        Futures.addCallback(future, callback);
+        Futures.addCallback(future, callback, MoreExecutors.directExecutor());
         return future;
     }
 
@@ -126,7 +127,7 @@ public final class NetconfBaseOps {
         Preconditions.checkNotNull(callback);
 
         final ListenableFuture<DOMRpcResult> future = rpc.invokeRpc(toPath(NETCONF_DISCARD_CHANGES_QNAME), null);
-        Futures.addCallback(future, callback);
+        Futures.addCallback(future, callback, MoreExecutors.directExecutor());
         return future;
     }
 
@@ -135,7 +136,7 @@ public final class NetconfBaseOps {
 
         final ListenableFuture<DOMRpcResult> future = rpc.invokeRpc(
             toPath(NetconfMessageTransformUtil.NETCONF_COMMIT_QNAME), NetconfMessageTransformUtil.COMMIT_RPC_CONTENT);
-        Futures.addCallback(future, callback);
+        Futures.addCallback(future, callback, MoreExecutors.directExecutor());
         return future;
     }
 
@@ -145,7 +146,7 @@ public final class NetconfBaseOps {
 
         final ListenableFuture<DOMRpcResult> future = rpc.invokeRpc(
                 toPath(NetconfMessageTransformUtil.NETCONF_VALIDATE_QNAME), getValidateContent(datastore));
-        Futures.addCallback(future, callback);
+        Futures.addCallback(future, callback, MoreExecutors.directExecutor());
         return future;
     }
 
@@ -166,7 +167,7 @@ public final class NetconfBaseOps {
 
         final ListenableFuture<DOMRpcResult> future = rpc.invokeRpc(
                 toPath(NetconfMessageTransformUtil.NETCONF_COPY_CONFIG_QNAME), getCopyConfigContent(source, target));
-        Futures.addCallback(future, callback);
+        Futures.addCallback(future, callback, MoreExecutors.directExecutor());
         return future;
     }
 
@@ -189,7 +190,7 @@ public final class NetconfBaseOps {
                             NetconfMessageTransformUtil.wrap(NETCONF_GET_CONFIG_QNAME, getSourceNode(datastore)));
         }
 
-        Futures.addCallback(future, callback);
+        Futures.addCallback(future, callback, MoreExecutors.directExecutor());
         return future;
     }
 
@@ -281,7 +282,7 @@ public final class NetconfBaseOps {
         final ListenableFuture<DOMRpcResult> future = rpc.invokeRpc(toPath(NETCONF_EDIT_CONFIG_QNAME),
                 getEditConfigContent(datastore, editStructure, modifyAction, rollback));
 
-        Futures.addCallback(future, callback);
+        Futures.addCallback(future, callback, MoreExecutors.directExecutor());
         return future;
     }
 
index a26401efc599ed320e1c805428c6d7448da43d6a..4edbedf6c265830028c82a72af1527aadd75afe5 100644 (file)
@@ -11,6 +11,7 @@ import com.google.common.base.Preconditions;
 import com.google.common.util.concurrent.CheckedFuture;
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.MoreExecutors;
 import com.google.common.util.concurrent.SettableFuture;
 import java.util.concurrent.Future;
 import org.opendaylight.aaa.encrypt.AAAEncryptionService;
@@ -101,7 +102,7 @@ public class NetconfTopologyRPCProvider implements NetconfNodeTopologyService {
                 LOG.error("add-netconf-node RPC: Unable to add netconf node.", exception);
                 futureResult.setException(exception);
             }
-        });
+        }, MoreExecutors.directExecutor());
     }
 
 }
index f5a648a91f86d0b7d464511d5f14a719210ce52e..df88860c1f7e757ce548c2f0bb171b84a4c661e2 100644 (file)
@@ -14,6 +14,7 @@ import com.google.common.base.Strings;
 import com.google.common.collect.Iterables;
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.MoreExecutors;
 import java.io.File;
 import java.util.ArrayList;
 import java.util.List;
@@ -145,7 +146,7 @@ public class YangLibProvider implements AutoCloseable, SchemaSourceListener {
             public void onFailure(final Throwable throwable) {
                 LOG.warn("Unable to update modules state", throwable);
             }
-        });
+        }, MoreExecutors.directExecutor());
     }
 
     @Override
@@ -174,7 +175,7 @@ public class YangLibProvider implements AutoCloseable, SchemaSourceListener {
             public void onFailure(final Throwable throwable) {
                 LOG.warn("Unable to update modules state", throwable);
             }
-        });
+        }, MoreExecutors.directExecutor());
     }
 
 
index a1765e56d822ba0f13ec02add02ff21586e16bb0..f36caa0d2dc46a965b1644b16f0359dc3f40627f 100644 (file)
@@ -10,6 +10,7 @@ package org.opendaylight.netconf.sal.restconf.impl;
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
+import com.google.common.util.concurrent.MoreExecutors;
 import com.google.common.util.concurrent.SettableFuture;
 import java.util.AbstractMap.SimpleImmutableEntry;
 import java.util.Collection;
@@ -59,7 +60,7 @@ final class BatchedExistenceCheck {
 
                     ret.complete(path, ReadFailedException.MAPPER.apply(e));
                 }
-            });
+            }, MoreExecutors.directExecutor());
         }
 
         return ret;
index d2fd19307991a4c3acc1c9ec6561fc9a32011396..e1178633136e8e90babd43e8d1ccb68946f6525e 100644 (file)
@@ -16,6 +16,7 @@ import com.google.common.collect.ImmutableList;
 import com.google.common.util.concurrent.CheckedFuture;
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.MoreExecutors;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
@@ -462,7 +463,7 @@ public class BrokerFacade {
                         new RestconfError(ErrorType.APPLICATION, ErrorTag.OPERATION_FAILED, throwable.getMessage()))));
                 waiter.countDown();
             }
-        });
+        }, MoreExecutors.directExecutor());
 
         waiter.await();
         return status.getStatus();