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;
public void onFailure(Throwable throwable) {
LOG.warn("Unable to update netconf state", throwable);
}
- });
+ }, MoreExecutors.directExecutor());
}
private static void updateSessions(WriteTransaction tx, Collection<Session> sessions) {
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;
public void onFailure(Throwable throwable) {
LOG.warn("Unable to clear streams", throwable);
}
- });
+ }, MoreExecutors.directExecutor());
notificationRegistration.close();
}
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;
public void onFailure(final Throwable throwable) {
LOG.warn("Failed to update modules state", throwable);
}
- });
+ }, MoreExecutors.directExecutor());
}
private ModulesState createModuleStateFromModules(final Set<Module> modules) {
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;
LOG.error("Failed to created NetconfNode={}", netconfNode);
throw new RuntimeException(throwable);
}
- });
+ }, MoreExecutors.directExecutor());
}
@Override
LOG.error("Failed to updated NetconfNode={}", netconfNode);
throw new RuntimeException(throwable);
}
- });
+ }, MoreExecutors.directExecutor());
return "NETCONF node: " + netconfNodeId + " updated successfully.";
} else {
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;
public void onSuccess(final SshFutureListener<AuthFuture> result) {
sshAuthListener = result;
}
- });
+ }, MoreExecutors.directExecutor());
doReturn(authFuture).when(authHandler).authenticate(any(ClientSession.class));
}
public void onSuccess(final SshFutureListener<ConnectFuture> result) {
sshConnectListener = result;
}
- });
+ }, MoreExecutors.directExecutor());
doReturn(connectFuture).when(sshClient).connect("usr", remoteAddress);
}
doReturn(true).when(asyncOut).isClosed();
result.operationComplete(mockedReadFuture);
}
- });
+ }, MoreExecutors.directExecutor());
final IoOutputStream asyncIn = getMockedIoOutputStream();
final ChannelSubsystem subsystemChannel = getMockedSubsystemChannel(asyncOut, asyncIn);
.removeListener(Matchers.<SshFutureListener<IoReadFuture>>any());
result.operationComplete(mockedReadFuture);
}
- });
+ }, MoreExecutors.directExecutor());
final IoOutputStream asyncIn = getMockedIoOutputStream();
final ChannelSubsystem subsystemChannel = getMockedSubsystemChannel(asyncOut, asyncIn);
doReturn(true).when(asyncIn).isClosed();
result.operationComplete(ioWriteFuture);
}
- });
+ }, MoreExecutors.directExecutor());
final ChannelSubsystem subsystemChannel = getMockedSubsystemChannel(asyncOut, asyncIn);
final ClientSession sshSession = getMockedSshSession(subsystemChannel);
doReturn(true).when(closeFuture).isClosed();
result.operationComplete(closeFuture);
}
- });
+ }, MoreExecutors.directExecutor());
doReturn(closeFuture).when(sshSession).close(false);
doReturn(subsystemChannel).when(sshSession).createSubsystemChannel(anyString());
public void onSuccess(final SshFutureListener<OpenFuture> result) {
sshChannelOpenListener = result;
}
- });
+ }, MoreExecutors.directExecutor());
doReturn(asyncOut).when(subsystemChannel).getAsyncOut();
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();
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();
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;
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(
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;
public void onFailure(@Nullable final Throwable throwable) {
LOG.error("{}: Connector failed, {}", remoteDeviceId, throwable);
}
- });
+ }, MoreExecutors.directExecutor());
}
@SuppressWarnings("checkstyle:IllegalCatch")
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;
public void onFailure(@Nonnull final Throwable throwable) {
sender.tell(throwable, getSelf());
}
- });
+ }, MoreExecutors.directExecutor());
}
private void invokeSlaveRpc(final SchemaPath schemaPath, final NormalizedNodeMessage normalizedNodeMessage,
public void onFailure(@Nonnull final Throwable throwable) {
recipient.tell(throwable, getSelf());
}
- });
+ }, MoreExecutors.directExecutor());
}
private void registerSlaveMountPoint(final ActorRef masterReference) {
public void onFailure(@Nonnull final Throwable throwable) {
LOG.error("{}: Failed to register mount point: {}", id, throwable);
}
- });
+ }, MoreExecutors.directExecutor());
}
private DOMRpcService getDOMRpcService(final ActorRef masterReference) {
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;
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,
public void onFailure(@Nonnull final Throwable throwable) {
sender.tell(throwable, self);
}
- });
+ }, MoreExecutors.directExecutor());
}
}
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;
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) {
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;
LOG.error("Connector for : " + nodeId.getValue() + " failed");
// remove this node from active connectors?
}
- });
+ }, MoreExecutors.directExecutor());
return future;
}
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;
public void onFailure(final Throwable throwable) {
LOG.error("Node {} creation failed: {}", instanceName, throwable);
}
- });
+ }, MoreExecutors.directExecutor());
return node;
}
}
\ No newline at end of file
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;
public void onFailure(final Throwable throwable) {
LOG.error("Unable to initialize netconf-topology, {}", throwable);
}
- });
+ }, MoreExecutors.directExecutor());
LOG.debug("Registering datastore listener");
datastoreListenerRegistration =
}
};
- Futures.addCallback(sourceResolverFuture, resolvedSourceCallback);
+ Futures.addCallback(sourceResolverFuture, resolvedSourceCallback, MoreExecutors.directExecutor());
}
private void registerToBaseNetconfStream(final NetconfDeviceRpc deviceRpc,
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) {
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;
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);
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);
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;
throw new IllegalStateException(
id + " Transaction(" + txType + ") not committed correctly", throwable);
}
- });
-
+ }, MoreExecutors.directExecutor());
}
private static Node getNodeWithId(final RemoteDeviceId id) {
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;
public void onFailure(final Throwable throwable) {
listeners.forEach(listener -> listener.onTransactionFailed(AbstractWriteTx.this, throwable));
}
- });
+ }, MoreExecutors.directExecutor());
return result;
}
DocumentedException.ErrorSeverity.ERROR);
transformed.setException(exception);
}
- });
+ }, MoreExecutors.directExecutor());
return transformed;
}
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;
// cleanup is trying to do unlock, but this will fail
cleanup();
}
- });
+ }, MoreExecutors.directExecutor());
return txResult;
}
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;
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
NetconfMessageTransformUtil.wrap(NETCONF_GET_CONFIG_QNAME, getSourceNode(datastore)));
}
- Futures.addCallback(future, callback);
+ Futures.addCallback(future, callback, MoreExecutors.directExecutor());
return future;
}
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;
}
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;
LOG.error("add-netconf-node RPC: Unable to add netconf node.", exception);
futureResult.setException(exception);
}
- });
+ }, MoreExecutors.directExecutor());
}
}
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;
public void onFailure(final Throwable throwable) {
LOG.warn("Unable to update modules state", throwable);
}
- });
+ }, MoreExecutors.directExecutor());
}
@Override
public void onFailure(final Throwable throwable) {
LOG.warn("Unable to update modules state", throwable);
}
- });
+ }, MoreExecutors.directExecutor());
}
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;
ret.complete(path, ReadFailedException.MAPPER.apply(e));
}
- });
+ }, MoreExecutors.directExecutor());
}
return ret;
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;
new RestconfError(ErrorType.APPLICATION, ErrorTag.OPERATION_FAILED, throwable.getMessage()))));
waiter.countDown();
}
- });
+ }, MoreExecutors.directExecutor());
waiter.await();
return status.getStatus();