List of usage examples for javax.management ObjectName isPattern
public boolean isPattern()
From source file:it.greenvulcano.jmx.impl.KarafJMXEntryPoint.java
/** * Unregisters an object from the MBeanServer. * /*from w w w . j a v a 2 s. c om*/ * @param oname * name of the MBean. Can be a filter: in this case all objects * matching the filter will be unregistered. * @throws Exception */ public synchronized void unregisterObject(ObjectName oname) { try { if (oname.isPattern()) { Set<ObjectName> names = mBeanServer.queryNames(oname, null); Iterator<ObjectName> i = names.iterator(); while (i.hasNext()) { ObjectName name = i.next(); mBeanServer.unregisterMBean(name); } } else { mBeanServer.unregisterMBean(oname); } } catch (Exception e) { LOG.error("Unable to unregister ObjectName " + oname, e); } }
From source file:org.apache.tajo.util.metrics.TajoJMXObjectNameFactory.java
@Override public ObjectName createName(String type, String domain, String name) { try {/*from ww w .jav a2s . c o m*/ StringBuilder sb = new StringBuilder(); sb.append(domain).append(":"); String[] nameSplit = name.split(SEPARATOR_RGX, 3); ObjectName objectName = null; if (nameSplit.length == 1) { objectName = new ObjectName(domain, "name", name); } else { for (int i = 0; i < nameSplit.length - 1 && i < jmxHierarchies.length; i++) { sb.append(jmxHierarchies[i]).append("=").append(nameSplit[i]).append(","); } sb.append("name=").append(nameSplit[nameSplit.length - 1]); objectName = new ObjectName(sb.toString()); } if (objectName.isPattern()) { objectName = new ObjectName(domain, "name", ObjectName.quote(name)); } return objectName; } catch (MalformedObjectNameException e) { try { return new ObjectName(domain, "name", ObjectName.quote(name)); } catch (MalformedObjectNameException e1) { if (LOG.isDebugEnabled()) { LOG.warn("Unable to register for " + type + " " + name + " " + e1.getMessage(), e1); } else { LOG.warn("Unable to register for " + type + " " + name + " " + e1.getMessage()); } throw new RuntimeException(e1); } } }
From source file:com.heliosapm.opentsdb.TSDBSubmitterImpl.java
/** * {@inheritDoc}/*from w ww. java 2s. com*/ * @see com.heliosapm.opentsdb.TSDBSubmitter#trace(javax.management.ObjectName, long) */ @Override public void trace(final ObjectName metric, final long value) { if (metric == null || metric.isPattern()) return; trace(time(), metric.getDomain(), value, metric.getKeyPropertyList()); }
From source file:com.heliosapm.opentsdb.TSDBSubmitterImpl.java
/** * {@inheritDoc}/* w ww . j av a 2s. co m*/ * @see com.heliosapm.opentsdb.TSDBSubmitter#trace(javax.management.ObjectName, double) */ @Override public void trace(final ObjectName metric, final double value) { if (metric == null || metric.isPattern()) return; trace(time(), metric.getDomain(), value, metric.getKeyPropertyList()); }