I recommend replacing ExecutorService with ExecutorServiceRule. You can limit the rule to a specific number of threads if you need to otherwise it defaults to as many threads as tasks that you submit: ``` @Rule public ExecutorServiceRule executorServiceRule = new ExecutorServiceRule(); ``` The Rule will automatically do shutdown etc during tearDown().
Also, you might want to capture the `Future<Void>` return value from `executorService/executorServiceRule.submit` to await on. You could even have a `Collection<Future<Void>>` if you wanted. You could even move the assertions for locking/unlocking into the thread task (ie what you're submitting). If you await on the Futures, then any assertion failures will be thrown causing the test to fail: ``` Future<Void> doLockUnlock = executorService.submit(() -> { try { assertThat(gemFireCacheImpl.doLockDiskStore(diskStoreName)).isTrue(); } finally { assertThat(gemFireCacheImpl. doUnlockDiskStore(diskStoreName)).isTrue(); } } doLockUnlock.get(GeodeAwaitility.getTimeout().toMillis(), TimeUnit.MILLISECONDS); ``` [ Full content available at: https://github.com/apache/geode/pull/5014 ] This message was relayed via gitbox.apache.org for notifications@geode.apache.org