Skip to content

v4.1.0

Choose a tag to compare

@bbottema bbottema released this 08 Sep 11:38
· 16 commits to master since this release

Cancellable cluster acquisition

Version 4.1.0 carries Generic Object Pool 2.5.0's opt-in cancellation and acquisition budget through keyed, load-balanced and matching claims (#25, #26).

ClaimControl control = new ClaimControl();
ClaimOptions options = ClaimOptions.withTimeout(30, TimeUnit.SECONDS)
    .withClaimControl(control);
clusters.claimResourceFromPool(resourceKey, options); // worker
// stop handler: control.requestCancellation();

The same running budget includes registration, selection, waiting and resource preparation. The cluster timeout can shorten it, never restart or extend it. Cancellation throws CancellationException; expiry returns null. A handed-off resource remains the borrower's responsibility.

Concurrent first claims share registration. Allocator factories and load-balancing callbacks run outside registry bookkeeping, and shutdown includes registrations still finishing. One failed pool no longer hides another pool's pending cleanup.

Existing methods, allocator factories, Java 8 and automatic module names remain supported. Load balancing still selects one pool without failover. Running application callbacks must cooperate; cancellation cannot forcibly stop arbitrary code.