Remove RemoteOpsProviderConfig.newInstance() 02/115902/1
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 17 Mar 2025 13:53:41 +0000 (14:53 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Mon, 17 Mar 2025 13:53:41 +0000 (14:53 +0100)
Just use the builder, as we are no longer tied to Blueprint.

Change-Id: I1da0f3d74a5d3f3ddd3f4b2d0b27e2c83f4a9235
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/OSGiRemoteOpsProvider.java
opendaylight/md-sal/sal-remoterpc-connector/src/main/java/org/opendaylight/controller/remote/rpc/RemoteOpsProviderConfig.java

index f35263985731e9f723a2ea482eddda23c3c2c3a9..85d37b1fc00f6bcf674f2b5bdc2ec5a088958f17 100644 (file)
@@ -8,7 +8,6 @@
 package org.opendaylight.controller.remote.rpc;
 
 import org.apache.pekko.actor.ActorRef;
-import org.apache.pekko.actor.ActorSystem;
 import org.apache.pekko.actor.PoisonPill;
 import org.opendaylight.controller.cluster.ActorSystemProvider;
 import org.opendaylight.mdsal.dom.api.DOMActionProviderService;
@@ -46,9 +45,11 @@ public final class OSGiRemoteOpsProvider {
             @Reference final DOMActionProviderService actionProviderService,
             @Reference final DOMActionService actionService, final Config config) {
         LOG.info("Remote Operations service starting");
-        final ActorSystem actorSystem = actorSystemProvider.getActorSystem();
-        final RemoteOpsProviderConfig opsConfig = RemoteOpsProviderConfig.newInstance(actorSystem.name(),
-            config.metricCapture(), config.boundedMailboxCapacity());
+        final var actorSystem = actorSystemProvider.getActorSystem();
+        final var opsConfig = new RemoteOpsProviderConfig.Builder(actorSystem.name())
+                .metricCaptureEnabled(config.metricCapture())
+                .mailboxCapacity(config.boundedMailboxCapacity())
+                .build();
 
         opsManager = actorSystem.actorOf(OpsManager.props(rpcProviderService, rpcService, opsConfig,
                 actionProviderService, actionService), opsConfig.getRpcManagerName());
index dcec30af5a35c7f1fade7efec70ee56407a7ac53..354a06ec8c5f45fde7eb7f95884b08aa9af4a3e6 100644 (file)
@@ -8,7 +8,6 @@
 package org.opendaylight.controller.remote.rpc;
 
 import com.typesafe.config.Config;
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import java.util.concurrent.TimeUnit;
 import org.apache.pekko.util.Timeout;
 import org.opendaylight.controller.cluster.common.actor.CommonConfig;
@@ -105,21 +104,7 @@ public class RemoteOpsProviderConfig extends CommonConfig {
         return cachedGossipTickInterval;
     }
 
-    /**
-     * This is called via blueprint xml as the builder pattern can't be used.
-     */
-    @SuppressFBWarnings(value = "BC_UNCONFIRMED_CAST_OF_RETURN_VALUE",
-            justification = "Findbugs flags this as an unconfirmed cast of return value but the build method clearly "
-                + "returns RemoteOpsProviderConfig. Perhaps it's confused b/c the build method is overloaded and "
-                + "and differs in return type from the base class.")
-    public static RemoteOpsProviderConfig newInstance(final String actorSystemName, final boolean metricCaptureEnabled,
-                                                      final int mailboxCapacity) {
-        return new Builder(actorSystemName).metricCaptureEnabled(metricCaptureEnabled)
-                .mailboxCapacity(mailboxCapacity).build();
-    }
-
     public static class Builder extends CommonConfig.Builder<Builder> {
-
         public Builder(final String actorSystemName) {
             super(actorSystemName);