synchronized String newSourceName(String name, boolean dupOK) { if (sourceNames.map.containsKey(name)) { if (dupOK) { return name; } else if (!miniClusterMode) { throw new MetricsException("Metrics source " + name + " already exists!"); } } return sourceNames.uniqueName(name); }
synchronized ObjectName newObjectName(String name) { try { if (mBeanNames.map.containsKey(name) && !miniClusterMode) { throw new MetricsException(name + " already exists!"); } return new ObjectName(mBeanNames.uniqueName(name)); } catch (Exception e) { throw new MetricsException(e); } }