alex-plekhanov commented on a change in pull request #6845: IGNITE-12145:
Monitoring list engine.
URL: https://github.com/apache/ignite/pull/6845#discussion_r323635809
##########
File path:
modules/core/src/main/java/org/apache/ignite/internal/processors/metric/GridMetricManager.java
##########
@@ -177,9 +222,63 @@
/** Registered metrics registries. */
private final ConcurrentHashMap<String, MetricRegistry> registries = new
ConcurrentHashMap<>();
+ /** Metrics registry. */
+ private final ReadOnlyMetricRegistry metricsRegistry = new
ReadOnlyMetricRegistry() {
+ /** {@inheritDoc} */
+ @NotNull @Override public Iterator<MetricRegistry> iterator() {
+ return registries.values().iterator();
+ }
+
+ /** {@inheritDoc} */
+ @Override public void
addMetricRegistryCreationListener(Consumer<MetricRegistry> lsnr) {
+ metricRegCreationLsnrs.add(lsnr);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void
addMetricRegistryRemoveListener(Consumer<MetricRegistry> lsnr) {
+ metricRegRemoveLsnrs.add(lsnr);
+ }
+ };
+
+ /** Registered lists. */
+ private final ConcurrentHashMap<String, MonitoringList<?>> lists = new
ConcurrentHashMap<>();
+
+ /** Lists registry. */
+ private final ReadOnlyMonitoringListRegistry listRegistry = new
ReadOnlyMonitoringListRegistry() {
+ /** {@inheritDoc} */
+ @Override public void
addListCreationListener(Consumer<MonitoringList<?>> lsnr) {
+ listCreationLsnrs.add(lsnr);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void
addListRemoveListener(Consumer<MonitoringList<?>> lsnr) {
+ listRemoveLsnrs.add(lsnr);
+ }
+
+ /** {@inheritDoc} */
+ @NotNull @Override public Iterator<MonitoringList<?>> iterator() {
+ return lists.values().iterator();
+ }
+ };
+
/** Metric registry creation listeners. */
private final List<Consumer<MetricRegistry>> metricRegCreationLsnrs = new
CopyOnWriteArrayList<>();
+ /** Metric registry remove listeners. */
+ private final List<Consumer<MetricRegistry>> metricRegRemoveLsnrs = new
CopyOnWriteArrayList<>();
+
+ /** List creation listeners. */
+ private final List<Consumer<MonitoringList<?>>> listCreationLsnrs = new
CopyOnWriteArrayList<>();
+
+ /** List remove listeners. */
+ private final List<Consumer<MonitoringList<?>>> listRemoveLsnrs = new
CopyOnWriteArrayList<>();
+
+ /** Internal list remove listeners. */
+ private final ConcurrentMap<String, Consumer<MonitoringList<?>>>
internalRemoveLsnrs = new ConcurrentHashMap<>();
+
+ /** List enable listeners. */
+ private final ConcurrentMap<String, Consumer<String>> listEnableLsnrs =
new ConcurrentHashMap<>();
Review comment:
1. Once again. It's not a listener. Let's rename it to something
like`listCreators`
2. It's not a consumer, there is nothing to consume, you just throw away
parameter which you get in this consumer. Let's use `Runnable`.
The same for `internalRemoveLsnrs`
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services