From 528bb2ddb15b06b081695f61022c0e4eedb68fcb Mon Sep 17 00:00:00 2001 From: David Suarez Date: Mon, 9 Oct 2017 10:21:47 +0200 Subject: [PATCH] Replace deprecated Futures.addCallback by the newer version The method addCallback(ListenableFuture future, FutureCallback callback) is deprecated and will be replaced by a new its new version addCallback(ListenableFuture future, FutureCallback 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 --- .../monitoring/MonitoringToMdsalWriter.java | 3 ++- .../NotificationToMdsalWriter.java | 3 ++- .../library/SchemaServiceToMdsalWriter.java | 3 ++- .../console/impl/NetconfCommandsImpl.java | 5 ++-- .../ssh/client/AsyncSshHandlerTest.java | 19 +++++++------- .../impl/NetconfTopologyManager.java | 3 ++- .../impl/RemoteDeviceConnectorImpl.java | 3 ++- .../impl/actors/NetconfNodeActor.java | 7 +++--- .../singleton/impl/actors/ReadAdapter.java | 5 ++-- .../singleton/impl/actors/WriteAdapter.java | 3 ++- .../topology/AbstractNetconfTopology.java | 3 ++- .../impl/NetconfConnectorFactoryImpl.java | 3 ++- .../topology/impl/NetconfTopologyImpl.java | 3 ++- .../sal/connect/netconf/NetconfDevice.java | 4 +-- .../netconf/sal/KeepaliveSalFacade.java | 7 ++++-- .../sal/NetconfDeviceTopologyAdapter.java | 4 +-- .../netconf/sal/tx/AbstractWriteTx.java | 5 ++-- .../netconf/sal/tx/WriteCandidateTx.java | 3 ++- .../connect/netconf/util/NetconfBaseOps.java | 25 ++++++++++--------- .../util/NetconfTopologyRPCProvider.java | 3 ++- .../yanglib/impl/YangLibProvider.java | 5 ++-- .../restconf/impl/BatchedExistenceCheck.java | 3 ++- .../sal/restconf/impl/BrokerFacade.java | 3 ++- 23 files changed, 74 insertions(+), 51 deletions(-) diff --git a/netconf/mdsal-netconf-monitoring/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/monitoring/MonitoringToMdsalWriter.java b/netconf/mdsal-netconf-monitoring/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/monitoring/MonitoringToMdsalWriter.java index 30e2655924..0bd79fde0c 100644 --- a/netconf/mdsal-netconf-monitoring/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/monitoring/MonitoringToMdsalWriter.java +++ b/netconf/mdsal-netconf-monitoring/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/monitoring/MonitoringToMdsalWriter.java @@ -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 sessions) { diff --git a/netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/notification/NotificationToMdsalWriter.java b/netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/notification/NotificationToMdsalWriter.java index 1535b987f9..d5ba353fe6 100644 --- a/netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/notification/NotificationToMdsalWriter.java +++ b/netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/notification/NotificationToMdsalWriter.java @@ -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(); } diff --git a/netconf/mdsal-netconf-yang-library/src/main/java/org/opendaylight/netconf/mdsal/yang/library/SchemaServiceToMdsalWriter.java b/netconf/mdsal-netconf-yang-library/src/main/java/org/opendaylight/netconf/mdsal/yang/library/SchemaServiceToMdsalWriter.java index 9690ad3e24..d0d383a2bb 100644 --- a/netconf/mdsal-netconf-yang-library/src/main/java/org/opendaylight/netconf/mdsal/yang/library/SchemaServiceToMdsalWriter.java +++ b/netconf/mdsal-netconf-yang-library/src/main/java/org/opendaylight/netconf/mdsal/yang/library/SchemaServiceToMdsalWriter.java @@ -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 modules) { diff --git a/netconf/netconf-console/src/main/java/org/opendaylight/netconf/console/impl/NetconfCommandsImpl.java b/netconf/netconf-console/src/main/java/org/opendaylight/netconf/console/impl/NetconfCommandsImpl.java index 47417bc737..763cbf6050 100644 --- a/netconf/netconf-console/src/main/java/org/opendaylight/netconf/console/impl/NetconfCommandsImpl.java +++ b/netconf/netconf-console/src/main/java/org/opendaylight/netconf/console/impl/NetconfCommandsImpl.java @@ -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 { diff --git a/netconf/netconf-netty-util/src/test/java/org/opendaylight/netconf/nettyutil/handler/ssh/client/AsyncSshHandlerTest.java b/netconf/netconf-netty-util/src/test/java/org/opendaylight/netconf/nettyutil/handler/ssh/client/AsyncSshHandlerTest.java index f1806b43ce..df9ece7dd9 100644 --- a/netconf/netconf-netty-util/src/test/java/org/opendaylight/netconf/nettyutil/handler/ssh/client/AsyncSshHandlerTest.java +++ b/netconf/netconf-netty-util/src/test/java/org/opendaylight/netconf/nettyutil/handler/ssh/client/AsyncSshHandlerTest.java @@ -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 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 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.>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 result) { sshChannelOpenListener = result; } - }); + }, MoreExecutors.directExecutor()); doReturn(asyncOut).when(subsystemChannel).getAsyncOut(); @@ -504,7 +505,7 @@ public class AsyncSshHandlerTest { public void onSuccess(final SshFutureListener 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 result) { result.operationComplete(ioReadFuture); } - }); + }, MoreExecutors.directExecutor()); doReturn(ioReadFuture).when(mock).read(any(Buffer.class)); doReturn(false).when(mock).isClosed(); diff --git a/netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/NetconfTopologyManager.java b/netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/NetconfTopologyManager.java index 1018be37cd..48f063e920 100644 --- a/netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/NetconfTopologyManager.java +++ b/netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/NetconfTopologyManager.java @@ -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( diff --git a/netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/RemoteDeviceConnectorImpl.java b/netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/RemoteDeviceConnectorImpl.java index acf3854a83..826342d23f 100644 --- a/netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/RemoteDeviceConnectorImpl.java +++ b/netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/RemoteDeviceConnectorImpl.java @@ -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") diff --git a/netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/actors/NetconfNodeActor.java b/netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/actors/NetconfNodeActor.java index 6d1e771716..2e46cd4a1b 100644 --- a/netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/actors/NetconfNodeActor.java +++ b/netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/actors/NetconfNodeActor.java @@ -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) { diff --git a/netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/actors/ReadAdapter.java b/netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/actors/ReadAdapter.java index d36062459d..3d881e65de 100644 --- a/netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/actors/ReadAdapter.java +++ b/netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/actors/ReadAdapter.java @@ -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()); } } diff --git a/netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/actors/WriteAdapter.java b/netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/actors/WriteAdapter.java index 4cf51eead2..08ca01bb96 100644 --- a/netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/actors/WriteAdapter.java +++ b/netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/actors/WriteAdapter.java @@ -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) { diff --git a/netconf/netconf-topology/src/main/java/org/opendaylight/netconf/topology/AbstractNetconfTopology.java b/netconf/netconf-topology/src/main/java/org/opendaylight/netconf/topology/AbstractNetconfTopology.java index 4362b92e64..d430ce2f1c 100644 --- a/netconf/netconf-topology/src/main/java/org/opendaylight/netconf/topology/AbstractNetconfTopology.java +++ b/netconf/netconf-topology/src/main/java/org/opendaylight/netconf/topology/AbstractNetconfTopology.java @@ -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; } diff --git a/netconf/netconf-topology/src/main/java/org/opendaylight/netconf/topology/impl/NetconfConnectorFactoryImpl.java b/netconf/netconf-topology/src/main/java/org/opendaylight/netconf/topology/impl/NetconfConnectorFactoryImpl.java index c925a8828f..c644286504 100644 --- a/netconf/netconf-topology/src/main/java/org/opendaylight/netconf/topology/impl/NetconfConnectorFactoryImpl.java +++ b/netconf/netconf-topology/src/main/java/org/opendaylight/netconf/topology/impl/NetconfConnectorFactoryImpl.java @@ -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 diff --git a/netconf/netconf-topology/src/main/java/org/opendaylight/netconf/topology/impl/NetconfTopologyImpl.java b/netconf/netconf-topology/src/main/java/org/opendaylight/netconf/topology/impl/NetconfTopologyImpl.java index 263e524bd7..a17369f144 100644 --- a/netconf/netconf-topology/src/main/java/org/opendaylight/netconf/topology/impl/NetconfTopologyImpl.java +++ b/netconf/netconf-topology/src/main/java/org/opendaylight/netconf/topology/impl/NetconfTopologyImpl.java @@ -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 = diff --git a/netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/NetconfDevice.java b/netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/NetconfDevice.java index b78011460e..22fa4cb92e 100644 --- a/netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/NetconfDevice.java +++ b/netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/NetconfDevice.java @@ -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) { diff --git a/netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/KeepaliveSalFacade.java b/netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/KeepaliveSalFacade.java index b77e7269e5..a92ad42c70 100644 --- a/netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/KeepaliveSalFacade.java +++ b/netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/KeepaliveSalFacade.java @@ -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 input) { final CheckedFuture 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); diff --git a/netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/NetconfDeviceTopologyAdapter.java b/netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/NetconfDeviceTopologyAdapter.java index 7667ba28bc..41609b89c4 100644 --- a/netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/NetconfDeviceTopologyAdapter.java +++ b/netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/NetconfDeviceTopologyAdapter.java @@ -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) { diff --git a/netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/tx/AbstractWriteTx.java b/netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/tx/AbstractWriteTx.java index 14926d99f2..7d6dd3e9e8 100644 --- a/netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/tx/AbstractWriteTx.java +++ b/netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/tx/AbstractWriteTx.java @@ -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; } diff --git a/netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/tx/WriteCandidateTx.java b/netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/tx/WriteCandidateTx.java index febbff6cec..1d429022c1 100644 --- a/netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/tx/WriteCandidateTx.java +++ b/netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/tx/WriteCandidateTx.java @@ -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; } diff --git a/netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/util/NetconfBaseOps.java b/netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/util/NetconfBaseOps.java index debd460936..3dee33869e 100644 --- a/netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/util/NetconfBaseOps.java +++ b/netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/util/NetconfBaseOps.java @@ -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 future = rpc.invokeRpc(toPath(NETCONF_LOCK_QNAME), getLockContent(datastore)); - Futures.addCallback(future, callback); + Futures.addCallback(future, callback, MoreExecutors.directExecutor()); return future; } public ListenableFuture lockCandidate(final FutureCallback callback) { final ListenableFuture 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 lockRunning(final FutureCallback callback) { final ListenableFuture 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 future = rpc.invokeRpc(toPath(NETCONF_UNLOCK_QNAME), getUnLockContent(datastore)); - Futures.addCallback(future, callback); + Futures.addCallback(future, callback, MoreExecutors.directExecutor()); return future; } public ListenableFuture unlockRunning(final FutureCallback callback) { final ListenableFuture 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 unlockCandidate(final FutureCallback callback) { final ListenableFuture 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 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 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 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 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 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; } diff --git a/netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/util/NetconfTopologyRPCProvider.java b/netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/util/NetconfTopologyRPCProvider.java index a26401efc5..4edbedf6c2 100644 --- a/netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/util/NetconfTopologyRPCProvider.java +++ b/netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/util/NetconfTopologyRPCProvider.java @@ -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()); } } diff --git a/netconf/yanglib/src/main/java/org/opendaylight/yanglib/impl/YangLibProvider.java b/netconf/yanglib/src/main/java/org/opendaylight/yanglib/impl/YangLibProvider.java index f5a648a91f..df88860c1f 100644 --- a/netconf/yanglib/src/main/java/org/opendaylight/yanglib/impl/YangLibProvider.java +++ b/netconf/yanglib/src/main/java/org/opendaylight/yanglib/impl/YangLibProvider.java @@ -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()); } diff --git a/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/impl/BatchedExistenceCheck.java b/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/impl/BatchedExistenceCheck.java index a1765e56d8..f36caa0d2d 100644 --- a/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/impl/BatchedExistenceCheck.java +++ b/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/impl/BatchedExistenceCheck.java @@ -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; diff --git a/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/impl/BrokerFacade.java b/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/impl/BrokerFacade.java index d2fd193079..e117863313 100644 --- a/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/impl/BrokerFacade.java +++ b/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/impl/BrokerFacade.java @@ -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(); -- 2.36.6