CPD Results
The following document contains the results of PMD's CPD 5.1.2.
Duplications
File |
Line |
org/apache/commons/jcs/auxiliary/remote/http/server/AbstractRemoteCacheService.java |
130 |
org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheServer.java |
459 |
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
*/
@Override
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
*/
@Override
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/commons/jcs/engine/memory/AbstractDoubleLinkedListMemoryCache.java |
343 |
org/apache/commons/jcs/engine/memory/soft/SoftReferenceMemoryCache.java |
147 |
}
/**
* 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 the removal was successful
* @throws IOException
*/
@Override
public 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.
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()))
{
lock.lock();
try
{ |
File |
Line |
org/apache/commons/jcs/engine/memory/AbstractDoubleLinkedListMemoryCache.java |
379 |
org/apache/commons/jcs/engine/memory/soft/SoftReferenceMemoryCache.java |
184 |
list.remove(entry.getValue());
itr.remove();
removed = true;
}
finally
{
lock.unlock();
}
}
}
}
else if (key instanceof GroupAttrName && ((GroupAttrName<?>) key).attrName == null)
{
// remove all keys of the same name hierarchy.
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))
{
lock.lock();
try
{ |
File |
Line |
org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPDiscoveryListener.java |
237 |
org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPDiscoveryListener.java |
295 |
public void addDiscoveredService( DiscoveredService service )
{
// get a cache and add it to the no waits
// the add method should not add the same.
// we need the listener port from the original config.
ArrayList<String> regions = service.getCacheNames();
String serverAndPort = service.getServiceAddress() + ":" + service.getServicePort();
if ( regions != null )
{
// for each region get the cache
for (String cacheName : regions)
{
AuxiliaryCache<?, ?> ic = cacheManager.getAuxiliaryCache(factoryName, cacheName);
if ( log.isDebugEnabled() )
{
log.debug( "Got cache, ic = " + ic );
}
// add this to the nowaits for this cachename
if ( ic != null )
{
AuxiliaryCacheAttributes aca = ic.getAuxiliaryCacheAttributes();
if (aca instanceof ITCPLateralCacheAttributes)
{
ITCPLateralCacheAttributes lca = (ITCPLateralCacheAttributes)aca;
if (lca.getTransmissionType() != LateralCacheAttributes.Type.TCP
|| !serverAndPort.equals(lca.getTcpServer()) )
{
// skip caches not belonging to this service
continue;
}
} |
File |
Line |
org/apache/commons/jcs/auxiliary/lateral/LateralCacheNoWait.java |
154 |
org/apache/commons/jcs/auxiliary/lateral/LateralCacheNoWaitFacade.java |
234 |
eventQueue.destroy();
}
}
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
*/
@Override
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.
* <p>
* @param pattern
* @return ICacheElement<K, V> if found, else empty
*/
@Override
public Map<K, ICacheElement<K, V>> getMatching(String pattern)
{ |
File |
Line |
org/apache/commons/jcs/engine/memory/AbstractDoubleLinkedListMemoryCache.java |
546 |
org/apache/commons/jcs/utils/struct/AbstractLRUMap.java |
470 |
log.error("verifycache[" + getCacheName() + "]: map does not contain key : " + key);
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(key) == null) |
File |
Line |
org/apache/commons/jcs/auxiliary/remote/http/server/AbstractRemoteCacheService.java |
263 |
org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheServer.java |
747 |
@Override
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
*/
@Override
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/commons/jcs/auxiliary/lateral/LateralCache.java |
170 |
org/apache/commons/jcs/auxiliary/remote/AbstractRemoteAuxiliaryCache.java |
313 |
}
/**
* 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;
}
/**
* Return the keys in this cache.
* <p>
* @see org.apache.commons.jcs.auxiliary.AuxiliaryCache#getKeySet()
*/
@Override |
File |
Line |
org/apache/commons/jcs/auxiliary/remote/http/server/AbstractRemoteCacheService.java |
210 |
org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheServer.java |
624 |
@Override
public Map<K, ICacheElement<K, V>> getMatching( String cacheName, String pattern )
throws IOException
{
return getMatching( cacheName, pattern, 0 );
}
/**
* Retrieves all matching keys.
* <p>
* @param cacheName
* @param pattern
* @param requesterId
* @return Map of keys and wrapped objects
* @throws IOException
*/
@Override
public Map<K, ICacheElement<K, V>> getMatching( String cacheName, String pattern, long requesterId )
throws IOException
{
ICacheEvent<String> cacheEvent = createICacheEvent( cacheName, pattern, requesterId,
ICacheEventLogger.GETMATCHING_EVENT );
try
{
return processGetMatching( cacheName, pattern, requesterId );
}
finally
{
logICacheEvent( cacheEvent );
}
} |
File |
Line |
org/apache/commons/jcs/engine/memory/AbstractDoubleLinkedListMemoryCache.java |
390 |
org/apache/commons/jcs/engine/memory/lru/LHMLRUMemoryCache.java |
166 |
org/apache/commons/jcs/engine/memory/soft/SoftReferenceMemoryCache.java |
195 |
else if (key instanceof GroupAttrName && ((GroupAttrName<?>) key).attrName == null)
{
// remove all keys of the same name hierarchy.
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))
{ |
|