@Contract(threading=SAFE) public class ImmediateSchedulingStrategy extends java.lang.Object implements SchedulingStrategy
CacheConfig
to configure the used ThreadPoolExecutor
.Modifier and Type | Field and Description |
---|---|
private java.util.concurrent.ExecutorService |
executor |
Constructor and Description |
---|
ImmediateSchedulingStrategy(CacheConfig cacheConfig)
Uses a
ThreadPoolExecutor which is configured according to the
given CacheConfig . |
ImmediateSchedulingStrategy(java.util.concurrent.ExecutorService executor) |
Modifier and Type | Method and Description |
---|---|
(package private) void |
awaitTermination(long timeout,
java.util.concurrent.TimeUnit unit)
Visible for testing.
|
void |
close() |
void |
schedule(AsynchronousValidationRequest revalidationRequest)
Schedule an
AsynchronousValidationRequest to be executed. |
public ImmediateSchedulingStrategy(CacheConfig cacheConfig)
ThreadPoolExecutor
which is configured according to the
given CacheConfig
.cacheConfig
- specifies thread pool settings. See
CacheConfig.getAsynchronousWorkersMax()
,
CacheConfig.getAsynchronousWorkersCore()
,
CacheConfig.getAsynchronousWorkerIdleLifetimeSecs()
,
and CacheConfig.getRevalidationQueueSize()
.ImmediateSchedulingStrategy(java.util.concurrent.ExecutorService executor)
public void schedule(AsynchronousValidationRequest revalidationRequest)
SchedulingStrategy
AsynchronousValidationRequest
to be executed.schedule
in interface SchedulingStrategy
revalidationRequest
- the request to be executed; not null
public void close()
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
void awaitTermination(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
java.lang.InterruptedException