use of org.nustaq.kontraktor.monitoring.Monitorable in project kontraktor by RuedigerMoeller.
the class HttpMonitor method getMonitorables.
protected IPromise<Object[]> getMonitorables(int depth, Monitorable monitorable) {
// System.out.println("dumpmon " + monitorable);
Promise p = new Promise();
monitorable.$getReport().then((report, err) -> {
Object[] result = new Object[2];
result[0] = report;
monitorable.$getSubMonitorables().then((monitorables, errmon) -> {
if (monitorables.length > 0 && depth >= 1) {
Object[] subResult = new Object[monitorables.length];
result[1] = subResult;
IPromise[] futs = new IPromise[monitorables.length];
for (int i = 0; i < monitorables.length; i++) {
Monitorable submon = monitorables[i];
futs[i] = getMonitorables(depth - 1, submon);
}
all(futs).then((futArr, err0) -> {
IPromise[] futures = (IPromise[]) futArr;
for (int i = 0; i < futures.length; i++) {
IPromise future = futures[i];
subResult[i] = future.get();
}
p.settle(result, null);
});
} else
p.settle(result, null);
});
});
return p;
}
use of org.nustaq.kontraktor.monitoring.Monitorable in project kontraktor by RuedigerMoeller.
the class HttpMonitor method getMonitorableKeys.
public IPromise<String[]> getMonitorableKeys(String simpleClzName) {
ArrayList<String> result = new ArrayList();
monitored.entrySet().forEach((entry) -> {
Monitorable mon = entry.getValue();
if (mon instanceof Actor)
mon = ((Actor) mon).getActor();
if (entry.getValue() != null && mon.getClass().getSimpleName().equals(simpleClzName)) {
result.add(entry.getKey());
}
});
String[] res = new String[result.size()];
result.toArray(res);
return new Promise(res);
}
Aggregations