-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't attempt to submit to a shut-down scheduler (#138)
We have a runtime shutdown hook which shuts down this scheduler. Attempting to submit a task to a shutdown scheduler throws an exception. Instead, guard submiting tasks to it on having acquired the lock and checking that it isn't shutdown. It's fine not to schedule a task to shutdown in the future, if we're already shutting down. We could alternatively catch the exception (potentially avoiding needing the lock), but as we're acquiring the lock anyway, this way we have more clear logic and don't need to worry about other potential exceptions getting incorrectly swallowed. Also, have TimeoutHandler starts its own ScheduledThreadPoolExecutor rather than being passed one, so that it knows nothing else could be sneakily shutting it down or submitting tasks to it, so we can actually uphold the @GuardedBy invariant.
- Loading branch information
1 parent
624eb37
commit a2c81f1
Showing
3 changed files
with
23 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters