| File | Line |
|---|
| org/apache/jcs/engine/memory/AbstractDoubleLinkedListMemoryCache.java | 705 |
| org/apache/jcs/utils/struct/LRUMap.java | 594 |
stats.setTypeName( "LRUMap" );
ArrayList<IStatElement> elems = new ArrayList<IStatElement>();
IStatElement se = null;
se = new StatElement();
se.setName( "List Size" );
se.setData( "" + list.size() );
elems.add( se );
se = new StatElement();
se.setName( "Map Size" );
se.setData( "" + map.size() );
elems.add( se );
se = new StatElement();
se.setName( "Put Count" );
se.setData( "" + putCnt );
elems.add( se );
se = new StatElement();
se.setName( "Hit Count" );
se.setData( "" + hitCnt );
elems.add( se );
se = new StatElement();
se.setName( "Miss Count" );
se.setData( "" + missCnt );
elems.add( se );
// get an array and put them in the Stats object
IStatElement[] ses = elems.toArray( new StatElement[0] );
stats.setStatElements( ses );
return stats;
} |
| File | Line |
|---|
| org/apache/jcs/auxiliary/remote/http/server/AbstractRemoteCacheService.java | 123 |
| org/apache/jcs/auxiliary/remote/server/RemoteCacheServer.java | 389 |
private void logUpdateInfo( ICacheElement<K, V> item )
{
if ( log.isInfoEnabled() )
{
// not thread safe, but it doesn't have to be accurate
puts++;
if ( puts % logInterval == 0 )
{
log.info( "puts = " + puts );
}
}
if ( log.isDebugEnabled() )
{
log.debug( "In update, put [" + item.getKey() + "] in [" + item.getCacheName() + "]" );
}
}
/**
* Returns a cache value from the specified remote cache; or null if the cache or key does not
* exist.
* <p>
* @param cacheName
* @param key
* @return ICacheElement
* @throws IOException
*/
public ICacheElement<K, V> get( String cacheName, K key )
throws IOException
{
return this.get( cacheName, key, 0 );
}
/**
* Returns a cache bean from the specified cache; or null if the key does not exist.
* <p>
* Adding the requestor id, allows the cache to determine the source of the get.
* <p>
* The internal processing is wrapped in event logging calls.
* <p>
* @param cacheName
* @param key
* @param requesterId
* @return ICacheElement
* @throws IOException
*/
public ICacheElement<K, V> get( String cacheName, K key, long requesterId )
throws IOException
{
ICacheElement<K, V> element = null;
ICacheEvent<K> cacheEvent = createICacheEvent( cacheName, key, requesterId, ICacheEventLogger.GET_EVENT );
try
{
element = processGet( cacheName, key, requesterId );
}
finally
{
logICacheEvent( cacheEvent );
}
return element;
} |
| File | Line |
|---|
| org/apache/jcs/engine/memory/AbstractDoubleLinkedListMemoryCache.java | 297 |
| org/apache/jcs/engine/memory/lru/LHMLRUMemoryCache.java | 155 |
}
/**
* Removes an item from the cache. This method handles hierarchical removal. If the key is a
* String and ends with the CacheConstants.NAME_COMPONENT_DELIMITER, then all items with keys
* starting with the argument String will be removed.
* <p>
* @param key
* @return true if removed
* @exception IOException
*/
@Override
public synchronized boolean remove( K key )
throws IOException
{
if ( log.isDebugEnabled() )
{
log.debug( "removing item for key: " + key );
}
boolean removed = false;
// handle partial removal
if ( key instanceof String && ( (String) key ).endsWith( CacheConstants.NAME_COMPONENT_DELIMITER ) )
{
// remove all keys of the same name hierarchy.
synchronized ( map )
{
for (Iterator<Map.Entry<K, MemoryElementDescriptor<K, V>>> itr = map.entrySet().iterator(); itr.hasNext(); )
{
Map.Entry<K, MemoryElementDescriptor<K, V>> entry = itr.next();
K k = entry.getKey();
if ( k instanceof String && ( (String) k ).startsWith( key.toString() ) )
{ |
| File | Line |
|---|
| org/apache/jcs/engine/memory/AbstractDoubleLinkedListMemoryCache.java | 464 |
| org/apache/jcs/utils/struct/LRUMap.java | 454 |
log.error( "li.hashcode=" + li.getKey().hashCode() );
log.error( "key class=" + key.getClass() );
log.error( "key hashcode=" + key.hashCode() );
log.error( "key toString=" + key.toString() );
if ( key instanceof GroupAttrName )
{
GroupAttrName<?> name = (GroupAttrName<?>) key;
log.error( "GroupID hashcode=" + name.groupId.hashCode() );
log.error( "GroupID.class=" + name.groupId.getClass() );
log.error( "AttrName hashcode=" + name.attrName.hashCode() );
log.error( "AttrName.class=" + name.attrName.getClass() );
}
dumpMap();
}
else if ( map.get( li.getKey() ) == null ) |
| File | Line |
|---|
| org/apache/jcs/engine/memory/lru/LHMLRUMemoryCache.java | 260 |
| org/apache/jcs/utils/struct/LRUMap.java | 605 |
se = new StatElement();
se.setName( "Map Size" );
se.setData( "" + map.size() );
elems.add( se );
se = new StatElement();
se.setName( "Put Count" );
se.setData( "" + putCnt );
elems.add( se );
se = new StatElement();
se.setName( "Hit Count" );
se.setData( "" + hitCnt );
elems.add( se );
se = new StatElement();
se.setName( "Miss Count" );
se.setData( "" + missCnt );
elems.add( se );
// get an array and put them in the Stats object
IStatElement[] ses = elems.toArray( new StatElement[0] );
stats.setStatElements( ses );
return stats;
}
/**
* This returns a set of entries. Our LRUMapEntry is used since the value stored in the
* underlying map is a node in the double linked list. We wouldn't want to return this to the
* client, so we construct a new entry with the payload of the node.
* <p>
* TODO we should return out own set wrapper, so we can avoid the extra object creation if it
* isn't necessary.
* <p>
* @see java.util.Map#entrySet()
*/
public synchronized Set<Map.Entry<K, V>> entrySet() |
| File | Line |
|---|
| org/apache/jcs/engine/memory/AbstractDoubleLinkedListMemoryCache.java | 716 |
| org/apache/jcs/engine/memory/lru/LHMLRUMemoryCache.java | 260 |
se = new StatElement();
se.setName( "Map Size" );
se.setData( "" + map.size() );
elems.add( se );
se = new StatElement();
se.setName( "Put Count" );
se.setData( "" + putCnt );
elems.add( se );
se = new StatElement();
se.setName( "Hit Count" );
se.setData( "" + hitCnt );
elems.add( se );
se = new StatElement();
se.setName( "Miss Count" );
se.setData( "" + missCnt );
elems.add( se );
// get an array and put them in the Stats object
IStatElement[] ses = elems.toArray( new StatElement[0] );
stats.setStatElements( ses );
// int rate = ((hitCnt + missCnt) * 100) / (hitCnt * 100) * 100;
// buf.append("\n Hit Rate = " + rate + " %" );
return stats;
} |
| File | Line |
|---|
| org/apache/jcs/auxiliary/lateral/LateralCacheNoWait.java | 157 |
| org/apache/jcs/auxiliary/lateral/LateralCacheNoWaitFacade.java | 238 |
log.error( "Failed to get", ex );
}
}
return null;
}
/**
* Gets multiple items from the cache based on the given set of keys.
* <p>
* @param keys
* @return a map of K key to ICacheElement<K, V> element, or an empty map if there is no
* data in cache for any of these keys
*/
public Map<K, ICacheElement<K, V>> getMultiple(Set<K> keys)
{
Map<K, ICacheElement<K, V>> elements = new HashMap<K, ICacheElement<K, V>>();
if ( keys != null && !keys.isEmpty() )
{
for (K key : keys)
{
ICacheElement<K, V> element = get( key );
if ( element != null )
{
elements.put( key, element );
}
}
}
return elements;
}
/**
* Synchronously reads from the lateral cache. Get a response from each! This will be slow.
* Merge them.
* <p>
* @param pattern
* @return ICacheElement
*/
public Map<K, ICacheElement<K, V>> getMatching(String pattern)
{ |
| File | Line |
|---|
| org/apache/jcs/engine/CacheEventQueue.java | 258 |
| org/apache/jcs/engine/control/event/ElementEventQueue.java | 308 |
AbstractElementEventRunner event = null;
while ( queue.isAlive() )
{
event = queue.take();
if ( log.isDebugEnabled() )
{
log.debug( "Event from queue = " + event );
}
if ( event == null )
{
synchronized ( queueLock )
{
try
{
queueLock.wait( queue.getWaitToDieMillis() );
}
catch ( InterruptedException e )
{
log.warn( "Interrupted while waiting for another event to come in before we die." );
return;
}
event = queue.take();
if ( log.isDebugEnabled() )
{
log.debug( "Event from queue after sleep = " + event );
}
}
if ( event == null )
{
queue.stopProcessing();
}
}
if ( queue.isAlive() && event != null ) |
| File | Line |
|---|
| org/apache/jcs/auxiliary/remote/RemoteCacheFactory.java | 172 |
| org/apache/jcs/auxiliary/remote/http/client/RemoteHttpCacheFactory.java | 89 |
}
@SuppressWarnings("unchecked") // No generic arrays in java
RemoteCacheNoWait<K, V>[] rcnwArray = noWaits.toArray( new RemoteCacheNoWait[0] );
RemoteCacheNoWaitFacade<K, V> rcnwf =
new RemoteCacheNoWaitFacade<K, V>(rcnwArray, rca, cacheMgr, cacheEventLogger, elementSerializer );
getFacades().put( rca.getCacheName(), rcnwf );
return rcnwf;
}
/**
* Gets the name attribute of the RemoteCacheFactory object
* <p>
* @return The name value
*/
public String getName()
{
return this.name;
}
/**
* Sets the name attribute of the RemoteCacheFactory object
* <p>
* @param name The new name value
*/
public void setName( String name )
{
this.name = name;
}
/**
* The facades are what the cache hub talks to.
* @return Returns the facades.
*/
public static HashMap<String, RemoteCacheNoWaitFacade<? extends Serializable, ? extends Serializable>> getFacades()
{
return facades;
}
} |
| File | Line |
|---|
| org/apache/jcs/auxiliary/remote/http/server/AbstractRemoteCacheService.java | 258 |
| org/apache/jcs/auxiliary/remote/server/RemoteCacheServer.java | 681 |
public Map<K, ICacheElement<K, V>> getMultiple( String cacheName, Set<K> keys )
throws IOException
{
return this.getMultiple( cacheName, keys, 0 );
}
/**
* Gets multiple items from the cache based on the given set of keys.
* <p>
* The internal processing is wrapped in event logging calls.
* <p>
* @param cacheName
* @param keys
* @param requesterId
* @return a map of K key to ICacheElement<K, V> element, or an empty map if there is no
* data in cache for any of these keys
* @throws IOException
*/
public Map<K, ICacheElement<K, V>> getMultiple( String cacheName, Set<K> keys, long requesterId )
throws IOException
{
ICacheEvent<Serializable> cacheEvent = createICacheEvent( cacheName, (Serializable) keys, requesterId,
ICacheEventLogger.GETMULTIPLE_EVENT );
try
{
return processGetMultiple( cacheName, keys, requesterId );
}
finally
{
logICacheEvent( cacheEvent );
}
} |
| File | Line |
|---|
| org/apache/jcs/auxiliary/lateral/LateralCacheNoWaitFacade.java | 354 |
| org/apache/jcs/auxiliary/remote/AbstractRemoteCacheNoWaitFacade.java | 274 |
}
/**
* Adds a remove request to the remote cache.
* <p>
* @param key
* @return whether or not it was removed, right now it return false.
*/
public boolean remove( K key )
{
try
{
for ( int i = 0; i < noWaits.length; i++ )
{
noWaits[i].remove( key );
}
}
catch ( Exception ex )
{
log.error( ex );
}
return false;
}
/**
* Adds a removeAll request to the remote cache.
*/
public void removeAll()
{
try
{
for ( int i = 0; i < noWaits.length; i++ )
{
noWaits[i].removeAll();
}
}
catch ( Exception ex )
{
log.error( ex );
}
}
/** Adds a dispose request to the remote cache. */
public void dispose()
{
try
{ |
| File | Line |
|---|
| org/apache/jcs/auxiliary/lateral/LateralCache.java | 176 |
| org/apache/jcs/auxiliary/remote/AbstractRemoteAuxiliaryCache.java | 316 |
}
/**
* Gets multiple items from the cache based on the given set of keys.
* <p>
* @param keys
* @return a map of K key to ICacheElement<K, V> element, or an empty map if there is no
* data in cache for any of these keys
* @throws IOException
*/
@Override
protected Map<K, ICacheElement<K, V>> processGetMultiple( Set<K> keys )
throws IOException
{
Map<K, ICacheElement<K, V>> elements = new HashMap<K, ICacheElement<K, V>>();
if ( keys != null && !keys.isEmpty() )
{
for (K key : keys)
{
ICacheElement<K, V> element = get( key );
if ( element != null )
{
elements.put( key, element );
}
}
}
return elements;
} |
| File | Line |
|---|
| org/apache/jcs/engine/memory/AbstractDoubleLinkedListMemoryCache.java | 339 |
| org/apache/jcs/engine/memory/lru/LHMLRUMemoryCache.java | 196 |
else if ( key instanceof GroupAttrName && ((GroupAttrName<?>)key).attrName == null )
{
// remove all keys of the same name hierarchy.
synchronized ( map )
{
for (Iterator<Map.Entry<K, MemoryElementDescriptor<K, V>>> itr = map.entrySet().iterator(); itr.hasNext(); )
{
Map.Entry<K, MemoryElementDescriptor<K, V>> entry = itr.next();
K k = entry.getKey();
if ( k instanceof GroupAttrName &&
((GroupAttrName<?>)k).groupId.equals(((GroupAttrName<?>)key).groupId) )
{ |
| File | Line |
|---|
| org/apache/jcs/engine/control/CompositeCache.java | 751 |
| org/apache/jcs/engine/control/CompositeCache.java | 905 |
for ( int i = auxCaches.length - 1; i >= 0; i-- )
{
AuxiliaryCache<K, V> aux = auxCaches[i];
if ( aux != null )
{
Map<K, ICacheElement<K, V>> elementsFromAuxiliary =
new HashMap<K, ICacheElement<K, V>>();
CacheType cacheType = aux.getCacheType();
if ( !localOnly || cacheType == CacheType.DISK_CACHE )
{
if ( log.isDebugEnabled() )
{
log.debug( "Attempting to get from aux [" + aux.getCacheName() + "] which is of type: "
+ cacheType );
}
try
{
elementsFromAuxiliary.putAll( aux.getMatching( pattern ) ); |