HADOOP-9822. create constant MAX_CAPACITY in RetryCache rather than hard-coding 16 in RetryCache constructor. Contributed by Tsuyoshi Ozawa.

This commit is contained in:
Haohui Mai 2015-11-23 13:22:20 -08:00
parent d36b6e045f
commit 5f269a0ad8
2 changed files with 5 additions and 1 deletions

View File

@ -1358,6 +1358,9 @@ Release 2.8.0 - UNRELEASED
HADOOP-11149. TestZKFailoverController times out. (Steve Loughran
via ozawa)
HADOOP-9822. Create constant MAX_CAPACITY in RetryCache rather than
hard-coding 16 in RetryCache constructor. (Tsuyoshi Ozawa via wheat9)
OPTIMIZATIONS
HADOOP-12051. ProtobufRpcEngine.invoke() should use Exception.toString()

View File

@ -46,6 +46,7 @@
public class RetryCache {
public static final Log LOG = LogFactory.getLog(RetryCache.class);
private final RetryCacheMetrics retryCacheMetrics;
private static final int MAX_CAPACITY = 16;
/**
* CacheEntry is tracked using unique client ID and callId of the RPC request
@ -194,7 +195,7 @@ public Object getPayload() {
*/
public RetryCache(String cacheName, double percentage, long expirationTime) {
int capacity = LightWeightGSet.computeCapacity(percentage, cacheName);
capacity = capacity > 16 ? capacity : 16;
capacity = capacity > MAX_CAPACITY ? capacity : MAX_CAPACITY;
this.set = new LightWeightCache<CacheEntry, CacheEntry>(capacity, capacity,
expirationTime, 0);
this.expirationTime = expirationTime;