/** * clear all the entries from the cache. * @returns the number of entries cleared from the cache */ public int clear() { CacheItem item=null, next=null; int count = 0; for (int index = 0; index < maxBuckets; index++) { synchronized (bucketLocks[index]) { for (item = buckets[index]; item != null; item = item.next) { next = item.next; item.next = null; count++; decrementEntryCount(); itemRemoved(item); if (entryCount == 0) break; } buckets[index] = null; } } return count; }
/** * clear all the entries from the cache. * @returns the number of entries cleared from the cache */ public int clear() { CacheItem item=null, next=null; int count = 0; for (int index = 0; index < maxBuckets; index++) { synchronized (bucketLocks[index]) { for (item = buckets[index]; item != null; item = item.next) { next = item.next; item.next = null; count++; decrementEntryCount(); itemRemoved(item); if (entryCount == 0) break; } buckets[index] = null; } } return count; }
/** * clear all the entries from the cache. * @returns the number of entries cleared from the cache */ public int clear() { CacheItem item=null, next=null; int count = 0; for (int index = 0; index < maxBuckets; index++) { synchronized (bucketLocks[index]) { for (item = buckets[index]; item != null; item = item.next) { next = item.next; item.next = null; count++; decrementEntryCount(); itemRemoved(item); if (entryCount == 0) break; } buckets[index] = null; } } return count; }
/** * remove the item stored at the key. * @param item CacheItem to be removed * @return the item stored at the key; null if not found. */ protected CacheItem _removeItem(CacheItem ritem) { int index = getIndex(ritem.hashCode); CacheItem prev = null, item = null; synchronized (bucketLocks[index]) { for (item = buckets[index]; item != null; item = item.next) { if (item == ritem) { if (prev == null) { buckets[index] = item.next; } else { prev.next = item.next; } item.next = null; break; } prev = item; } } if (item != null) { decrementEntryCount(); } return item; }
/** * clear all the entries from the cache. * @returns the number of entries cleared from the cache */ public int clear() { CacheItem item=null, next=null; int count = 0; for (int index = 0; index < maxBuckets; index++) { synchronized (bucketLocks[index]) { for (item = buckets[index]; item != null; item = item.next) { next = item.next; item.next = null; count++; decrementEntryCount(); itemRemoved(item); if (entryCount == 0) break; } buckets[index] = null; } } return count; }
/** * remove the item stored at the key. * @param item CacheItem to be removed * @return the item stored at the key; null if not found. */ protected CacheItem _removeItem(CacheItem ritem) { int index = getIndex(ritem.hashCode); CacheItem prev = null, item = null; synchronized (bucketLocks[index]) { for (item = buckets[index]; item != null; item = item.next) { if (item == ritem) { if (prev == null) { buckets[index] = item.next; } else { prev.next = item.next; } item.next = null; break; } prev = item; } } if (item != null) { decrementEntryCount(); } return item; }
/** * remove the item stored at the key. * @param item CacheItem to be removed * @return the item stored at the key; null if not found. */ protected CacheItem _removeItem(CacheItem ritem) { int index = getIndex(ritem.hashCode); CacheItem prev = null, item = null; synchronized (bucketLocks[index]) { for (item = buckets[index]; item != null; item = item.next) { if (item == ritem) { if (prev == null) { buckets[index] = item.next; } else { prev.next = item.next; } item.next = null; break; } prev = item; } } if (item != null) { decrementEntryCount(); } return item; }
/** * remove the item stored at the key. * @param item CacheItem to be removed * @return the item stored at the key; null if not found. */ protected CacheItem _removeItem(CacheItem ritem) { int index = getIndex(ritem.hashCode); CacheItem prev = null, item = null; synchronized (bucketLocks[index]) { for (item = buckets[index]; item != null; item = item.next) { if (item == ritem) { if (prev == null) { buckets[index] = item.next; } else { prev.next = item.next; } item.next = null; break; } prev = item; } } if (item != null) { decrementEntryCount(); } return item; }
decrementEntryCount(); incrementRemovalCount();
decrementEntryCount(); incrementRemovalCount();
decrementEntryCount(); incrementRemovalCount();
decrementEntryCount(); incrementRemovalCount();
decrementEntryCount(); incrementRemovalCount();
decrementEntryCount(); incrementRemovalCount();
decrementEntryCount(); incrementRemovalCount();
decrementEntryCount(); incrementRemovalCount();