/** * Used to set the inherited attributes on this monitor. * * @param inheritedAttributes the collection of inherited attributes */ protected void setInheritedAttributes(final Map<String, Object> inheritedAttributes) { if (inheritedAttributes != null) { for (final Map.Entry<String, Object> entry : inheritedAttributes.entrySet()) { final String key = entry.getKey(); Object value = entry.getValue(); if (value != null && AttributeHolder.class.isAssignableFrom(value.getClass())) { value = ((AttributeHolder)value).getValue(); } set(key, value).lock(); } } }
/** * Used to invoke the monitor lifecycle methods MonitoringEngine.initMonitor and * MonitoringEngine.monitorCreated on this monitor. * * @param name the name of the monitor * @param inheritedAttributes the collection of inherited attributes */ protected void init(String name, final Map<String, Object> inheritedAttributes) { MonitoringEngine.getInstance().initMonitor(this); if (name != null) { for (int i = 0; i < name.length(); i++) { if (invalidCharSet.contains(Character.valueOf(name.charAt(i)))) { name = CharSetUtils.delete(name, invalidCharacters); break; } } } set(Attribute.NAME, name); setInheritedAttributes(inheritedAttributes); MonitoringEngine.getInstance().monitorCreated(this); }