/** * Strategy to determine an execution time (schedule) for an operation. * * @since 5.0 */ @Contract(threading = ThreadingBehavior.STATELESS) public interface SchedulingStrategy { /** * Schedules execution time for an operation. */ TimeValue schedule(int attemptNumber); }
/** * Immediately schedules any operation. * * @since 5.0 */ @Contract(threading = ThreadingBehavior.STATELESS) public class ImmediateSchedulingStrategy implements SchedulingStrategy { public final static ImmediateSchedulingStrategy INSTANCE = new ImmediateSchedulingStrategy(); @Override public TimeValue schedule(final int attemptNumber) { return TimeValue.ZERO_MILLISECONDS; } }
/** * Atomic Compare-And-Swap (CAS) cache operation. * * @since 5.0 */ @Contract(threading = ThreadingBehavior.STATELESS) public interface HttpCacheCASOperation { /** * Returns the new cache entry that should replace an existing one. * * @param existing * the cache entry currently in-place in the cache, possibly * {@code null} if nonexistent * @return the cache entry that should replace it, again, * possibly {@code null} if the entry should be deleted */ HttpCacheEntry execute(HttpCacheEntry existing) throws ResourceIOException; }
/** * {@link HttpCacheEntrySerializer} that uses {@link HttpCacheStorageEntry} * as its cache content representation. * * @since 5.0 */ @Contract(threading = ThreadingBehavior.STATELESS) public class NoopCacheEntrySerializer implements HttpCacheEntrySerializer<HttpCacheStorageEntry> { public static final NoopCacheEntrySerializer INSTANCE = new NoopCacheEntrySerializer(); @Override public HttpCacheStorageEntry serialize(final HttpCacheStorageEntry cacheEntry) throws ResourceIOException { return cacheEntry; } @Override public HttpCacheStorageEntry deserialize(final HttpCacheStorageEntry cacheEntry) throws ResourceIOException { return cacheEntry; } }
/** * Serializer / deserializer for {@link HttpCacheStorageEntry} entries. * * @since 5.0 */ @Contract(threading = ThreadingBehavior.STATELESS) public interface HttpCacheEntrySerializer<T> { /** * Serializes the given entry. * * @param entry cache entry * @return serialized representation of the cache entry * @throws ResourceIOException */ T serialize(HttpCacheStorageEntry entry) throws ResourceIOException; /** * Deserializes a cache entry from its serialized representation. * @param serializedObject serialized representation of the cache entry * @return cache entry * @throws ResourceIOException */ HttpCacheStorageEntry deserialize(T serializedObject) throws ResourceIOException; }
@Contract(threading = ThreadingBehavior.IMMUTABLE) public final class HttpCacheStorageEntry implements Serializable {
@Contract(threading = ThreadingBehavior.STATELESS) public class HeapResourceFactory implements ResourceFactory {
@Contract(threading = ThreadingBehavior.SAFE) public final class ConcurrentCountMap<T> {
@Contract(threading = ThreadingBehavior.SAFE) public abstract class Resource implements Serializable {
@Contract(threading = ThreadingBehavior.STATELESS) public final class ByteArrayCacheEntrySerializer implements HttpCacheEntrySerializer<byte[]> {
@Contract(threading = ThreadingBehavior.IMMUTABLE) public class HeapResource extends Resource {
@Contract(threading = ThreadingBehavior.STATELESS) public interface ResourceFactory {
@Contract(threading = ThreadingBehavior.SAFE) public interface HttpCacheStorage {
@Contract(threading = ThreadingBehavior.STATELESS) public class ExponentialBackOffSchedulingStrategy implements SchedulingStrategy {
@Contract(threading = ThreadingBehavior.SAFE) public interface HttpAsyncCacheStorage {
@Contract(threading = ThreadingBehavior.SAFE) public class FileResource extends Resource {
@Contract(threading = ThreadingBehavior.SAFE) public class BasicHttpCacheStorage implements HttpCacheStorage {
@Contract(threading = ThreadingBehavior.SAFE_CONDITIONAL) public final class HttpAsyncCacheStorageAdaptor implements HttpAsyncCacheStorage {
@Contract(threading = ThreadingBehavior.STATELESS) public class FileResourceFactory implements ResourceFactory {
@Contract(threading = ThreadingBehavior.STATELESS) public class CacheKeyGenerator implements Resolver<URI, String> {