Remove ShardMBeanFactory 09/93309/3
authorRobert Varga <robert.varga@pantheon.tech>
Fri, 23 Oct 2020 16:13:20 +0000 (18:13 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Fri, 23 Oct 2020 17:03:02 +0000 (19:03 +0200)
This utility class holds only a single method, rehost the method
and remove the class.

JIRA: CONTROLLER-1965
Change-Id: Id1b861a7e838e90abe1f89e97964a903f0dc15d8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/Shard.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardMBeanFactory.java [deleted file]
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardStats.java

index 8003e2b..9c548e5 100644 (file)
@@ -232,7 +232,7 @@ public class Shard extends RaftActor {
                     frontendMetadata);
         }
 
-        shardMBean = ShardMBeanFactory.getShardStatsMBean(name, datastoreContext.getDataStoreMXBeanType(), this);
+        shardMBean = ShardStats.create(name, datastoreContext.getDataStoreMXBeanType(), this);
 
         if (isMetricsCaptureEnabled()) {
             getContext().become(new MeteringBehavior(this));
diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardMBeanFactory.java b/opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardMBeanFactory.java
deleted file mode 100644 (file)
index 565fad3..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.controller.cluster.datastore;
-
-import org.eclipse.jdt.annotation.NonNull;
-
-/**
- * Factory for creating ShardStats mbeans.
- *
- * @author Basheeruddin syedbahm@cisco.com
- */
-final class ShardMBeanFactory {
-
-    private ShardMBeanFactory() {
-    }
-
-    static ShardStats getShardStatsMBean(final String shardName, final String mxBeanType,
-            final @NonNull Shard shard) {
-        String finalMXBeanType = mxBeanType != null ? mxBeanType : "DistDataStore";
-        ShardStats shardStatsMBeanImpl = new ShardStats(shardName, finalMXBeanType, shard);
-        shardStatsMBeanImpl.registerMBean();
-        return shardStatsMBeanImpl;
-    }
-}
index d150b3a..71cbf12 100644 (file)
@@ -15,6 +15,7 @@ import java.util.Date;
 import java.util.List;
 import java.util.concurrent.atomic.AtomicLong;
 import org.checkerframework.checker.lock.qual.GuardedBy;
+import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.controller.cluster.datastore.jmx.mbeans.shard.ShardStatsMXBean;
 import org.opendaylight.controller.cluster.mgmt.api.FollowerInfo;
@@ -68,6 +69,13 @@ final class ShardStats extends AbstractMXBean implements ShardStatsMXBean {
         stateCache = new OnDemandShardStateCache(shardName, shard != null ? shard.self() : null);
     }
 
+    static ShardStats create(final String shardName, final String mxBeanType, final @NonNull Shard shard) {
+        String finalMXBeanType = mxBeanType != null ? mxBeanType : "DistDataStore";
+        ShardStats shardStatsMBeanImpl = new ShardStats(shardName, finalMXBeanType, shard);
+        shardStatsMBeanImpl.registerMBean();
+        return shardStatsMBeanImpl;
+    }
+
     @SuppressWarnings("checkstyle:IllegalCatch")
     private OnDemandRaftState getOnDemandRaftState() {
         try {

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.