/** * get all the items stored at the key. * @param key lookup key * @returns an Iterator over the items with the given key. */ public Iterator getAll(Object key) { int hashCode = hash(key); int index = getIndex(hashCode); ArrayList valueList = new ArrayList(entryCount); synchronized (bucketLocks[index]) { CacheItem item = buckets[index]; for (; item != null; item = item.next) { if ( (hashCode == item.hashCode) && eq(key, item.key) ) { incrementHitCount(); valueList.add(item.getValue()); } } } return valueList.iterator(); }
/** * get all the items stored at the key. * @param key lookup key * @returns an Iterator over the items with the given key. */ public Iterator getAll(Object key) { int hashCode = hash(key); int index = getIndex(hashCode); ArrayList valueList = new ArrayList(entryCount); synchronized (bucketLocks[index]) { CacheItem item = buckets[index]; for (; item != null; item = item.next) { if ( (hashCode == item.hashCode) && eq(key, item.key) ) { incrementHitCount(); valueList.add(item.getValue()); } } } return valueList.iterator(); }
/** * get all the items stored at the key. * @param key lookup key * @returns an Iterator over the items with the given key. */ public Iterator getAll(Object key) { int hashCode = hash(key); int index = getIndex(hashCode); ArrayList valueList = new ArrayList(entryCount); synchronized (bucketLocks[index]) { CacheItem item = buckets[index]; for (; item != null; item = item.next) { if ( (hashCode == item.hashCode) && eq(key, item.key) ) { incrementHitCount(); valueList.add(item.getValue()); } } } return valueList.iterator(); }
value = item.getValue(); itemAccessed(item);
value = item.getValue(); itemAccessed(item);
value = item.getValue(); itemAccessed(item);
/** * trim the item from the cache and notify listeners * @param item to be trimmed */ protected void trimItem(CacheItem item) { LruCacheItem removed = (LruCacheItem) item; if (removeIfIdle) { StatefulEJBContext ctx = (StatefulEJBContext) item.getValue(); long idleThreshold = System.currentTimeMillis() - removalTimeoutInSeconds*1000L; if (ctx.getLastAccessTime() <= idleThreshold) { container.passivateEJB(ctx); return; } } for (int i = 0; i < listeners.size(); i++) { CacheListener listener = (CacheListener) listeners.get(i); listener.trimEvent(removed.getKey(), removed.getValue()); } }
/** * get all the items stored at the key. * @param key lookup key * @returns an Iterator over the items with the given key. */ public Iterator getAll(Object key) { int hashCode = hash(key); int index = getIndex(hashCode); ArrayList valueList = new ArrayList(entryCount); synchronized (bucketLocks[index]) { CacheItem item = buckets[index]; for (; item != null; item = item.next) { if ( (hashCode == item.hashCode) && eq(key, item.key) ) { incrementHitCount(); valueList.add(item.getValue()); } } } return valueList.iterator(); }
/** * remove the given value stored at the key; value-specific removals. * @param key lookup key * @param value to match (for a multi-valued keys) * @returns the item stored at the key; null if not found. */ public Object remove(Object key, Object value) { int hashCode = hash(key); Object retVal = null; CacheItem removed = _remove( hashCode, key, value); if (removed != null) retVal = removed.getValue(); return retVal; }
/** * remove the given value stored at the key; value-specific removals. * @param key lookup key * @param value to match (for a multi-valued keys) * @returns the item stored at the key; null if not found. */ public Object remove(Object key, Object value) { int hashCode = hash(key); Object retVal = null; CacheItem removed = _remove( hashCode, key, value); if (removed != null) retVal = removed.getValue(); return retVal; }
/** * remove the given value stored at the key; value-specific removals. * @param key lookup key * @param value to match (for a multi-valued keys) * @returns the item stored at the key; null if not found. */ public Object remove(Object key, Object value) { int hashCode = hash(key); Object retVal = null; CacheItem removed = _remove( hashCode, key, value); if (removed != null) retVal = removed.getValue(); return retVal; }
/** * remove the item stored at the key. * @param hashCode a precomputed hashCode * @param key lookup key * @returns the item stored at the key; null if not found. */ public Object remove(int hashCode, Object key) { Object retVal = null; CacheItem removed = _remove( hashCode, key, null); if (removed != null) retVal = removed.getValue(); return retVal; }
/** * remove the item stored at the key. * @param key lookup key * @returns the item stored at the key; null if not found. */ public Object remove(Object key) { int hashCode = hash(key); Object retVal = null; CacheItem removed = _remove( hashCode, key, null); if (removed != null) retVal = removed.getValue(); return retVal; }
/** * remove the item stored at the key. * @param hashCode a precomputed hashCode * @param key lookup key * @returns the item stored at the key; null if not found. */ public Object remove(int hashCode, Object key) { Object retVal = null; CacheItem removed = _remove( hashCode, key, null); if (removed != null) retVal = removed.getValue(); return retVal; }
/** * remove the given value stored at the key; value-specific removals. * @param key lookup key * @param value to match (for a multi-valued keys) * @returns the item stored at the key; null if not found. */ public Object remove(Object key, Object value) { int hashCode = hash(key); Object retVal = null; CacheItem removed = _remove( hashCode, key, value); if (removed != null) retVal = removed.getValue(); return retVal; }
/** * remove the item stored at the key. * @param hashCode a precomputed hashCode * @param key lookup key * @returns the item stored at the key; null if not found. */ public Object remove(int hashCode, Object key) { Object retVal = null; CacheItem removed = _remove( hashCode, key, null); if (removed != null) retVal = removed.getValue(); return retVal; }
/** * remove the item stored at the key. * @param key lookup key * @returns the item stored at the key; null if not found. */ public Object remove(Object key) { int hashCode = hash(key); Object retVal = null; CacheItem removed = _remove( hashCode, key, null); if (removed != null) retVal = removed.getValue(); return retVal; }
/** * remove the item stored at the key. * @param hashCode a precomputed hashCode * @param key lookup key * @returns the item stored at the key; null if not found. */ public Object remove(int hashCode, Object key) { Object retVal = null; CacheItem removed = _remove( hashCode, key, null); if (removed != null) retVal = removed.getValue(); return retVal; }
/** * remove the item stored at the key. * @param key lookup key * @returns the item stored at the key; null if not found. */ public Object remove(Object key) { int hashCode = hash(key); Object retVal = null; CacheItem removed = _remove( hashCode, key, null); if (removed != null) retVal = removed.getValue(); return retVal; }
/** * remove the item stored at the key. * @param key lookup key * @returns the item stored at the key; null if not found. */ public Object remove(Object key) { int hashCode = hash(key); Object retVal = null; CacheItem removed = _remove( hashCode, key, null); if (removed != null) retVal = removed.getValue(); return retVal; }