Class DefaultFailureCache
java.lang.Object
org.apache.http.impl.client.cache.DefaultFailureCache
- All Implemented Interfaces:
FailureCache
Implements a bounded failure cache. The oldest entries are discarded when
the maximum size is exceeded.
- Since:
- 4.3
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a new failure cache with the maximum size ofDEFAULT_MAX_SIZE.DefaultFailureCache(int maxSize) Creates a new failure cache with the specified maximum size. -
Method Summary
Modifier and TypeMethodDescriptionintgetErrorCount(String identifier) Get the current error count.voidincreaseErrorCount(String identifier) Increases the error count by one.voidresetErrorCount(String identifier) Reset the error count back to zero.
-
Constructor Details
-
DefaultFailureCache
public DefaultFailureCache()Create a new failure cache with the maximum size ofDEFAULT_MAX_SIZE. -
DefaultFailureCache
public DefaultFailureCache(int maxSize) Creates a new failure cache with the specified maximum size.- Parameters:
maxSize- the maximum number of entries the cache should store
-
-
Method Details
-
getErrorCount
Description copied from interface:FailureCacheGet the current error count.- Specified by:
getErrorCountin interfaceFailureCache- Parameters:
identifier- the identifier for which the error count is requested- Returns:
- the currently known error count or zero if there is no record
-
resetErrorCount
Description copied from interface:FailureCacheReset the error count back to zero.- Specified by:
resetErrorCountin interfaceFailureCache- Parameters:
identifier- the identifier for which the error count should be reset
-
increaseErrorCount
Description copied from interface:FailureCacheIncreases the error count by one.- Specified by:
increaseErrorCountin interfaceFailureCache- Parameters:
identifier- the identifier for which the error count should be increased
-