MutableMetric newTag(Class<?> resType) { if (resType == String.class) { return new MutableMetric() { @Override public void snapshot(MetricsRecordBuilder rb, boolean all) { try { Object ret = method.invoke(obj, (Object[]) null); rb.tag(info, (String) ret); } catch (Exception ex) { LOG.error("Error invoking method "+ method.getName(), ex); } } }; } throw new MetricsException("Unsupported tag type: "+ resType.getName()); }
MutableMetric newCounter(final Class<?> type) { if (isInt(type) || isLong(type)) { return new MutableMetric() { @Override public void snapshot(MetricsRecordBuilder rb, boolean all) { try { Object ret = method.invoke(obj, (Object[])null); if (isInt(type)) rb.addCounter(info, ((Integer) ret).intValue()); else rb.addCounter(info, ((Long) ret).longValue()); } catch (Exception ex) { LOG.error("Error invoking method "+ method.getName(), ex); } } }; } throw new MetricsException("Unsupported counter type: "+ type.getName()); }
MutableMetric newGauge(final Class<?> t) { if (isInt(t) || isLong(t) || isFloat(t) || isDouble(t)) { return new MutableMetric() { @Override public void snapshot(MetricsRecordBuilder rb, boolean all) { try { Object ret = method.invoke(obj, (Object[]) null); if (isInt(t)) rb.addGauge(info, ((Integer) ret).intValue()); else if (isLong(t)) rb.addGauge(info, ((Long) ret).longValue()); else if (isFloat(t)) rb.addGauge(info, ((Float) ret).floatValue()); else rb.addGauge(info, ((Double) ret).doubleValue()); } catch (Exception ex) { LOG.error("Error invoking method "+ method.getName(), ex); } } }; } throw new MetricsException("Unsupported gauge type: "+ t.getName()); }
MutableMetric newTag(Class<?> resType) { if (resType == String.class) { return new MutableMetric() { @Override public void snapshot(MetricsRecordBuilder rb, boolean all) { try { Object ret = method.invoke(obj, (Object[]) null); rb.tag(info, (String) ret); } catch (Exception ex) { LOG.error("Error invoking method "+ method.getName(), ex); } } }; } throw new MetricsException("Unsupported tag type: "+ resType.getName()); }
MutableMetric newTag(Class<?> resType) { if (resType == String.class) { return new MutableMetric() { @Override public void snapshot(MetricsRecordBuilder rb, boolean all) { try { Object ret = method.invoke(obj, (Object[]) null); rb.tag(info, (String) ret); } catch (Exception ex) { LOG.error("Error invoking method "+ method.getName(), ex); } } }; } throw new MetricsException("Unsupported tag type: "+ resType.getName()); }
MutableMetric newTag(Class<?> resType) { if (resType == String.class) { return new MutableMetric() { @Override public void snapshot(MetricsRecordBuilder rb, boolean all) { try { Object ret = method.invoke(obj, (Object[]) null); rb.tag(info, (String) ret); } catch (Exception ex) { LOG.error("Error invoking method "+ method.getName(), ex); } } }; } throw new MetricsException("Unsupported tag type: "+ resType.getName()); }
MutableMetric newTag(Class<?> resType) { if (resType == String.class) { return new MutableMetric() { @Override public void snapshot(MetricsRecordBuilder rb, boolean all) { try { Object ret = method.invoke(obj, (Object[]) null); rb.tag(info, (String) ret); } catch (Exception ex) { LOG.error("Error invoking method "+ method.getName(), ex); } } }; } throw new MetricsException("Unsupported tag type: "+ resType.getName()); }
MutableMetric newCounter(final Class<?> type) { if (isInt(type) || isLong(type)) { return new MutableMetric() { @Override public void snapshot(MetricsRecordBuilder rb, boolean all) { try { Object ret = method.invoke(obj, (Object[])null); if (isInt(type)) rb.addCounter(info, ((Integer) ret).intValue()); else rb.addCounter(info, ((Long) ret).longValue()); } catch (Exception ex) { LOG.error("Error invoking method "+ method.getName(), ex); } } }; } throw new MetricsException("Unsupported counter type: "+ type.getName()); }
MutableMetric newCounter(final Class<?> type) { if (isInt(type) || isLong(type)) { return new MutableMetric() { @Override public void snapshot(MetricsRecordBuilder rb, boolean all) { try { Object ret = method.invoke(obj, (Object[])null); if (isInt(type)) rb.addCounter(info, ((Integer) ret).intValue()); else rb.addCounter(info, ((Long) ret).longValue()); } catch (Exception ex) { LOG.error("Error invoking method "+ method.getName(), ex); } } }; } throw new MetricsException("Unsupported counter type: "+ type.getName()); }
MutableMetric newCounter(final Class<?> type) { if (isInt(type) || isLong(type)) { return new MutableMetric() { @Override public void snapshot(MetricsRecordBuilder rb, boolean all) { try { Object ret = method.invoke(obj, (Object[])null); if (isInt(type)) rb.addCounter(info, ((Integer) ret).intValue()); else rb.addCounter(info, ((Long) ret).longValue()); } catch (Exception ex) { LOG.error("Error invoking method "+ method.getName(), ex); } } }; } throw new MetricsException("Unsupported counter type: "+ type.getName()); }
MutableMetric newCounter(final Class<?> type) { if (isInt(type) || isLong(type)) { return new MutableMetric() { @Override public void snapshot(MetricsRecordBuilder rb, boolean all) { try { Object ret = method.invoke(obj, (Object[])null); if (isInt(type)) rb.addCounter(info, ((Integer) ret).intValue()); else rb.addCounter(info, ((Long) ret).longValue()); } catch (Exception ex) { LOG.error("Error invoking method "+ method.getName(), ex); } } }; } throw new MetricsException("Unsupported counter type: "+ type.getName()); }
MutableMetric newGauge(final Class<?> t) { if (isInt(t) || isLong(t) || isFloat(t) || isDouble(t)) { return new MutableMetric() { @Override public void snapshot(MetricsRecordBuilder rb, boolean all) { try { Object ret = method.invoke(obj, (Object[]) null); if (isInt(t)) rb.addGauge(info, ((Integer) ret).intValue()); else if (isLong(t)) rb.addGauge(info, ((Long) ret).longValue()); else if (isFloat(t)) rb.addGauge(info, ((Float) ret).floatValue()); else rb.addGauge(info, ((Double) ret).doubleValue()); } catch (Exception ex) { LOG.error("Error invoking method "+ method.getName(), ex); } } }; } throw new MetricsException("Unsupported gauge type: "+ t.getName()); }
MutableMetric newGauge(final Class<?> t) { if (isInt(t) || isLong(t) || isFloat(t) || isDouble(t)) { return new MutableMetric() { @Override public void snapshot(MetricsRecordBuilder rb, boolean all) { try { Object ret = method.invoke(obj, (Object[]) null); if (isInt(t)) rb.addGauge(info, ((Integer) ret).intValue()); else if (isLong(t)) rb.addGauge(info, ((Long) ret).longValue()); else if (isFloat(t)) rb.addGauge(info, ((Float) ret).floatValue()); else rb.addGauge(info, ((Double) ret).doubleValue()); } catch (Exception ex) { LOG.error("Error invoking method "+ method.getName(), ex); } } }; } throw new MetricsException("Unsupported gauge type: "+ t.getName()); }
MutableMetric newGauge(final Class<?> t) { if (isInt(t) || isLong(t) || isFloat(t) || isDouble(t)) { return new MutableMetric() { @Override public void snapshot(MetricsRecordBuilder rb, boolean all) { try { Object ret = method.invoke(obj, (Object[]) null); if (isInt(t)) rb.addGauge(info, ((Integer) ret).intValue()); else if (isLong(t)) rb.addGauge(info, ((Long) ret).longValue()); else if (isFloat(t)) rb.addGauge(info, ((Float) ret).floatValue()); else rb.addGauge(info, ((Double) ret).doubleValue()); } catch (Exception ex) { LOG.error("Error invoking method "+ method.getName(), ex); } } }; } throw new MetricsException("Unsupported gauge type: "+ t.getName()); }
MutableMetric newGauge(final Class<?> t) { if (isInt(t) || isLong(t) || isFloat(t) || isDouble(t)) { return new MutableMetric() { @Override public void snapshot(MetricsRecordBuilder rb, boolean all) { try { Object ret = method.invoke(obj, (Object[]) null); if (isInt(t)) rb.addGauge(info, ((Integer) ret).intValue()); else if (isLong(t)) rb.addGauge(info, ((Long) ret).longValue()); else if (isFloat(t)) rb.addGauge(info, ((Float) ret).floatValue()); else rb.addGauge(info, ((Double) ret).doubleValue()); } catch (Exception ex) { LOG.error("Error invoking method "+ method.getName(), ex); } } }; } throw new MetricsException("Unsupported gauge type: "+ t.getName()); }