Vladsz83 commented on a change in pull request #9768:
URL: https://github.com/apache/ignite/pull/9768#discussion_r834126777
##########
File path:
modules/core/src/test/java/org/apache/ignite/platform/PlatformDeployServiceTask.java
##########
@@ -671,10 +681,101 @@ public void sleep(long delayMs) {
}
}
+ /**
+ * Calculates number of registered values among the service statistics.
+ *
+ * @return Number of registered values among the service statistics.
Or {@code null} if no statistics found
+ * for this service.
+ */
+ public int testNumberOfInvocations(String svcName, String histName) {
+ return ignite.compute().execute(new CountServiceMetricsTask(), new
IgnitePair<>(svcName, histName));
+ }
+
/** */
public Object contextAttribute(String name) {
return svcCtx.currentCallContext().attribute(name);
}
+
+ /**
+ * Calculates number of registered values among the service
statistics. Can process all service metrics or
+ * certain named one.
+ */
+ private static class CountServiceMetricsTask extends
ComputeTaskSplitAdapter<IgnitePair<String>, Integer> {
+ /** {@inheritDoc} */
+ @Override public Integer reduce(List<ComputeJobResult> results)
throws IgniteException {
+ long cnt = 0;
+
+ for (ComputeJobResult res : results) {
+ if (res.isCancelled()) {
+ throw new IgniteException("Unable to count invocations
in service metrics. Job was canceled " +
+ "on node [" + res.getNode() + "].");
+ }
+
+ if (res.getException() != null) {
+ throw new IgniteException("Unable to count invocations
in service metrics. Job failed on " +
+ "node [" + res.getNode() + "]: " +
res.getException().getMessage(), res.getException());
+ }
+
+ if (res.getData() == null)
+ continue;
+
+ cnt += (Long)res.getData();
Review comment:
Turned to int
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]