Skip to content

Commit

Permalink
addressed sonar issue with not handling interrupt during waiting
Browse files Browse the repository at this point in the history
Signed-off-by: jarebudev <[email protected]>
  • Loading branch information
jarebudev authored and Kavindu-Dodan committed Apr 2, 2024
1 parent a483239 commit b9e1ca6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/main/java/dev/openfeature/sdk/EventSupport.java
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,15 @@ public void runHandler(Consumer<EventDetails> handler, EventDetails eventDetails
* or timeout period has elapsed.
*/
public void shutdown() {
taskExecutor.shutdown();
try {
taskExecutor.shutdown();
if (!taskExecutor.awaitTermination(SHUTDOWN_TIMEOUT_SECONDS, TimeUnit.SECONDS)) {
log.warn("Task executor did not terminate before the timeout period had elapsed");
taskExecutor.shutdownNow();

Check warning on line 159 in src/main/java/dev/openfeature/sdk/EventSupport.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/dev/openfeature/sdk/EventSupport.java#L158-L159

Added lines #L158 - L159 were not covered by tests
}
} catch (Exception e) {
log.warn("Exception while attempting to shutdown task executor", e);
} catch (InterruptedException e) {
taskExecutor.shutdownNow();
Thread.currentThread().interrupt();

Check warning on line 163 in src/main/java/dev/openfeature/sdk/EventSupport.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/dev/openfeature/sdk/EventSupport.java#L161-L163

Added lines #L161 - L163 were not covered by tests
}
}

Expand Down

0 comments on commit b9e1ca6

Please sign in to comment.