You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 27, 2023. It is now read-only.
ConsulCache is creating new executor service (Executors.newSingleThreadScheduledExecutor()) for every service. Since I have many services(50) that I am interested in and the number could keep on growing, wouldn't it be inefficient to keep 50 threads blocking. Is there a better way to handle this?
I am using consul client version 1.3.6
The text was updated successfully, but these errors were encountered:
1.3.7 has possibility to pass your own executor service, here: #389
But it has a bug that happens when you call stop() on a cache - it will stop passed executor service which will basically stop all other caches that are using the same executor service. If you are stopping it only on app exit, then you are ok, I think.
I have a requirement where I am listening for the list of healthy nodes for every service.
Following is the code snippet for 2 services say "service1" and "service2"
ServiceHealthCache serviceHealthCache1 = ServiceHealthCache.newCache(consul.healthClient(), "service1", true, QueryOptions.BLANK, 30);
serviceHealthCache1.addListener(serviceMap -> {
System.out.println(" serviceMap 1: " + serviceMap.keySet());
});
serviceHealthCache1.start();
ServiceHealthCache serviceHealthCache2 = ServiceHealthCache.newCache(consul.healthClient(), "service2", true, QueryOptions.BLANK, 30);
serviceHealthCache2.addListener(serviceMap -> {
System.out.println(" serviceMap 2: " + serviceMap.keySet());
});
ConsulCache is creating new executor service (Executors.newSingleThreadScheduledExecutor()) for every service. Since I have many services(50) that I am interested in and the number could keep on growing, wouldn't it be inefficient to keep 50 threads blocking. Is there a better way to handle this?
I am using consul client version 1.3.6
The text was updated successfully, but these errors were encountered: