sdk-java
sdk-java copied to clipboard
Don't use BackoffThrottler in multithread contexts
What was changed
- Avoid using BackoffThrottler instances in multi-thread contexts (Poller)
- Merged AsyncBackoffThrotter into BackoffThrotter; BackoffThrottler now has a
throttleAsync()method
Why?
- BackoffThrottler was not designed to provide an external thread safe semantic; consequently, a race condition between several threads could result in skipping throttling or in throttling more than expected.
- These changes will make it much easier to implement longer backoff time on RESOURCE_EXHAUSTION failures.