mirror of https://github.com/grpc/grpc-java.git
xds: shutDown the scheduledExecutorService when the provider is shutdown (#8198)
This commit is contained in:
parent
c8cd4cb260
commit
5b1c3fa12c
|
|
@ -82,6 +82,7 @@ final class FileWatcherCertificateProvider extends CertificateProvider implement
|
||||||
@Override
|
@Override
|
||||||
public synchronized void close() {
|
public synchronized void close() {
|
||||||
shutdown = true;
|
shutdown = true;
|
||||||
|
scheduledExecutorService.shutdownNow();
|
||||||
if (scheduledFuture != null) {
|
if (scheduledFuture != null) {
|
||||||
scheduledFuture.cancel(true);
|
scheduledFuture.cancel(true);
|
||||||
scheduledFuture = null;
|
scheduledFuture = null;
|
||||||
|
|
|
||||||
|
|
@ -180,6 +180,7 @@ public class FileWatcherCertificateProviderTest {
|
||||||
.updateCertificate(any(PrivateKey.class), ArgumentMatchers.<X509Certificate>anyList());
|
.updateCertificate(any(PrivateKey.class), ArgumentMatchers.<X509Certificate>anyList());
|
||||||
verify(mockWatcher, never()).updateTrustedRoots(ArgumentMatchers.<X509Certificate>anyList());
|
verify(mockWatcher, never()).updateTrustedRoots(ArgumentMatchers.<X509Certificate>anyList());
|
||||||
verify(timeService, never()).schedule(any(Runnable.class), any(Long.TYPE), any(TimeUnit.class));
|
verify(timeService, never()).schedule(any(Runnable.class), any(Long.TYPE), any(TimeUnit.class));
|
||||||
|
verify(timeService, times(1)).shutdownNow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue