From 8c595b0227f6e186d31f8104cbbb125c8b06e2a4 Mon Sep 17 00:00:00 2001 From: Todd Baert Date: Thu, 12 Oct 2023 16:15:48 -0400 Subject: [PATCH] fix: RejectedExecutionException on shutdown (#652) Signed-off-by: Todd Baert --- .../java/dev/openfeature/sdk/ProviderRepository.java | 10 ---------- .../dev/openfeature/sdk/ProviderRepositoryTest.java | 9 --------- 2 files changed, 19 deletions(-) diff --git a/src/main/java/dev/openfeature/sdk/ProviderRepository.java b/src/main/java/dev/openfeature/sdk/ProviderRepository.java index f3967e26a..2ca3b21f8 100644 --- a/src/main/java/dev/openfeature/sdk/ProviderRepository.java +++ b/src/main/java/dev/openfeature/sdk/ProviderRepository.java @@ -171,16 +171,6 @@ public void shutdown() { .concat(Stream.of(this.defaultProvider.get()), this.providers.values().stream()) .distinct() .forEach(this::shutdownProvider); - setProvider(new NoOpProvider(), - (FeatureProvider fp) -> { - }, - (FeatureProvider fp) -> { - }, - (FeatureProvider fp) -> { - }, - (FeatureProvider fp, - String message) -> { - }, false); this.providers.clear(); taskExecutor.shutdown(); } diff --git a/src/test/java/dev/openfeature/sdk/ProviderRepositoryTest.java b/src/test/java/dev/openfeature/sdk/ProviderRepositoryTest.java index 0d4ae5d6a..5b475dc3c 100644 --- a/src/test/java/dev/openfeature/sdk/ProviderRepositoryTest.java +++ b/src/test/java/dev/openfeature/sdk/ProviderRepositoryTest.java @@ -296,15 +296,6 @@ void shouldShutdownAllFeatureProvidersOnShutdown() { setFeatureProvider(ANOTHER_CLIENT_NAME, featureProvider2); providerRepository.shutdown(); - - await() - .pollDelay(Duration.ofMillis(1)) - .atMost(Duration.ofSeconds(TIMEOUT)) - .untilAsserted(() -> { - assertThat(providerRepository.getProvider()).isInstanceOf(NoOpProvider.class); - assertThat(providerRepository.getProvider(CLIENT_NAME)).isInstanceOf(NoOpProvider.class); - assertThat(providerRepository.getProvider(ANOTHER_CLIENT_NAME)).isInstanceOf(NoOpProvider.class); - }); verify(featureProvider1, timeout(TIMEOUT)).shutdown(); verify(featureProvider2, timeout(TIMEOUT)).shutdown(); }