From 0f92468d1328f0c4e4a859533b970b7989641bb5 Mon Sep 17 00:00:00 2001 From: Chris Vest Date: Sun, 7 Jul 2024 08:58:01 -0700 Subject: [PATCH] Make internal classes final where possible --- .../java/stormpot/internal/DirectAllocationController.java | 2 +- .../java/stormpot/internal/InlineAllocationController.java | 2 +- src/main/java/stormpot/internal/OrExpiration.java | 2 +- src/main/java/stormpot/internal/PoolBuilderDefaults.java | 2 +- src/main/java/stormpot/internal/RefillSlot.java | 2 +- .../java/stormpot/internal/ThreadedAllocationController.java | 3 ++- 6 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/java/stormpot/internal/DirectAllocationController.java b/src/main/java/stormpot/internal/DirectAllocationController.java index fb3bccac..5e4f42b9 100644 --- a/src/main/java/stormpot/internal/DirectAllocationController.java +++ b/src/main/java/stormpot/internal/DirectAllocationController.java @@ -25,7 +25,7 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; -public class DirectAllocationController extends AllocationController { +public final class DirectAllocationController extends AllocationController { private final LinkedTransferQueue> live; private final RefillPile disregardPile; private final BSlot poisonPill; diff --git a/src/main/java/stormpot/internal/InlineAllocationController.java b/src/main/java/stormpot/internal/InlineAllocationController.java index d4801769..2c8bfeab 100644 --- a/src/main/java/stormpot/internal/InlineAllocationController.java +++ b/src/main/java/stormpot/internal/InlineAllocationController.java @@ -31,7 +31,7 @@ import static java.util.Objects.requireNonNull; -public class InlineAllocationController extends AllocationController { +public final class InlineAllocationController extends AllocationController { private static final VarHandle SIZE; private static final VarHandle ALLOC_COUNT; private static final VarHandle FAILED_ALLOC_COUNT; diff --git a/src/main/java/stormpot/internal/OrExpiration.java b/src/main/java/stormpot/internal/OrExpiration.java index f308770d..5696b37e 100644 --- a/src/main/java/stormpot/internal/OrExpiration.java +++ b/src/main/java/stormpot/internal/OrExpiration.java @@ -31,7 +31,7 @@ * @author Guillaume Lederrey * @since 2.4 */ -public class OrExpiration implements Expiration { +public final class OrExpiration implements Expiration { private final Expiration firstExpiration; private final Expiration secondExpiration; diff --git a/src/main/java/stormpot/internal/PoolBuilderDefaults.java b/src/main/java/stormpot/internal/PoolBuilderDefaults.java index ffdb18b0..2a416b16 100644 --- a/src/main/java/stormpot/internal/PoolBuilderDefaults.java +++ b/src/main/java/stormpot/internal/PoolBuilderDefaults.java @@ -20,7 +20,7 @@ import java.util.concurrent.ThreadFactory; -public class PoolBuilderDefaults { +public final class PoolBuilderDefaults { public final Expiration expiration; public final ThreadFactory threadFactory; public final boolean preciseLeakDetectionEnabled; diff --git a/src/main/java/stormpot/internal/RefillSlot.java b/src/main/java/stormpot/internal/RefillSlot.java index 51ac456e..f6c8ba4a 100644 --- a/src/main/java/stormpot/internal/RefillSlot.java +++ b/src/main/java/stormpot/internal/RefillSlot.java @@ -17,7 +17,7 @@ import stormpot.Poolable; -public class RefillSlot { +public final class RefillSlot { final BSlot slot; volatile RefillSlot next; diff --git a/src/main/java/stormpot/internal/ThreadedAllocationController.java b/src/main/java/stormpot/internal/ThreadedAllocationController.java index 4c643f70..719609c3 100644 --- a/src/main/java/stormpot/internal/ThreadedAllocationController.java +++ b/src/main/java/stormpot/internal/ThreadedAllocationController.java @@ -21,9 +21,10 @@ import java.util.concurrent.LinkedTransferQueue; import java.util.concurrent.ThreadFactory; -public class ThreadedAllocationController extends AllocationController { +public final class ThreadedAllocationController extends AllocationController { private final BAllocThread allocator; private final Thread allocatorThread; + ThreadedAllocationController( LinkedTransferQueue> live, RefillPile disregardPile,