OpenZYK opened a new pull request, #4159:
URL: https://github.com/apache/logging-log4j2/pull/4159
## Summary
Enhances the compression delay feature introduced in #4071 by replacing the
single `maxCompressionDelaySeconds` parameter with a
`minCompressionDelaySeconds` + `maxCompressionDelaySeconds` pair.
The actual delay is now chosen uniformly at random from the closed interval
`[min, max]`, giving operators fine-grained control over the compression window
(e.g. `min=30, max=120` to always wait between 30 s and 2 min before
compressing).
## Changes
- **`AbstractAction`**: add `blockThread(int min, int max)` that picks a
uniform random delay in `[min, max]` seconds; keep the deprecated single-arg
overload as a backward-compatible delegate to `blockThread(0, max)`.
- **`GzCompressAction` / `ZipCompressAction` / `CommonsCompressAction`**:
add `minDelaySeconds` field; new 6-arg constructors; deprecated 5-arg
constructors delegate to the 6-arg form with `min=0`.
- **`FileExtension`**: add abstract `createCompressAction(…, min, max)`
method and implement it in every enum constant; existing 5-arg overloads
delegate to the new 6-arg form with `min=0` for backward compatibility.
- **`DefaultRolloverStrategy`**: add `@PluginBuilderAttribute
minCompressionDelaySeconds` to Builder; add `setMinCompressionDelaySeconds`
setter; add `getMinCompressionDelaySeconds` getter; new 10-arg constructor;
deprecated 9-arg constructor delegates to the 10-arg form with `min=0`;
`rollover()` passes both min and max to `createCompressAction`.
- **Tests**: extend `AbstractActionTest` with `blockThread(min,max)`
edge-case tests; extend `FileExtensionCompressDelayTest` with GZ/ZIP min/max
range tests and `DefaultRolloverStrategy` builder tests (21 tests pass).
- **Changelog**: add
`src/changelog/.2.x.x/4012_enhance_compression_delay_min_max.xml`.
## Backward Compatibility
All existing configurations using only `maxCompressionDelaySeconds` continue
to work unchanged (`min` defaults to `0`, producing the same `[0, max]` range
as before).
## Configuration Example
```xml
<DefaultRolloverStrategy max="10"
minCompressionDelaySeconds="30"
maxCompressionDelaySeconds="120"/>
```
Closes #4012
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]