From: Robert Varga Date: Tue, 10 Jul 2018 08:13:00 +0000 (+0200) Subject: Remove use of CheckedFuture in clustering-it-provider X-Git-Tag: release/fluorine~55 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=3f7ac86f0548d587e88ba43e03ec25cc83eed6cf Remove use of CheckedFuture in clustering-it-provider We do not need checkedGet(), hence we can get by with a ListenableFuture only. Change-Id: Ie8cab5293a13041a90d275c2b67a90d06beaccad Signed-off-by: Robert Varga --- diff --git a/opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/MdsalLowLevelTestProvider.java b/opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/MdsalLowLevelTestProvider.java index e2ac03b6e8..da6df6b855 100644 --- a/opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/MdsalLowLevelTestProvider.java +++ b/opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/MdsalLowLevelTestProvider.java @@ -18,7 +18,6 @@ import akka.dispatch.OnComplete; import akka.pattern.Patterns; import com.google.common.base.Optional; import com.google.common.base.Strings; -import com.google.common.util.concurrent.CheckedFuture; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.SettableFuture; @@ -52,7 +51,6 @@ import org.opendaylight.controller.clustering.it.provider.impl.WriteTransactions import org.opendaylight.controller.clustering.it.provider.impl.YnlListener; import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService; import org.opendaylight.controller.md.sal.binding.api.NotificationService; -import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException; import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker; import org.opendaylight.controller.md.sal.dom.api.DOMDataReadOnlyTransaction; import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeListener; @@ -550,7 +548,7 @@ public class MdsalLowLevelTestProvider implements OdlMdsalLowlevelControlService final DOMDataReadOnlyTransaction rTx = domDataBroker.newReadOnlyTransaction(); try { final Optional> readResult = - rTx.read(CONTROLLER_CONFIG, WriteTransactionsHandler.ID_INT_YID).checkedGet(); + rTx.read(CONTROLLER_CONFIG, WriteTransactionsHandler.ID_INT_YID).get(); if (!readResult.isPresent()) { final RpcError error = RpcResultBuilder.newError( @@ -563,7 +561,7 @@ public class MdsalLowLevelTestProvider implements OdlMdsalLowlevelControlService RpcResultBuilder.success(new UnsubscribeDtclOutputBuilder() .setCopyMatches(idIntsListener.checkEqual(readResult.get()))).build()); - } catch (final ReadFailedException e) { + } catch (final InterruptedException | ExecutionException e) { final RpcError error = RpcResultBuilder.newError( ErrorType.APPLICATION, "Read failed.", "Final read from id-ints failed."); return Futures.immediateFuture(RpcResultBuilder.failed() @@ -796,14 +794,13 @@ public class MdsalLowLevelTestProvider implements OdlMdsalLowlevelControlService final ClientLocalHistory localHistory = distributedDataStoreClient.createLocalHistory(); final ClientTransaction tx = localHistory.createTransaction(); - final CheckedFuture>, - org.opendaylight.mdsal.common.api.ReadFailedException> read = + final ListenableFuture>> read = tx.read(YangInstanceIdentifier.of(ProduceTransactionsHandler.ID_INT)); tx.abort(); localHistory.close(); try { - final Optional> optional = read.checkedGet(); + final Optional> optional = read.get(); if (!optional.isPresent()) { LOG.warn("Final read from client is empty."); final RpcError error = RpcResultBuilder.newError( @@ -816,7 +813,7 @@ public class MdsalLowLevelTestProvider implements OdlMdsalLowlevelControlService RpcResultBuilder.success(new UnsubscribeDdtlOutputBuilder() .setCopyMatches(idIntsDdtl.checkEqual(optional.get()))).build()); - } catch (org.opendaylight.mdsal.common.api.ReadFailedException e) { + } catch (InterruptedException | ExecutionException e) { LOG.error("Unable to read data to verify ddtl data.", e); final RpcError error = RpcResultBuilder.newError( ErrorType.APPLICATION, "Read failed.", "Final read from id-ints failed.");