Timeboxer Implementation
- Dominant language
- Java
- Stars
- 268
- Forks
- 95
- PR merge metrics
- No merged PRs in 30d
Description
Timeouts are a useful stability pattern, however many high-level APIs omit the ability to set a timeout.
It would be nice if JRugged could provide a solution that allows existing services to be timeboxed.
If the wrapped service takes longer than a predefined timeLimit, the wrapper would throw some sort TimeoutException.
Also, after a timeLimit has been exceed, there should be some (optional) mechanism that attempts to cancel the wrapped service call (perhaps via sending an Interrupt, or a more explicit cancel() method defined by a JRugged Cancellable.cancel() interface).
It would be very nice to include some documentation that illustrates an example of how a Timeboxer could be used to wrap HttpClient calls, such that HttpRequests are nicely aborted after the timeLimit is exceeded.
The wrapper probably needs to expose mechanisms to control the threading model used to execute the Futures that the wrapper service will use internally. Perhaps this is as simple as allowing a custom ExecutorService to be injected into the wrapper.
An optional, but potentially useful, feature could be to allow several services to be simultaneously wrapped in the same timebox. For example: i have a composite service that assembles data from multiple different backends, if any of them haven't finished by the end of the timeLimit, i want to grab the results from the services that did finish and cancel the calls that weren't fast enough.
Contributor guide
Research direction
No files or tests are named. Start by reviewing JRugged's high-level service APIs and existing Future usage, then clarify the required TimeoutException, cancellation or Cancellable behavior, ExecutorService injection, and multi-service semantics. Done requires an agreed scope plus documentation showing an HttpClient call aborted at the time limit.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100