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
Replaced CircuitBreaker.allowsExecution with permitting
Presently CircuitBreaker tries to track how many executions are in progress. Standalone executions use two methods for this: allowsExecution followed by preExecute. This commit reverses the permitting process, so rather than tracking how many executions are in progress we simply track how many executions are permitted, and provide a single method to acquire a permit if possible and return whether execution is permitted.
Copy file name to clipboardExpand all lines: CHANGELOG.md
+7-3
Original file line number
Diff line number
Diff line change
@@ -16,9 +16,9 @@ This release introduces breaking changes to the API:
16
16
#### Policies
17
17
18
18
- All policies are now threadsafe and use a builder API. The configuration methods available in the builder are mostly the same as previously with the 2.x policies. Some notes:
19
-
- A policy builder can be created via `.builder()`.
20
-
-`RetryPolicy` and `CircuitBreaker` can be constructed with default values using `.ofDefaults()`.
21
-
- Policy configuration is accessible via a `.getConfig()`.
19
+
- A policy builder can be created via `builder()`.
20
+
-`RetryPolicy` and `CircuitBreaker` can be constructed with default values using `ofDefaults()`.
21
+
- Policy configuration is accessible via a `getConfig()`.
22
22
- Policies that have required arguments, such as `Fallback` and `Timeout`, have additional factory methods for creating a policy without using a builder, ex: `Fallback.of(this::connectToBackup)` and `Timeout.of(Duration.ofSeconds(10))`. Optional arguments must be specified through a builder, ex: `Timeout.builder(duration).withInterrupt().build()`
23
23
24
24
#### Execution and AsyncExecution
@@ -40,6 +40,10 @@ This release introduces breaking changes to the API:
40
40
-`withDelayWhen` has been renamed to `withDelayFnWhen`.
41
41
- The above method signatures have also been changed to accept a `ContextualSupplier` instead of a `DelayFunction`, since it provides access to the same information.
42
42
43
+
#### CircuitBreaker
44
+
45
+
-`allowsExecution()` was removed in favor of `acquirePermit()` and `tryAcquirePermit()`, which are meant to be used with standalone CircuitBreaker usage.
46
+
43
47
### SPI Changes
44
48
45
49
The following changes effect the SPI classes, for users who are extending Failsafe with custom schedulers or policies:
0 commit comments