for (; item != null; item = item.getNext()) { if ( (hashCode == item.getHashCode()) && (item.getKey().equals(sessionKey)) ) value = item.getValue(); break; try { item.wait(); } catch (InterruptedException inEx) {} return (StatefulEJBContext) item.getValue(); current = current.getNext()) buckets[index] = current.getNext(); } else { prev.setNext( current.getNext() ); current.setNext( null ); break;
for (item = buckets[index]; item != null; item = item.getNext()) { if (item.getValue() == ctx) { LruCacheItem lruSCItem = (LruCacheItem) item; if (!lruSCItem.isTrimmed()) { for (item = buckets[index]; item != null; item = item.getNext()) { if (item.getValue() == ctx) { LruCacheItem lruSCItem = (LruCacheItem) item; if (!lruSCItem.isTrimmed()) { buckets[index] = item.getNext(); } else { prev.setNext( item.getNext() ); item.setNext( null ); break;
oldSize = oldItem.getSize(); oldValue = oldItem.refreshValue(value, size); itemRefreshed(oldItem, oldSize);
oldSize = oldItem.getSize(); oldValue = oldItem.refreshValue(value, size); itemRefreshed(oldItem, oldSize);
oldSize = oldItem.getSize(); oldValue = oldItem.refreshValue(value, size); itemRefreshed(oldItem, oldSize);
oldSize = oldItem.getSize(); oldValue = oldItem.refreshValue(value, size); itemRefreshed(oldItem, oldSize);
value = item.getValue(); itemAccessed(item);
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(); }
/** * 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(); }
/** * this item is just added to the cache * @param item <code>CacheItem</code> that was created * @return a overflow item; may be null * * Cache bucket is already synchronized by the caller */ protected CacheItem itemAdded(CacheItem item) { LruCacheItem overflow = (LruCacheItem) super.itemAdded(item); // update the size if (overflow != null) { decrementCurrentSize(overflow.getSize()); } incrementCurrentSize(item.getSize()); return overflow; }
/** * this item is just added to the cache * @param item <code>CacheItem</code> that was created * @return a overflow item; may be null * * Cache bucket is already synchronized by the caller */ protected CacheItem itemAdded(CacheItem item) { LruCacheItem overflow = (LruCacheItem) super.itemAdded(item); // update the size if (overflow != null) { decrementCurrentSize(overflow.getSize()); } incrementCurrentSize(item.getSize()); return overflow; }
/** * this item is just added to the cache * @param item <code>CacheItem</code> that was created * @return a overflow item; may be null * * Cache bucket is already synchronized by the caller */ protected CacheItem itemAdded(CacheItem item) { LruCacheItem overflow = (LruCacheItem) super.itemAdded(item); // update the size if (overflow != null) { decrementCurrentSize(overflow.getSize()); } incrementCurrentSize(item.getSize()); return overflow; }