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 onCacheConfig
to configure the usedThreadPoolExecutor
.- Since:
- 4.3
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.concurrent.ExecutorService
executor
-
Constructor Summary
Constructors Constructor Description ImmediateSchedulingStrategy(java.util.concurrent.ExecutorService executor)
ImmediateSchedulingStrategy(CacheConfig cacheConfig)
Uses aThreadPoolExecutor
which is configured according to the givenCacheConfig
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) void
awaitTermination(long timeout, java.util.concurrent.TimeUnit unit)
Visible for testing.void
close()
void
schedule(AsynchronousValidationRequest revalidationRequest)
Schedule anAsynchronousValidationRequest
to be executed.
-
-
-
Constructor Detail
-
ImmediateSchedulingStrategy
public ImmediateSchedulingStrategy(CacheConfig cacheConfig)
Uses aThreadPoolExecutor
which 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:SchedulingStrategy
Schedule anAsynchronousValidationRequest
to be executed.- Specified by:
schedule
in interfaceSchedulingStrategy
- Parameters:
revalidationRequest
- the request to be executed; notnull
-
close
public void close()
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
-
awaitTermination
void awaitTermination(long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
Visible for testing.- Throws:
java.lang.InterruptedException
-
-