@Private
public class RetryCache
extends java.lang.Object
RetryCache and the previous response is sent back to the request.
To look an implementation using this cache, see HDFS FSNamesystem class.
| Modifier and Type | Class | Description |
|---|---|---|
static class |
RetryCache.CacheEntry |
CacheEntry is tracked using unique client ID and callId of the RPC request.
|
static class |
RetryCache.CacheEntryWithPayload |
CacheEntry with payload that tracks the previous response or parts of
previous response to be used for generating response for retried requests.
|
| Modifier and Type | Field | Description |
|---|---|---|
static org.slf4j.Logger |
LOG |
| Constructor | Description |
|---|---|
RetryCache(java.lang.String cacheName,
double percentage,
long expirationTime) |
Constructor
|
| Modifier and Type | Method | Description |
|---|---|---|
void |
addCacheEntry(byte[] clientId,
int callId) |
Add a new cache entry into the retry cache.
|
void |
addCacheEntryWithPayload(byte[] clientId,
int callId,
java.lang.Object payload) |
|
static void |
clear(RetryCache cache) |
|
java.lang.String |
getCacheName() |
|
LightWeightGSet<RetryCache.CacheEntry,RetryCache.CacheEntry> |
getCacheSet() |
|
RetryCacheMetrics |
getMetricsForTests() |
|
void |
lock() |
|
static void |
setState(RetryCache.CacheEntry e,
boolean success) |
|
static void |
setState(RetryCache.CacheEntryWithPayload e,
boolean success,
java.lang.Object payload) |
|
void |
unlock() |
|
static RetryCache.CacheEntry |
waitForCompletion(RetryCache cache,
byte[] clientId,
int callId) |
Static method that provides null check for retryCache.
|
static RetryCache.CacheEntryWithPayload |
waitForCompletion(RetryCache cache,
java.lang.Object payload,
byte[] clientId,
int callId) |
Static method that provides null check for retryCache.
|
public RetryCache(java.lang.String cacheName,
double percentage,
long expirationTime)
cacheName - name to identify the cache bypercentage - percentage of total java heap space used by this cacheexpirationTime - time for an entry to expire in nanosecondspublic void lock()
public void unlock()
@VisibleForTesting public LightWeightGSet<RetryCache.CacheEntry,RetryCache.CacheEntry> getCacheSet()
@VisibleForTesting public RetryCacheMetrics getMetricsForTests()
public java.lang.String getCacheName()
public void addCacheEntry(byte[] clientId,
int callId)
clientId - input clientId.callId - input callId.public void addCacheEntryWithPayload(byte[] clientId,
int callId,
java.lang.Object payload)
public static RetryCache.CacheEntry waitForCompletion(RetryCache cache, byte[] clientId, int callId)
cache - input Cache.clientId - client id of this requestcallId - client call id of this requestpublic static RetryCache.CacheEntryWithPayload waitForCompletion(RetryCache cache, java.lang.Object payload, byte[] clientId, int callId)
cache - input cache.payload - input payload.clientId - client id of this requestcallId - client call id of this requestpublic static void setState(RetryCache.CacheEntry e, boolean success)
public static void setState(RetryCache.CacheEntryWithPayload e, boolean success, java.lang.Object payload)
public static void clear(RetryCache cache)
Copyright © 2008–2025 Apache Software Foundation. All rights reserved.