You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using listening decorator on top of scheduled executor service and the service is terminated the future remains pending forever. I saw that you're using NeverSuccessfulListenableFutureTask which doesn't imply to be also never failing (in my case it should fail on cancel due to termination). Also the behavior is different than not using listening decorator and wrapping the future from scheduled executor service with the JdkFutureAdapters (in that case it works are expected).
Here are JUnit4 tests (one if which is failing) to make it more clear and notice the difference:
GeorgiPetkov
changed the title
MoreExecutors#listeningDecorator is working with never failing ListenableFuture
MoreExecutors#listeningDecorator is never cancelled on executor service's termination
Aug 9, 2019
GeorgiPetkov
changed the title
MoreExecutors#listeningDecorator is never cancelled on executor service's termination
Future from MoreExecutors#listeningDecorator is never cancelled on executor service's termination
Aug 12, 2019
The spec for ScheduledExecutorService added this new requirement when moving from Java 8 to Java 9:
The sequence of task executions continues indefinitely until one of the following exceptional completions occur:
...
The executor terminates, also resulting in task cancellation.
(Yes, the old spec says "Otherwise, the task will only terminate via cancellation or termination of the executor." But it's not clear that "task termination" (presumably meaning "Is the Runnable run again?") implies "Future cancellation." In particular, if termination implied cancellation, I would expect the spec to just say "Otherwise, the task will only terminate via cancellation [, such as by termination of the executor]." Anyway, it's mostly academic; the spec now says what is says, and I don't think the old spec forbids that behavior.)
When using listening decorator on top of scheduled executor service and the service is terminated the future remains pending forever. I saw that you're using NeverSuccessfulListenableFutureTask which doesn't imply to be also never failing (in my case it should fail on cancel due to termination). Also the behavior is different than not using listening decorator and wrapping the future from scheduled executor service with the JdkFutureAdapters (in that case it works are expected).
Here are JUnit4 tests (one if which is failing) to make it more clear and notice the difference:
The text was updated successfully, but these errors were encountered: