@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)
SchedulingStrategyAsynchronousValidationRequest to be executed.schedule in interface SchedulingStrategyrevalidationRequest - the request to be executed; not nullpublic void close()
close in interface java.io.Closeableclose in interface java.lang.AutoCloseablevoid awaitTermination(long timeout,
java.util.concurrent.TimeUnit unit)
throws java.lang.InterruptedException
java.lang.InterruptedException