From 8973e68d299f71bb7ee22b7196b56a0123fbcfb7 Mon Sep 17 00:00:00 2001 From: John DeRegnaucourt Date: Sun, 23 Jun 2024 17:19:22 -0400 Subject: [PATCH] updated JavaDocs --- src/main/java/com/cedarsoftware/util/LRUCache.java | 9 ++++++--- .../util/cache/ThreadedLRUCacheStrategy.java | 8 ++++++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/cedarsoftware/util/LRUCache.java b/src/main/java/com/cedarsoftware/util/LRUCache.java index 8fd44784..0ad0abdd 100644 --- a/src/main/java/com/cedarsoftware/util/LRUCache.java +++ b/src/main/java/com/cedarsoftware/util/LRUCache.java @@ -96,13 +96,16 @@ public LRUCache(int capacity, StrategyType strategyType) { *

* Note: There is a "shutdown" method on LRUCache to ensure that the default scheduler that was created for you * is cleaned up, which is useful in a container environment. If you supplied your own scheduler and cleanupPool, - * then it is up to you to manage there termination. The shutdown() method will not manipulate them in anyway. + * then it is up to you to manage their termination. The shutdown() method will not manipulate them in any way. * @param capacity int maximum number of entries in the cache. * @param cleanupDelayMillis int number of milliseconds after a put() call when a scheduled task should run to * trim the cache to no more than capacity. The default is 10ms. * @param scheduler ScheduledExecutorService which can be null, in which case one will be created for you, or you - * can supply your own. - * @param cleanupPool ForkJoinPool can be null, in which case one will be created for you, you can supply your own. + * can supply your own. If one is created for you, when shutdown() is called, it will be shuwdown + * for you. + * @param cleanupPool ForkJoinPool can be null, in which case the common ForkJoinPool will be used, or you can + * supply your own. It will not be terminated when shutdown() is called regardless of whether + * it was supplied or the common ForkJoinPool was used. * @see com.cedarsoftware.util.cache.ThreadedLRUCacheStrategy */ public LRUCache(int capacity, int cleanupDelayMillis, ScheduledExecutorService scheduler, ForkJoinPool cleanupPool) { diff --git a/src/main/java/com/cedarsoftware/util/cache/ThreadedLRUCacheStrategy.java b/src/main/java/com/cedarsoftware/util/cache/ThreadedLRUCacheStrategy.java index 944944e5..dcfa790f 100644 --- a/src/main/java/com/cedarsoftware/util/cache/ThreadedLRUCacheStrategy.java +++ b/src/main/java/com/cedarsoftware/util/cache/ThreadedLRUCacheStrategy.java @@ -79,8 +79,12 @@ void updateTimestamp() { * @param capacity int maximum size for the LRU cache. * @param cleanupDelayMillis int milliseconds before scheduling a cleanup (reduction to capacity if the cache currently * exceeds it). - * @param scheduler ScheduledExecutorService for scheduling cleanup tasks. - * @param cleanupPool ForkJoinPool for executing cleanup tasks. + * @param scheduler ScheduledExecutorService for scheduling cleanup tasks. Can be null. If none is supplied, + * a default scheduler is created for you. Calling the .shutdown() method will shutdown + * the schedule only if you passed in null (using default). If you pass one in, it is + * your responsibility to terminate the scheduler. + * @param cleanupPool ForkJoinPool for executing cleanup tasks. Can be null, in which case the common + * ForkJoinPool is used. When shutdown() is called, nothing is down to the ForkJoinPool. */ public ThreadedLRUCacheStrategy(int capacity, int cleanupDelayMillis, ScheduledExecutorService scheduler, ForkJoinPool cleanupPool) { this.isDefaultScheduler = scheduler == null;