Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* minor code style fixes (2)
  • Loading branch information
Maksim Davydov committed Nov 22, 2024
1 parent 716eefd commit ba41ba1
Showing 1 changed file with 11 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,18 @@ protected void checkMetrics(CdcMain cdc, int expCnt) throws Exception {

DynamicMBean jmxCdcReg = metricRegistry(cdcInstanceName(cfg.getIgniteInstanceName()), null, "cdc");

checkMetrics(expCnt, jmxValue(jmxCdcReg), jmxValue(jmxCdcReg), jmxValue(jmxCdcReg));
Function<String, ?> jmxVal = m -> {
try {
return jmxCdcReg.getAttribute(m);
}
catch (Exception e) {
throw new IgniteException(e);
}
};

checkMetrics(expCnt, (Function<String, Long>)jmxVal, (Function<String, String>)jmxVal, (Function<String, long[]>)jmxVal);

MetricRegistry mreg = registry(cdc);
MetricRegistry mreg = getFieldValue(cdc, "mreg");

assertNotNull(mreg);

Expand Down Expand Up @@ -272,23 +281,6 @@ private void checkMetrics(
assertTrue(Arrays.stream(longArrMetric.apply(EVENTS_CONSUMPTION_TIME)).sum() > 0);
}

/** @return {@link MetricRegistry} */
private MetricRegistry registry(CdcMain cdc) {
return getFieldValue(cdc, "mreg");
}

/** */
private <T> Function<String, T> jmxValue(DynamicMBean jmxCdcReg) {
return m -> {
try {
return (T)jmxCdcReg.getAttribute(m);
}
catch (Exception e) {
throw new IgniteException(e);
}
};
}

/** */
protected boolean keepBinary() {
return false;
Expand Down

0 comments on commit ba41ba1

Please sign in to comment.