Пример #1
0
 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);
 }
Пример #2
0
 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);
   }
 }