Properly use cancellable threads to stop UnicastZenPing (#42844)
Fixes a backport issue with #42884 where Zen1 was not properly taken into account.
This commit is contained in:
parent
221d23de9f
commit
be9f27bb16
|
@ -99,6 +99,8 @@ public class UnicastZenPing implements ZenPing {
|
||||||
|
|
||||||
private final AtomicInteger pingingRoundIdGenerator = new AtomicInteger();
|
private final AtomicInteger pingingRoundIdGenerator = new AtomicInteger();
|
||||||
|
|
||||||
|
private final CancellableThreads cancellableThreads = new CancellableThreads();
|
||||||
|
|
||||||
private final Map<Integer, PingingRound> activePingingRounds = newConcurrentMap();
|
private final Map<Integer, PingingRound> activePingingRounds = newConcurrentMap();
|
||||||
|
|
||||||
// a list of temporal responses a node will return for a request (holds responses from other nodes)
|
// a list of temporal responses a node will return for a request (holds responses from other nodes)
|
||||||
|
@ -145,12 +147,13 @@ public class UnicastZenPing implements ZenPing {
|
||||||
}
|
}
|
||||||
|
|
||||||
private SeedHostsProvider.HostsResolver createHostsResolver() {
|
private SeedHostsProvider.HostsResolver createHostsResolver() {
|
||||||
return hosts -> SeedHostsResolver.resolveHostsLists(new CancellableThreads(), unicastZenPingExecutorService, logger, hosts,
|
return hosts -> SeedHostsResolver.resolveHostsLists(cancellableThreads, unicastZenPingExecutorService, logger, hosts,
|
||||||
transportService, resolveTimeout);
|
transportService, resolveTimeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void close() {
|
public void close() {
|
||||||
|
cancellableThreads.cancel("stopping UnicastZenPing");
|
||||||
ThreadPool.terminate(unicastZenPingExecutorService, 10, TimeUnit.SECONDS);
|
ThreadPool.terminate(unicastZenPingExecutorService, 10, TimeUnit.SECONDS);
|
||||||
Releasables.close(activePingingRounds.values());
|
Releasables.close(activePingingRounds.values());
|
||||||
closed = true;
|
closed = true;
|
||||||
|
|
Loading…
Reference in New Issue