From 02df0c1fd07a0242ad5d5ace7eeaa3203d80eeea Mon Sep 17 00:00:00 2001 From: Tom Evans Date: Tue, 15 Aug 2023 16:29:17 +0100 Subject: [PATCH] Allow the ScheduledExecutorService to be provided by the container Signed-off-by: Tom Evans --- .gitignore | 1 + .../operators/tck/ReactiveStreamsTck.java | 20 +++++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 770f212..5ad90dd 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,4 @@ release.conf /bin/ .~lock.*.odg# **.DS_Store +.vscode/ diff --git a/tck/src/main/java/org/eclipse/microprofile/reactive/streams/operators/tck/ReactiveStreamsTck.java b/tck/src/main/java/org/eclipse/microprofile/reactive/streams/operators/tck/ReactiveStreamsTck.java index d09c992..7cb22e2 100644 --- a/tck/src/main/java/org/eclipse/microprofile/reactive/streams/operators/tck/ReactiveStreamsTck.java +++ b/tck/src/main/java/org/eclipse/microprofile/reactive/streams/operators/tck/ReactiveStreamsTck.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2018, 2022 Contributors to the Eclipse Foundation + * Copyright (c) 2018, 2023 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. @@ -86,6 +86,22 @@ public void shutdownEngine() { if (engine != null) { shutdownEngine(engine); } + if (executorService != null) { + shutdownExecutorService(executorService); + } + } + + /** + * Override this to provide a different ScheduledExecutorService + */ + protected ScheduledExecutorService createExecutorService() { + return Executors.newScheduledThreadPool(4); + } + + /** + * Override this to customize the shutdown of a ScheduledExecutorService + */ + protected void shutdownExecutorService(ScheduledExecutorService executorService) { executorService.shutdown(); } @@ -93,7 +109,7 @@ public void shutdownEngine() { public Object[] allTests() { engine = createEngine(); rs = createFactory(); - executorService = Executors.newScheduledThreadPool(4); + executorService = createExecutorService(); ReactiveStreamsApiVerification apiVerification = new ReactiveStreamsApiVerification(rs); ReactiveStreamsSpiVerification spiVerification =