@Override public E put(final E element) { E existing = super.put(element); expandIfNecessary(); return existing; }
public void addCacheEntryWithPayload(byte[] clientId, int callId, Object payload) { // since the entry is loaded from editlog, we can assume it succeeded. CacheEntry newEntry = new CacheEntryWithPayload(clientId, callId, payload, System.nanoTime() + expirationTime, true); lock.lock(); try { set.put(newEntry); } finally { lock.unlock(); } retryCacheMetrics.incrCacheUpdated(); }
/** * Add a new cache entry into the retry cache. The cache entry consists of * clientId and callId extracted from editlog. */ public void addCacheEntry(byte[] clientId, int callId) { CacheEntry newEntry = new CacheEntry(clientId, callId, System.nanoTime() + expirationTime, true); lock.lock(); try { set.put(newEntry); } finally { lock.unlock(); } retryCacheMetrics.incrCacheUpdated(); }
@Override public E put(final E entry) { if (!(entry instanceof Entry)) { throw new HadoopIllegalArgumentException( "!(entry instanceof Entry), entry.getClass()=" + entry.getClass()); } evictExpiredEntries(); final E existing = super.put(entry); if (existing != null) { queue.remove(existing); } final Entry e = (Entry)entry; setExpirationTime(e, creationExpirationPeriod); queue.offer(e); evictEntries(); return existing; }
+ newEntry.callId + " to retryCache"); set.put(newEntry); retryCacheMetrics.incrCacheUpdated(); return newEntry;
@Override public E put(final E element) { E existing = super.put(element); expandIfNecessary(); return existing; }
public void addCacheEntryWithPayload(byte[] clientId, int callId, Object payload) { // since the entry is loaded from editlog, we can assume it succeeded. CacheEntry newEntry = new CacheEntryWithPayload(clientId, callId, payload, System.nanoTime() + expirationTime, true); lock.lock(); try { set.put(newEntry); } finally { lock.unlock(); } retryCacheMetrics.incrCacheUpdated(); }
public void addCacheEntryWithPayload(byte[] clientId, int callId, Object payload) { // since the entry is loaded from editlog, we can assume it succeeded. CacheEntry newEntry = new CacheEntryWithPayload(clientId, callId, payload, System.nanoTime() + expirationTime, true); lock.lock(); try { set.put(newEntry); } finally { lock.unlock(); } retryCacheMetrics.incrCacheUpdated(); }
public void addCacheEntryWithPayload(byte[] clientId, int callId, Object payload) { // since the entry is loaded from editlog, we can assume it succeeded. CacheEntry newEntry = new CacheEntryWithPayload(clientId, callId, payload, System.nanoTime() + expirationTime, true); lock.lock(); try { set.put(newEntry); } finally { lock.unlock(); } retryCacheMetrics.incrCacheUpdated(); }
public void addCacheEntryWithPayload(byte[] clientId, int callId, Object payload) { // since the entry is loaded from editlog, we can assume it succeeded. CacheEntry newEntry = new CacheEntryWithPayload(clientId, callId, payload, System.nanoTime() + expirationTime, true); lock.lock(); try { set.put(newEntry); } finally { lock.unlock(); } retryCacheMetrics.incrCacheUpdated(); }
public void addCacheEntryWithPayload(byte[] clientId, int callId, byte[] payload) { // since the entry is loaded from editlog, we can assume it succeeded. CacheEntry newEntry = new CacheEntryWithPayload(clientId, callId, payload, System.nanoTime() + expirationTime, true); lock.lock(); try { set.put(newEntry); } finally { lock.unlock(); } retryCacheMetrics.incrCacheUpdated(); }
/** * Add a new cache entry into the retry cache. The cache entry consists of * clientId and callId extracted from editlog. */ public void addCacheEntry(byte[] clientId, int callId) { CacheEntry newEntry = new CacheEntry(clientId, callId, System.nanoTime() + expirationTime, true); lock.lock(); try { set.put(newEntry); } finally { lock.unlock(); } retryCacheMetrics.incrCacheUpdated(); }
/** * Add a new cache entry into the retry cache. The cache entry consists of * clientId and callId extracted from editlog. */ public void addCacheEntry(byte[] clientId, int callId) { CacheEntry newEntry = new CacheEntry(clientId, callId, System.nanoTime() + expirationTime, true); lock.lock(); try { set.put(newEntry); } finally { lock.unlock(); } retryCacheMetrics.incrCacheUpdated(); }
/** * Add a new cache entry into the retry cache. The cache entry consists of * clientId and callId extracted from editlog. */ public void addCacheEntry(byte[] clientId, int callId) { CacheEntry newEntry = new CacheEntry(clientId, callId, System.nanoTime() + expirationTime, true); lock.lock(); try { set.put(newEntry); } finally { lock.unlock(); } retryCacheMetrics.incrCacheUpdated(); }
/** * Add a new cache entry into the retry cache. The cache entry consists of * clientId and callId extracted from editlog. */ public void addCacheEntry(byte[] clientId, int callId) { CacheEntry newEntry = new CacheEntry(clientId, callId, System.nanoTime() + expirationTime, true); lock.lock(); try { set.put(newEntry); } finally { lock.unlock(); } retryCacheMetrics.incrCacheUpdated(); }
/** * Add a new cache entry into the retry cache. The cache entry consists of * clientId and callId extracted from editlog. */ public void addCacheEntry(byte[] clientId, int callId) { CacheEntry newEntry = new CacheEntry(clientId, callId, System.nanoTime() + expirationTime, true); lock.lock(); try { set.put(newEntry); } finally { lock.unlock(); } retryCacheMetrics.incrCacheUpdated(); }
public E put(final E entry, long period) { if (!(entry instanceof Entry)) { throw new HadoopIllegalArgumentException( "!(entry instanceof Entry), entry.getClass()=" + entry.getClass()); } evictExpiredEntries(); final E existing = super.put(entry); if (existing != null) { queue.remove(existing); } final Entry e = (Entry)entry; setExpirationTime(e, period); queue.offer(e); evictEntries(); return existing; }
@Override public E put(final E entry) { if (!(entry instanceof Entry)) { throw new HadoopIllegalArgumentException( "!(entry instanceof Entry), entry.getClass()=" + entry.getClass()); } evictExpiredEntries(); final E existing = super.put(entry); if (existing != null) { queue.remove(existing); } final Entry e = (Entry)entry; setExpirationTime(e, creationExpirationPeriod); queue.offer(e); evictEntries(); return existing; }
@Test(timeout=60000) public void testRemoveAllViaIterator() { ArrayList<Integer> list = getRandomList(100, 123); LightWeightGSet<TestElement, TestElement> set = new LightWeightGSet<TestElement, TestElement>(16); for (Integer i : list) { set.put(new TestElement(i)); } for (Iterator<TestElement> iter = set.iterator(); iter.hasNext(); ) { iter.next(); iter.remove(); } Assert.assertEquals(0, set.size()); }
@Test(timeout=60000) public void testRemoveAllViaIterator() { ArrayList<Integer> list = getRandomList(100, 123); LightWeightGSet<TestElement, TestElement> set = new LightWeightGSet<TestElement, TestElement>(16); for (Integer i : list) { set.put(new TestElement(i)); } for (Iterator<TestElement> iter = set.iterator(); iter.hasNext(); ) { iter.next(); iter.remove(); } Assert.assertEquals(0, set.size()); }