Class ImmediateSchedulingStrategy
- java.lang.Object
-
- org.apache.http.impl.client.cache.ImmediateSchedulingStrategy
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,SchedulingStrategy
@Contract(threading=SAFE) public class ImmediateSchedulingStrategy extends java.lang.Object implements SchedulingStrategy
Immediately schedules any incoming validation request. Relies onCacheConfigto configure the usedThreadPoolExecutor.- Since:
- 4.3
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.concurrent.ExecutorServiceexecutor
-
Constructor Summary
Constructors Constructor Description ImmediateSchedulingStrategy(java.util.concurrent.ExecutorService executor)ImmediateSchedulingStrategy(CacheConfig cacheConfig)Uses aThreadPoolExecutorwhich is configured according to the givenCacheConfig.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) voidawaitTermination(long timeout, java.util.concurrent.TimeUnit unit)Visible for testing.voidclose()voidschedule(AsynchronousValidationRequest revalidationRequest)Schedule anAsynchronousValidationRequestto be executed.
-
-
-
Constructor Detail
-
ImmediateSchedulingStrategy
public ImmediateSchedulingStrategy(CacheConfig cacheConfig)
Uses aThreadPoolExecutorwhich is configured according to the givenCacheConfig.- Parameters:
cacheConfig- specifies thread pool settings. SeeCacheConfig.getAsynchronousWorkersMax(),CacheConfig.getAsynchronousWorkersCore(),CacheConfig.getAsynchronousWorkerIdleLifetimeSecs(), andCacheConfig.getRevalidationQueueSize().
-
ImmediateSchedulingStrategy
ImmediateSchedulingStrategy(java.util.concurrent.ExecutorService executor)
-
-
Method Detail
-
schedule
public void schedule(AsynchronousValidationRequest revalidationRequest)
Description copied from interface:SchedulingStrategySchedule anAsynchronousValidationRequestto be executed.- Specified by:
schedulein interfaceSchedulingStrategy- Parameters:
revalidationRequest- the request to be executed; notnull
-
close
public void close()
- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable
-
awaitTermination
void awaitTermination(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedExceptionVisible for testing.- Throws:
java.lang.InterruptedException
-
-