2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.controller.cluster.datastore.jmx.mbeans.shard;
10 import java.util.HashMap;
14 * @author Basheeruddin syedbahm@cisco.com
17 public class ShardMBeanFactory {
18 private static Map<String, ShardStats> shardMBeans =
19 new HashMap<String, ShardStats>();
21 public static ShardStats getShardStatsMBean(String shardName) {
22 if (shardMBeans.containsKey(shardName)) {
23 return shardMBeans.get(shardName);
25 ShardStats shardStatsMBeanImpl = new ShardStats(shardName);
27 if (shardStatsMBeanImpl.registerMBean()) {
28 shardMBeans.put(shardName, shardStatsMBeanImpl);
30 return shardStatsMBeanImpl;