From 1aa41b4708e997d78a14e60f99014b0a5b189c30 Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Tue, 9 Apr 2019 01:16:05 +0200 Subject: [PATCH] Remove use of deprecated Guava methods Pass down MoreExecutors.directExecutor() to future-proof the code. Change-Id: Iaf847f2dbcce63bac685d5a22a35fc9b8085d06d Signed-off-by: Robert Varga (cherry picked from commit 2630eeeadf852d4327d9990f59e8c87d13c5e30e) --- .../ovsdb/lib/impl/OvsdbClientImpl.java | 28 +++++++++---------- .../utils/ControllerMdsalUtilsAsync.java | 2 +- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/library/impl/src/main/java/org/opendaylight/ovsdb/lib/impl/OvsdbClientImpl.java b/library/impl/src/main/java/org/opendaylight/ovsdb/lib/impl/OvsdbClientImpl.java index 47970d3e9..7eaaa6ba8 100644 --- a/library/impl/src/main/java/org/opendaylight/ovsdb/lib/impl/OvsdbClientImpl.java +++ b/library/impl/src/main/java/org/opendaylight/ovsdb/lib/impl/OvsdbClientImpl.java @@ -15,6 +15,7 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.Maps; 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 com.google.common.util.concurrent.ThreadFactoryBuilder; import io.netty.channel.Channel; @@ -377,21 +378,20 @@ public class OvsdbClientImpl implements OvsdbClient { return; } - Futures.transform(rpc.get_schema(Collections.singletonList(dbNames.get(0))), - (Function) jsonNode -> { - try { - schema.put(dbNames.get(0), DatabaseSchema.fromJson(dbNames.get(0), jsonNode)); - if (schema.size() > 1 && !sfuture.isCancelled()) { - populateSchema(dbNames.subList(1, dbNames.size()), schema, sfuture); - } else if (schema.size() == 1) { - sfuture.set(schema); - } - } catch (ParsingException e) { - LOG.warn("Failed to populate schema {}:{}", dbNames, schema, e); - sfuture.setException(e); + Futures.transform(rpc.get_schema(Collections.singletonList(dbNames.get(0))), jsonNode -> { + try { + schema.put(dbNames.get(0), DatabaseSchema.fromJson(dbNames.get(0), jsonNode)); + if (schema.size() > 1 && !sfuture.isCancelled()) { + populateSchema(dbNames.subList(1, dbNames.size()), schema, sfuture); + } else if (schema.size() == 1) { + sfuture.set(schema); } - return null; - }); + } catch (ParsingException e) { + LOG.warn("Failed to populate schema {}:{}", dbNames, schema, e); + sfuture.setException(e); + } + return null; + }, MoreExecutors.directExecutor()); } public void setRpc(OvsdbRPC rpc) { diff --git a/utils/mdsal-utils/src/main/java/org/opendaylight/ovsdb/utils/mdsal/utils/ControllerMdsalUtilsAsync.java b/utils/mdsal-utils/src/main/java/org/opendaylight/ovsdb/utils/mdsal/utils/ControllerMdsalUtilsAsync.java index e57b72712..5c53ab98f 100644 --- a/utils/mdsal-utils/src/main/java/org/opendaylight/ovsdb/utils/mdsal/utils/ControllerMdsalUtilsAsync.java +++ b/utils/mdsal-utils/src/main/java/org/opendaylight/ovsdb/utils/mdsal/utils/ControllerMdsalUtilsAsync.java @@ -191,7 +191,7 @@ public class ControllerMdsalUtilsAsync { transaction.close(); } }; - Futures.addCallback(future, closeTransactionCallback); + Futures.addCallback(future, closeTransactionCallback, MoreExecutors.directExecutor()); return future; } -- 2.36.6