From 4740dd36abb5edd89d97257b20bd84cfc2ac8685 Mon Sep 17 00:00:00 2001 From: Oleksandr Zharov Date: Thu, 28 Sep 2023 19:21:55 +0200 Subject: [PATCH] Do not use RpcService in toaster-consumer Migrated usage of RpcService to Rpc for toaster-consumer. JIRA: CONTROLLER-2085 Change-Id: I85db90c9a2fe104bded1835ae9d4263e893311bb Signed-off-by: Oleksandr Zharov Signed-off-by: Robert Varga --- .../sample/kitchen/impl/KitchenServiceImpl.java | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/opendaylight/md-sal/samples/toaster-consumer/src/main/java/org/opendaylight/controller/sample/kitchen/impl/KitchenServiceImpl.java b/opendaylight/md-sal/samples/toaster-consumer/src/main/java/org/opendaylight/controller/sample/kitchen/impl/KitchenServiceImpl.java index 55b56741af..1401363a70 100644 --- a/opendaylight/md-sal/samples/toaster-consumer/src/main/java/org/opendaylight/controller/sample/kitchen/impl/KitchenServiceImpl.java +++ b/opendaylight/md-sal/samples/toaster-consumer/src/main/java/org/opendaylight/controller/sample/kitchen/impl/KitchenServiceImpl.java @@ -25,7 +25,7 @@ import org.opendaylight.controller.sample.kitchen.api.KitchenService; import org.opendaylight.controller.sample.kitchen.api.KitchenServiceRuntimeMXBean; import org.opendaylight.mdsal.binding.api.NotificationService; import org.opendaylight.mdsal.binding.api.RpcConsumerRegistry; -import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.MakeToastInput; +import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.MakeToast; import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.MakeToastInputBuilder; import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.MakeToastOutput; import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.MakeToastOutputBuilder; @@ -33,7 +33,6 @@ import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120 import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.ToasterListener; import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.ToasterOutOfBread; import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.ToasterRestocked; -import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.ToasterService; import org.opendaylight.yang.gen.v1.http.netconfcentral.org.ns.toaster.rev091120.WheatBread; import org.opendaylight.yangtools.concepts.Registration; import org.opendaylight.yangtools.yang.common.ErrorTag; @@ -58,7 +57,7 @@ public final class KitchenServiceImpl extends AbstractMXBean private static final MakeToastOutput EMPTY_MAKE_OUTPUT = new MakeToastOutputBuilder().build(); private final ExecutorService executor = Executors.newCachedThreadPool(); - private final ToasterService toaster; + private final MakeToast makeToast; private final Registration reg; private volatile boolean toasterOutOfBread; @@ -68,7 +67,7 @@ public final class KitchenServiceImpl extends AbstractMXBean public KitchenServiceImpl(@Reference final RpcConsumerRegistry rpcRegistry, @Reference final NotificationService notifService) { super("KitchenService", "toaster-consumer", null); - toaster = rpcRegistry.getRpcService(ToasterService.class); + makeToast = rpcRegistry.getRpc(MakeToast.class); reg = notifService.registerNotificationListener(this); register(); } @@ -128,11 +127,10 @@ public final class KitchenServiceImpl extends AbstractMXBean } // Access the ToasterService to make the toast. - - MakeToastInput toastInput = new MakeToastInputBuilder().setToasterDoneness(Uint32.valueOf(toastDoneness)) - .setToasterToastType(toastType).build(); - - return toaster.makeToast(toastInput); + return makeToast.invoke(new MakeToastInputBuilder() + .setToasterDoneness(Uint32.valueOf(toastDoneness)) + .setToasterToastType(toastType) + .build()); } @Override -- 2.36.6