rpuch commented on code in PR #3068:
URL: https://github.com/apache/ignite-3/pull/3068#discussion_r1461862200
##########
modules/network/src/main/java/org/apache/ignite/network/DefaultMessagingService.java:
##########
@@ -531,4 +547,36 @@ public void stopDroppingMessages() {
public ConnectionManager connectionManager() {
return connectionManager;
}
+
+ private static class CriticalLazyStripedExecutor extends
LazyStripedExecutor {
+ private final CriticalWorkerRegistry workerRegistry;
+
+ private final List<CriticalWorker> registeredWorkers = new
CopyOnWriteArrayList<>();
+
+ CriticalLazyStripedExecutor(String nodeName, String poolName,
CriticalWorkerRegistry workerRegistry) {
+ super(nodeName, poolName);
+
+ this.workerRegistry = workerRegistry;
+ }
+
+ @Override
+ protected ExecutorService newSingleThreadExecutor(NamedThreadFactory
threadFactory) {
+ CriticalSingleThreadExecutor executor = new
CriticalSingleThreadExecutor(threadFactory);
+
+ workerRegistry.register(executor);
+
+ registeredWorkers.add(executor);
+
+ return executor;
+ }
+
+ @Override
+ protected void onStoppingInitiated() {
+ super.onStoppingInitiated();
+
+ for (CriticalWorker worker : registeredWorkers) {
+ workerRegistry.unregister(worker);
Review Comment:
And if a component has just one worker, it will still need to register it
with that grouping passing an additional parameter; or we'll need to have 2
`register()` methods, one with one parameter, another with 2 parameters.
Right now we have just 2 kinds of critical workers: Netty threads (that we
must keep track of anyway because we need to send heartbeats to them, so your
proposal does not work for them) and inbound/outbound threads (for which your
proposal might be useful). So 'all components' *for now* boils down to just 1
component.
I think we should see what happens further. If more components are added,
and most of them benefit from such batch deregistration, we'll introduce it.
For now it looks like simplifying in one place while complicating in other 2
places (the watchdog and the Netty workers registrar). WDYT?
--
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]