You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by tv...@apache.org on 2014/01/06 18:01:52 UTC
svn commit: r1555918 [2/4] - in /commons/proper/jcs/trunk/src: changes/
java/org/apache/commons/jcs/ java/org/apache/commons/jcs/access/
java/org/apache/commons/jcs/access/behavior/
java/org/apache/commons/jcs/auxiliary/ java/org/apache/commons/jcs/aux...
Modified: commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/disk/file/FileDiskCache.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/disk/file/FileDiskCache.java?rev=1555918&r1=1555917&r2=1555918&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/disk/file/FileDiskCache.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/disk/file/FileDiskCache.java Mon Jan 6 17:01:48 2014
@@ -135,24 +135,12 @@ public class FileDiskCache<K extends Ser
}
/**
- * Gets the set of keys of objects currently in the group.
+ * Return the keys in this cache.
* <p>
- * @param group
- * @return a Set of group keys.
+ * @see org.apache.commons.jcs.auxiliary.disk.AbstractDiskCache#getKeySet()
*/
@Override
- public Set<K> getGroupKeys(String groupName)
- {
- throw new UnsupportedOperationException();
- }
-
- /**
- * Gets the set of group names in the cache
- * <p>
- * @return a Set of group names.
- */
- @Override
- public Set<String> getGroupNames()
+ public Set<K> getKeySet() throws IOException
{
throw new UnsupportedOperationException();
}
Modified: commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskCache.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskCache.java?rev=1555918&r1=1555917&r2=1555918&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskCache.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/disk/indexed/IndexedDiskCache.java Mon Jan 6 17:01:48 2014
@@ -739,66 +739,27 @@ public class IndexedDiskCache<K extends
}
/**
- * Gets the group keys from the disk.
+ * Return the keys in this cache.
* <p>
- * @see org.apache.commons.jcs.auxiliary.AuxiliaryCache#getGroupKeys(java.lang.String)
+ * @see org.apache.commons.jcs.auxiliary.disk.AbstractDiskCache#getKeySet()
*/
@Override
- public Set<K> getGroupKeys( String groupName )
+ public Set<K> getKeySet() throws IOException
{
- GroupId groupId = new GroupId( cacheName, groupName );
HashSet<K> keys = new HashSet<K>();
- try
- {
- storageLock.readLock().lock();
- for (Serializable k : keyHash.keySet())
- {
- if ( k instanceof GroupAttrName && ( (GroupAttrName<?>) k ).groupId.equals( groupId ) )
- {
- @SuppressWarnings("unchecked") // Type checked with instanceof
- GroupAttrName<K> groupAttrName = (GroupAttrName<K>) k;
- keys.add( groupAttrName.attrName );
- }
- }
- }
- finally
- {
- storageLock.readLock().unlock();
- }
-
- return keys;
- }
+ storageLock.readLock().lock();
- /**
- * Gets the group names from the disk.
- * <p>
- * @see org.apache.commons.jcs.auxiliary.AuxiliaryCache#getGroupKeys(java.lang.String)
- */
- @Override
- public Set<String> getGroupNames()
- {
- HashSet<String> names = new HashSet<String>();
try
{
- storageLock.readLock().lock();
-
- for (K k : keyHash.keySet())
- {
- if ( k instanceof GroupAttrName )
- {
- @SuppressWarnings("unchecked") // Type checked with instanceof
- GroupAttrName<K> groupAttrName = (GroupAttrName<K>) k;
- names.add( groupAttrName.groupId.groupName );
- }
- }
+ keys.addAll(this.keyHash.keySet());
}
finally
{
storageLock.readLock().unlock();
}
- return names;
+ return keys;
}
/**
Modified: commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/disk/jdbc/JDBCDiskCache.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/disk/jdbc/JDBCDiskCache.java?rev=1555918&r1=1555917&r2=1555918&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/disk/jdbc/JDBCDiskCache.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/disk/jdbc/JDBCDiskCache.java Mon Jan 6 17:01:48 2014
@@ -1038,21 +1038,12 @@ public class JDBCDiskCache<K extends Ser
}
/**
- * @param groupName
- * @return Set
- */
- @Override
- public Set<K> getGroupKeys( String groupName )
- {
- throw new UnsupportedOperationException( "Groups not implemented." );
- // return null;
- }
-
- /**
- * @return Set
+ * Return the keys in this cache.
+ * <p>
+ * @see org.apache.commons.jcs.auxiliary.disk.AbstractDiskCache#getKeySet()
*/
@Override
- public Set<String> getGroupNames()
+ public Set<K> getKeySet() throws IOException
{
throw new UnsupportedOperationException( "Groups not implemented." );
// return null;
Modified: commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/lateral/LateralCache.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/lateral/LateralCache.java?rev=1555918&r1=1555917&r2=1555918&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/lateral/LateralCache.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/lateral/LateralCache.java Mon Jan 6 17:01:48 2014
@@ -52,7 +52,7 @@ public class LateralCache<K extends Seri
private final static Log log = LogFactory.getLog( LateralCache.class );
/** generalize this, use another interface */
- private final ILateralCacheAttributes lateralCacheAttribures;
+ private final ILateralCacheAttributes lateralCacheAttributes;
/** The region name */
final String cacheName;
@@ -73,7 +73,7 @@ public class LateralCache<K extends Seri
public LateralCache( ILateralCacheAttributes cattr, ICacheServiceNonLocal<K, V> lateral, LateralCacheMonitor monitor )
{
this.cacheName = cattr.getCacheName();
- this.lateralCacheAttribures = cattr;
+ this.lateralCacheAttributes = cattr;
this.lateralCacheService = lateral;
this.monitor = monitor;
}
@@ -86,7 +86,7 @@ public class LateralCache<K extends Seri
public LateralCache( ILateralCacheAttributes cattr )
{
this.cacheName = cattr.getCacheName();
- this.lateralCacheAttribures = cattr;
+ this.lateralCacheAttributes = cattr;
}
/**
@@ -111,12 +111,12 @@ public class LateralCache<K extends Seri
catch ( NullPointerException npe )
{
log.error( "Failure updating lateral. lateral = " + lateralCacheService, npe );
- handleException( npe, "Failed to put [" + ce.getKey() + "] to " + ce.getCacheName() + "@" + lateralCacheAttribures );
+ handleException( npe, "Failed to put [" + ce.getKey() + "] to " + ce.getCacheName() + "@" + lateralCacheAttributes );
return;
}
catch ( Exception ex )
{
- handleException( ex, "Failed to put [" + ce.getKey() + "] to " + ce.getCacheName() + "@" + lateralCacheAttribures );
+ handleException( ex, "Failed to put [" + ce.getKey() + "] to " + ce.getCacheName() + "@" + lateralCacheAttributes );
}
}
@@ -133,7 +133,7 @@ public class LateralCache<K extends Seri
{
ICacheElement<K, V> obj = null;
- if ( this.lateralCacheAttribures.getPutOnlyMode() )
+ if ( this.lateralCacheAttributes.getPutOnlyMode() )
{
return null;
}
@@ -144,7 +144,7 @@ public class LateralCache<K extends Seri
catch ( Exception e )
{
log.error( e );
- handleException( e, "Failed to get [" + key + "] from " + lateralCacheAttribures.getCacheName() + "@" + lateralCacheAttribures );
+ handleException( e, "Failed to get [" + key + "] from " + lateralCacheAttributes.getCacheName() + "@" + lateralCacheAttributes );
}
return obj;
}
@@ -159,7 +159,7 @@ public class LateralCache<K extends Seri
protected Map<K, ICacheElement<K, V>> processGetMatching( String pattern )
throws IOException
{
- if ( this.lateralCacheAttribures.getPutOnlyMode() )
+ if ( this.lateralCacheAttributes.getPutOnlyMode() )
{
return Collections.emptyMap();
}
@@ -170,7 +170,7 @@ public class LateralCache<K extends Seri
catch ( IOException e )
{
log.error( e );
- handleException( e, "Failed to getMatching [" + pattern + "] from " + lateralCacheAttribures.getCacheName() + "@" + lateralCacheAttribures );
+ handleException( e, "Failed to getMatching [" + pattern + "] from " + lateralCacheAttributes.getCacheName() + "@" + lateralCacheAttributes );
return Collections.emptyMap();
}
}
@@ -206,44 +206,20 @@ public class LateralCache<K extends Seri
}
/**
- * Gets the set of keys of objects currently in the group.
+ * Return the keys in this cache.
* <p>
- * @param group
- * @return a Set of group keys.
- * @throws IOException
+ * @see org.apache.commons.jcs.auxiliary.AuxiliaryCache#getKeySet()
*/
- public Set<K> getGroupKeys( String groupName )
- throws IOException
- {
- try
- {
- return lateralCacheService.getGroupKeys( cacheName, groupName );
- }
- catch ( Exception ex )
- {
- handleException( ex, "Failed to remove groupName [" + groupName + "] from " + lateralCacheAttribures.getCacheName() + "@"
- + lateralCacheAttribures );
- }
- return Collections.emptySet();
- }
-
- /**
- * Gets the set of group names in the cache
- * <p>
- * @return a Set of group names.
- * @throws IOException
- */
- public Set<String> getGroupNames()
- throws IOException
+ public Set<K> getKeySet() throws IOException
{
try
{
- return lateralCacheService.getGroupNames( cacheName );
+ return lateralCacheService.getKeySet( cacheName );
}
catch ( Exception ex )
{
- handleException( ex, "Failed to get group names from " + lateralCacheAttribures.getCacheName() + "@"
- + lateralCacheAttribures );
+ handleException( ex, "Failed to get key set from " + lateralCacheAttributes.getCacheName() + "@"
+ + lateralCacheAttributes );
}
return Collections.emptySet();
}
@@ -271,7 +247,7 @@ public class LateralCache<K extends Seri
}
catch ( Exception ex )
{
- handleException( ex, "Failed to remove " + key + " from " + lateralCacheAttribures.getCacheName() + "@" + lateralCacheAttribures );
+ handleException( ex, "Failed to remove " + key + " from " + lateralCacheAttributes.getCacheName() + "@" + lateralCacheAttributes );
}
return false;
}
@@ -292,7 +268,7 @@ public class LateralCache<K extends Seri
}
catch ( Exception ex )
{
- handleException( ex, "Failed to remove all from " + lateralCacheAttribures.getCacheName() + "@" + lateralCacheAttribures );
+ handleException( ex, "Failed to remove all from " + lateralCacheAttributes.getCacheName() + "@" + lateralCacheAttributes );
}
}
@@ -313,13 +289,13 @@ public class LateralCache<K extends Seri
// any.
try
{
- lateralCacheService.dispose( this.lateralCacheAttribures.getCacheName() );
+ lateralCacheService.dispose( this.lateralCacheAttributes.getCacheName() );
// Should remove connection
}
catch ( Exception ex )
{
log.error( "Couldn't dispose", ex );
- handleException( ex, "Failed to dispose " + lateralCacheAttribures.getCacheName() );
+ handleException( ex, "Failed to dispose " + lateralCacheAttributes.getCacheName() );
}
}
@@ -375,7 +351,7 @@ public class LateralCache<K extends Seri
{
log.error( "Disabling lateral cache due to error " + msg, ex );
- lateralCacheService = new ZombieCacheServiceNonLocal<K, V>( lateralCacheAttribures.getZombieQueueMaxSize() );
+ lateralCacheService = new ZombieCacheServiceNonLocal<K, V>( lateralCacheAttributes.getZombieQueueMaxSize() );
// may want to flush if region specifies
// Notify the cache monitor about the error, and kick off the recovery
// process.
@@ -437,7 +413,7 @@ public class LateralCache<K extends Seri
*/
public AuxiliaryCacheAttributes getAuxiliaryCacheAttributes()
{
- return lateralCacheAttribures;
+ return lateralCacheAttributes;
}
/**
@@ -448,8 +424,8 @@ public class LateralCache<K extends Seri
{
StringBuffer buf = new StringBuffer();
buf.append( "\n LateralCache " );
- buf.append( "\n Cache Name [" + lateralCacheAttribures.getCacheName() + "]" );
- buf.append( "\n cattr = [" + lateralCacheAttribures + "]" );
+ buf.append( "\n Cache Name [" + lateralCacheAttributes.getCacheName() + "]" );
+ buf.append( "\n cattr = [" + lateralCacheAttributes + "]" );
return buf.toString();
}
Modified: commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/lateral/LateralCacheNoWait.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/lateral/LateralCacheNoWait.java?rev=1555918&r1=1555917&r2=1555918&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/lateral/LateralCacheNoWait.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/lateral/LateralCacheNoWait.java Mon Jan 6 17:01:48 2014
@@ -224,31 +224,15 @@ public class LateralCacheNoWait<K extend
}
/**
- * @param groupName
- * @return Set
- */
- public Set<K> getGroupKeys(String groupName)
- {
- try
- {
- return cache.getGroupKeys( groupName );
- }
- catch ( IOException ex )
- {
- log.error( ex );
- eventQueue.destroy();
- }
- return Collections.emptySet();
- }
-
- /**
- * @return Set
+ * Return the keys in this cache.
+ * <p>
+ * @see org.apache.commons.jcs.auxiliary.AuxiliaryCache#getKeySet()
*/
- public Set<String> getGroupNames()
+ public Set<K> getKeySet() throws IOException
{
try
{
- return cache.getGroupNames( );
+ return cache.getKeySet();
}
catch ( IOException ex )
{
Modified: commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/lateral/LateralCacheNoWaitFacade.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/lateral/LateralCacheNoWaitFacade.java?rev=1555918&r1=1555917&r2=1555918&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/lateral/LateralCacheNoWaitFacade.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/lateral/LateralCacheNoWaitFacade.java Mon Jan 6 17:01:48 2014
@@ -293,12 +293,11 @@ public class LateralCacheNoWaitFacade<K
}
/**
- * Gets the set of keys of objects currently in the group.
+ * Return the keys in this cache.
* <p>
- * @param group
- * @return a Set of group keys.
+ * @see org.apache.commons.jcs.auxiliary.AuxiliaryCache#getKeySet()
*/
- public Set<K> getGroupKeys( String group )
+ public Set<K> getKeySet() throws IOException
{
HashSet<K> allKeys = new HashSet<K>();
for ( int i = 0; i < noWaits.length; i++ )
@@ -306,47 +305,10 @@ public class LateralCacheNoWaitFacade<K
AuxiliaryCache<K, V> aux = noWaits[i];
if ( aux != null )
{
- try
+ Set<K> keys = aux.getKeySet();
+ if(keys != null)
{
- Set<K> groupKeys = aux.getGroupKeys( group );
- if(groupKeys != null)
- {
- allKeys.addAll( groupKeys );
- }
- }
- catch ( IOException e )
- {
- // ignore
- }
- }
- }
- return allKeys;
- }
-
- /**
- * Gets the set of group names in the cache
- * <p>
- * @return a Set of group names.
- */
- public Set<String> getGroupNames()
- {
- HashSet<String> allKeys = new HashSet<String>();
- for ( int i = 0; i < noWaits.length; i++ )
- {
- AuxiliaryCache<K, V> aux = noWaits[i];
- if ( aux != null )
- {
- try
- {
- Set<String> groupNames = aux.getGroupNames();
- if(groupNames != null)
- {
- allKeys.addAll( groupNames );
- }
- }
- catch ( IOException e )
- {
- // ignore
+ allKeys.addAll( keys );
}
}
}
Modified: commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/lateral/LateralCommand.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/lateral/LateralCommand.java?rev=1555918&r1=1555917&r2=1555918&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/lateral/LateralCommand.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/lateral/LateralCommand.java Mon Jan 6 17:01:48 2014
@@ -42,9 +42,6 @@ public enum LateralCommand
/** Command to return an object. */
GET_MATCHING,
- /** Command to get all group keys */
- GET_GROUP_KEYS,
-
- /** Command to get all group keys */
- GET_GROUP_NAMES
+ /** Command to get all keys */
+ GET_KEYSET
}
Modified: commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPListener.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPListener.java?rev=1555918&r1=1555917&r2=1555918&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPListener.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPListener.java Mon Jan 6 17:01:48 2014
@@ -36,7 +36,6 @@ import java.util.concurrent.ThreadFactor
import org.apache.commons.jcs.access.exception.CacheException;
import org.apache.commons.jcs.auxiliary.lateral.LateralCacheInfo;
-import org.apache.commons.jcs.auxiliary.lateral.LateralCommand;
import org.apache.commons.jcs.auxiliary.lateral.LateralElementDescriptor;
import org.apache.commons.jcs.auxiliary.lateral.behavior.ILateralCacheListener;
import org.apache.commons.jcs.auxiliary.lateral.socket.tcp.behavior.ITCPLateralCacheAttributes;
@@ -337,28 +336,15 @@ public class LateralTCPListener<K extend
}
/**
- * Gets the cache that was injected by the lateral factory. Calls getGroupKeys on the cache.
+ * Gets the cache that was injected by the lateral factory. Calls getKeySet on the cache.
* <p>
* @param cacheName the name of the cache
- * @param group the group name
* @return a set of keys
* @throws IOException
*/
- public Set<K> handleGetGroupKeys( String cacheName, String group ) throws IOException
+ public Set<K> handleGetKeySet( String cacheName ) throws IOException
{
- return getCache( cacheName ).getGroupKeys(group, true);
- }
-
- /**
- * Gets the cache that was injected by the lateral factory. Calls getGroupNames on the cache.
- * <p>
- * @param cacheName the name of the cache
- * @return a set of group names
- * @throws IOException
- */
- public Set<String> handleGetGroupNames( String cacheName ) throws IOException
- {
- return getCache( cacheName ).getGroupNames(true);
+ return getCache( cacheName ).getKeySet(true);
}
/**
@@ -489,7 +475,7 @@ public class LateralTCPListener<K extend
public void run()
{
ServerSocket serverSocket = null;
-
+
try
{
log.info( "Listening on port " + port );
@@ -551,11 +537,11 @@ public class LateralTCPListener<K extend
{
if (serverSocket != null)
{
- try
+ try
{
serverSocket.close();
}
- catch (IOException e)
+ catch (IOException e)
{
log.error( "Exception caught closing socket", e );
}
@@ -665,78 +651,69 @@ public class LateralTCPListener<K extend
{
String cacheName = led.ce.getCacheName();
K key = led.ce.getKey();
+ Serializable obj = null;
- if ( led.command == LateralCommand.UPDATE )
+ switch (led.command)
{
- handlePut( led.ce );
- }
- else if ( led.command == LateralCommand.REMOVE )
- {
- // if a hashcode was given and filtering is on
- // check to see if they are the same
- // if so, then don't remove, otherwise issue a remove
- if ( led.valHashCode != -1 )
- {
- if ( getTcpLateralCacheAttributes().isFilterRemoveByHashCode() )
+ case UPDATE:
+ handlePut( led.ce );
+ break;
+
+ case REMOVE:
+ // if a hashcode was given and filtering is on
+ // check to see if they are the same
+ // if so, then don't remove, otherwise issue a remove
+ if ( led.valHashCode != -1 )
{
- ICacheElement<K, V> test = getCache( cacheName ).localGet( key );
- if ( test != null )
+ if ( getTcpLateralCacheAttributes().isFilterRemoveByHashCode() )
{
- if ( test.getVal().hashCode() == led.valHashCode )
+ ICacheElement<K, V> test = getCache( cacheName ).localGet( key );
+ if ( test != null )
{
- if ( log.isDebugEnabled() )
+ if ( test.getVal().hashCode() == led.valHashCode )
{
- log.debug( "Filtering detected identical hashCode [" + led.valHashCode
- + "], not issuing a remove for led " + led );
+ if ( log.isDebugEnabled() )
+ {
+ log.debug( "Filtering detected identical hashCode [" + led.valHashCode
+ + "], not issuing a remove for led " + led );
+ }
+ return;
}
- return;
- }
- else
- {
- if ( log.isDebugEnabled() )
+ else
{
- log.debug( "Different hashcodes, in cache [" + test.getVal().hashCode()
- + "] sent [" + led.valHashCode + "]" );
+ if ( log.isDebugEnabled() )
+ {
+ log.debug( "Different hashcodes, in cache [" + test.getVal().hashCode()
+ + "] sent [" + led.valHashCode + "]" );
+ }
}
}
}
}
- }
- handleRemove( cacheName, key );
- }
- else if ( led.command == LateralCommand.REMOVEALL )
- {
- handleRemoveAll( cacheName );
- }
- else if ( led.command == LateralCommand.GET )
- {
- Serializable obj = handleGet( cacheName, key );
+ handleRemove( cacheName, key );
+ break;
- ObjectOutputStream oos = new ObjectOutputStream( socket.getOutputStream() );
- oos.writeObject( obj );
- oos.flush();
- }
- else if ( led.command == LateralCommand.GET_MATCHING )
- {
- Map<K, ICacheElement<K, V>> obj = handleGetMatching( cacheName, (String) key );
+ case REMOVEALL:
+ handleRemoveAll( cacheName );
+ break;
- ObjectOutputStream oos = new ObjectOutputStream( socket.getOutputStream() );
- oos.writeObject( obj );
- oos.flush();
- }
- else if ( led.command == LateralCommand.GET_GROUP_KEYS )
- {
- String groupName = (String) key;
- Set<K> obj = handleGetGroupKeys(cacheName, groupName);
+ case GET:
+ obj = handleGet( cacheName, key );
+ break;
- ObjectOutputStream oos = new ObjectOutputStream( socket.getOutputStream() );
- oos.writeObject( obj );
- oos.flush();
+ case GET_MATCHING:
+ obj = (Serializable) handleGetMatching( cacheName, (String) key );
+ break;
+
+ case GET_KEYSET:
+ obj = (Serializable) handleGetKeySet(cacheName);
+ break;
+
+ default: break;
}
- else if ( led.command == LateralCommand.GET_GROUP_NAMES )
- {
- Set<String> obj = handleGetGroupNames(cacheName);
+ if (obj != null)
+ {
ObjectOutputStream oos = new ObjectOutputStream( socket.getOutputStream() );
oos.writeObject( obj );
oos.flush();
Modified: commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPService.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPService.java?rev=1555918&r1=1555917&r2=1555918&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPService.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/lateral/socket/tcp/LateralTCPService.java Mon Jan 6 17:01:48 2014
@@ -363,49 +363,22 @@ public class LateralTCPService<K extends
}
/**
- * Gets the set of keys of objects currently in the group
+ * Return the keys in this cache.
* <p>
- * @param cacheName
- * @param group
- * @return Set
+ * @param cacheName the name of the cache region
+ * @see org.apache.commons.jcs.auxiliary.AuxiliaryCache#getKeySet()
*/
@SuppressWarnings("unchecked") // Need cast from Object
- public Set<K> getGroupKeys( String cacheName, String group )
- throws IOException
- {
- CacheElement<String, String> ce = new CacheElement<String, String>(cacheName, group, null);
- LateralElementDescriptor<String, String> led = new LateralElementDescriptor<String, String>(ce);
- // led.requesterId = requesterId; // later
- led.command = LateralCommand.GET_GROUP_KEYS;
- Object response = sender.sendAndReceive(led);
- if (response != null)
- {
- return (Set<K>) response;
- }
-
- return null;
- }
-
- /**
- * Gets the set of groups currently in the cache throws
- * UnsupportedOperationException
- * <p>
- *
- * @param cacheName
- * @return Set
- */
- @SuppressWarnings("unchecked") // Need cast from Object
- public Set<String> getGroupNames(String cacheName)
- throws IOException
+ public Set<K> getKeySet(String cacheName) throws IOException
{
CacheElement<String, String> ce = new CacheElement<String, String>(cacheName, null, null);
LateralElementDescriptor<String, String> led = new LateralElementDescriptor<String, String>(ce);
// led.requesterId = requesterId; // later
- led.command = LateralCommand.GET_GROUP_NAMES;
+ led.command = LateralCommand.GET_KEYSET;
Object response = sender.sendAndReceive(led);
if (response != null)
{
- return (Set<String>) response;
+ return (Set<K>) response;
}
return null;
Modified: commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/AbstractRemoteAuxiliaryCache.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/AbstractRemoteAuxiliaryCache.java?rev=1555918&r1=1555917&r2=1555918&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/AbstractRemoteAuxiliaryCache.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/AbstractRemoteAuxiliaryCache.java Mon Jan 6 17:01:48 2014
@@ -446,30 +446,14 @@ public abstract class AbstractRemoteAuxi
}
/**
- * Returns all the keys for a group.
+ * Return the keys in this cache.
* <p>
- * @param groupName
- * @return Set
- * @throws java.rmi.RemoteException
- * @throws IOException
- */
- public Set<K> getGroupKeys( String groupName )
- throws java.rmi.RemoteException, IOException
- {
- return getRemoteCacheService().getGroupKeys( cacheName, groupName );
- }
-
- /**
- * Returns all the group names for a cache.
- * <p>
- * @return Set
- * @throws java.rmi.RemoteException
- * @throws IOException
+ * @see org.apache.commons.jcs.auxiliary.AuxiliaryCache#getKeySet()
*/
- public Set<String> getGroupNames()
+ public Set<K> getKeySet()
throws java.rmi.RemoteException, IOException
{
- return getRemoteCacheService().getGroupNames( cacheName );
+ return getRemoteCacheService().getKeySet(cacheName);
}
/**
Modified: commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/AbstractRemoteCacheNoWaitFacade.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/AbstractRemoteCacheNoWaitFacade.java?rev=1555918&r1=1555917&r2=1555918&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/AbstractRemoteCacheNoWaitFacade.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/AbstractRemoteCacheNoWaitFacade.java Mon Jan 6 17:01:48 2014
@@ -222,14 +222,11 @@ public abstract class AbstractRemoteCach
}
/**
- * Gets the set of keys of objects currently in the group.
+ * Return the keys in this cache.
* <p>
- * @param group
- * @return the set of keys of objects currently in the group
- * @throws IOException
+ * @see org.apache.commons.jcs.auxiliary.AuxiliaryCache#getKeySet()
*/
- public Set<K> getGroupKeys( String group )
- throws IOException
+ public Set<K> getKeySet() throws IOException
{
HashSet<K> allKeys = new HashSet<K>();
for ( int i = 0; i < noWaits.length; i++ )
@@ -237,10 +234,10 @@ public abstract class AbstractRemoteCach
AuxiliaryCache<K, V> aux = noWaits[i];
if ( aux != null )
{
- Set<K> groupKeys = aux.getGroupKeys( group );
- if(groupKeys != null)
+ Set<K> keys = aux.getKeySet();
+ if(keys != null)
{
- allKeys.addAll( groupKeys );
+ allKeys.addAll( keys );
}
}
}
@@ -248,32 +245,6 @@ public abstract class AbstractRemoteCach
}
/**
- * Gets the group names in the cache
- * <p>
- *
- * @return the set of group names
- * @throws IOException
- */
- public Set<String> getGroupNames() throws IOException
- {
- HashSet<String> names = new HashSet<String>();
- for (int i = 0; i < noWaits.length; i++)
- {
- AuxiliaryCache<K, V> aux = noWaits[i];
- if (aux != null)
- {
- Set<String> groupNames = aux.getGroupNames();
- if (groupNames != null)
- {
- names.addAll(groupNames);
- }
- }
- }
-
- return names;
- }
-
- /**
* Adds a remove request to the remote cache.
* <p>
* @param key
Modified: commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheNoWait.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheNoWait.java?rev=1555918&r1=1555917&r2=1555918&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheNoWait.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/RemoteCacheNoWait.java Mon Jan 6 17:01:48 2014
@@ -276,24 +276,13 @@ public class RemoteCacheNoWait<K extends
}
/**
- * @param groupName
- * @return the keys for the group name
- * @throws IOException
- */
- public Set<K> getGroupKeys( String groupName )
- throws IOException
- {
- return remoteCacheClient.getGroupKeys( groupName );
- }
-
- /**
- * @return the group names
- * @throws IOException
+ * Return the keys in this cache.
+ * <p>
+ * @see org.apache.commons.jcs.auxiliary.AuxiliaryCache#getKeySet()
*/
- public Set<String> getGroupNames()
- throws IOException
+ public Set<K> getKeySet() throws IOException
{
- return remoteCacheClient.getGroupNames( );
+ return remoteCacheClient.getKeySet();
}
/**
Modified: commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCacheClient.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCacheClient.java?rev=1555918&r1=1555917&r2=1555918&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCacheClient.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCacheClient.java Mon Jan 6 17:01:48 2014
@@ -374,15 +374,12 @@ public class RemoteHttpCacheClient<K ext
}
/**
- * Gets the set of keys of objects currently in the group.
+ * Return the keys in this cache.
* <p>
* @param cacheName the name of the cache
- * @param groupName the name of the group
- * @return a Set of group keys.
- * @throws IOException
+ * @see org.apache.commons.jcs.auxiliary.AuxiliaryCache#getKeySet()
*/
- public Set<K> getGroupKeys( String cacheName, String groupName )
- throws IOException
+ public Set<K> getKeySet( String cacheName ) throws IOException
{
if ( !isInitialized() )
{
@@ -392,7 +389,7 @@ public class RemoteHttpCacheClient<K ext
}
RemoteCacheRequest<String, String> remoteHttpCacheRequest =
- RemoteCacheRequestFactory.createGetGroupKeysRequest( cacheName, groupName, 0 );
+ RemoteCacheRequestFactory.createGetKeySetRequest(cacheName, 0 );
RemoteCacheResponse<Set<K>> remoteHttpCacheResponse = getRemoteDispatcher().dispatchRequest( remoteHttpCacheRequest );
@@ -405,36 +402,6 @@ public class RemoteHttpCacheClient<K ext
}
/**
- * Gets the set of group names in the cache
- * <p>
- * @return a Set of group names.
- * @throws IOException
- */
- public Set<String> getGroupNames( String cacheName )
- throws IOException
- {
- if ( !isInitialized() )
- {
- String message = "The Remote Http Client is not initialized. Cannot process request.";
- log.warn( message );
- throw new IOException( message );
- }
-
- RemoteCacheRequest<String, String> remoteHttpCacheRequest =
- RemoteCacheRequestFactory.createGetGroupNamesRequest( cacheName, 0 );
-
- RemoteCacheResponse<Set<String>> remoteHttpCacheResponse =
- getRemoteDispatcher().dispatchRequest( remoteHttpCacheRequest );
-
- if ( remoteHttpCacheResponse != null && remoteHttpCacheResponse.getPayload() != null )
- {
- return remoteHttpCacheResponse.getPayload();
- }
-
- return Collections.emptySet();
- }
-
- /**
* Make and alive request.
* <p>
* @return true if we make a successful alive request.
Modified: commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCacheDispatcher.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCacheDispatcher.java?rev=1555918&r1=1555917&r2=1555918&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCacheDispatcher.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCacheDispatcher.java Mon Jan 6 17:01:48 2014
@@ -167,10 +167,7 @@ public class RemoteHttpCacheDispatcher
case GET_MULTIPLE:
keyValue = remoteCacheRequest.getKeySet() + "";
break;
- case GET_GROUP_KEYS:
- keyValue = remoteCacheRequest.getKey() + "";
- break;
- case GET_GROUP_NAMES:
+ case GET_KEYSET:
keyValue = remoteCacheRequest.getKey() + "";
break;
case UPDATE:
Modified: commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/http/server/AbstractRemoteCacheService.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/http/server/AbstractRemoteCacheService.java?rev=1555918&r1=1555917&r2=1555918&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/http/server/AbstractRemoteCacheService.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/http/server/AbstractRemoteCacheService.java Mon Jan 6 17:01:48 2014
@@ -302,54 +302,26 @@ public abstract class AbstractRemoteCach
throws IOException;
/**
- * Gets the set of keys of objects currently in the group.
+ * Return the keys in this cache.
* <p>
- * @param cacheName
- * @param group
- * @return A Set of group keys
+ * @see org.apache.commons.jcs.auxiliary.AuxiliaryCache#getKeySet()
*/
- public Set<K> getGroupKeys( String cacheName, String group )
+ public Set<K> getKeySet( String cacheName )
{
- return processGetGroupKeys( cacheName, group );
+ return processGetKeySet( cacheName );
}
/**
- * Gets the set of keys of objects currently in the group.
+ * Gets the set of keys of objects currently in the cache.
* <p>
* @param cacheName
- * @param groupName
* @return Set
*/
- public Set<K> processGetGroupKeys( String cacheName, String groupName )
+ public Set<K> processGetKeySet( String cacheName )
{
CompositeCache<K, V> cache = getCacheManager().getCache( cacheName );
- return cache.getGroupKeys( groupName );
- }
-
- /**
- * Gets the set of group names currently in the cache.
- * <p>
- * @param cacheName
- * @param group
- * @return A Set of group names
- */
- public Set<String> getGroupNames( String cacheName )
- {
- return processGetGroupNames( cacheName );
- }
-
- /**
- * Gets the set of keys of objects currently in the group.
- * <p>
- * @param cacheName
- * @param groupName
- * @return Set
- */
- public Set<String> processGetGroupNames( String cacheName )
- {
- CompositeCache<?, ?> cache = getCacheManager().getCache( cacheName );
- return cache.getGroupNames();
+ return cache.getKeySet();
}
/**
Modified: commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/http/server/RemoteCacheServiceAdaptor.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/http/server/RemoteCacheServiceAdaptor.java?rev=1555918&r1=1555917&r2=1555918&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/http/server/RemoteCacheServiceAdaptor.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/http/server/RemoteCacheServiceAdaptor.java Mon Jan 6 17:01:48 2014
@@ -132,14 +132,9 @@ public class RemoteCacheServiceAdaptor<K
response.setSuccess( true );
// DO NOTHING
break;
- case GET_GROUP_KEYS:
- Set<K> groupKeys = getRemoteCacheService().getGroupKeys( request.getCacheName(),
- request.getKey() + "" );
- response.setPayload( groupKeys );
- break;
- case GET_GROUP_NAMES:
- Set<String> groupNames = getRemoteCacheService().getGroupNames( request.getCacheName() );
- response.setPayload( groupNames );
+ case GET_KEYSET:
+ Set<K> keys = getRemoteCacheService().getKeySet( request.getCacheName() );
+ response.setPayload( keys );
break;
default:
String message = "Unknown event type. Cannot process " + request;
Modified: commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheServer.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheServer.java?rev=1555918&r1=1555917&r2=1555918&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheServer.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/server/RemoteCacheServer.java Mon Jan 6 17:01:48 2014
@@ -821,25 +821,23 @@ public class RemoteCacheServer<K extends
}
/**
- * Gets the set of keys of objects currently in the group.
+ * Return the keys in the cache.
* <p>
- * @param cacheName
- * @param group
- * @return A Set of group keys
+ * @param cacheName the name of the cache region
+ * @see org.apache.commons.jcs.auxiliary.AuxiliaryCache#getKeySet()
*/
- public Set<K> getGroupKeys( String cacheName, String group )
+ public Set<K> getKeySet(String cacheName) throws IOException
{
- return processGetGroupKeys( cacheName, group );
+ return processGetKeySet( cacheName );
}
/**
- * Gets the set of keys of objects currently in the group.
+ * Gets the set of keys of objects currently in the cache.
* <p>
* @param cacheName
- * @param group
* @return Set
*/
- protected Set<K> processGetGroupKeys( String cacheName, String group )
+ protected Set<K> processGetKeySet( String cacheName )
{
CacheListeners<K, V> cacheDesc = null;
try
@@ -857,45 +855,7 @@ public class RemoteCacheServer<K extends
}
CompositeCache<K, V> c = (CompositeCache<K, V>) cacheDesc.cache;
- return c.getGroupKeys( group );
- }
-
- /**
- * Gets the set of group names currently in the cache.
- * <p>
- * @param cacheName the name of the region
- * @return A Set of group names
- */
- public Set<String> getGroupNames(String cacheName)
- {
- return processGetGroupNames(cacheName);
- }
-
- /**
- * Gets the set of group names currently in the cache.
- * <p>
- * @param cacheName the name of the region
- * @return A Set of group names
- */
- protected Set<String> processGetGroupNames(String cacheName)
- {
- CacheListeners<K, V> cacheDesc = null;
- try
- {
- cacheDesc = getCacheListeners(cacheName);
- }
- catch (Exception e)
- {
- log.error("Problem getting listeners.", e);
- }
-
- if (cacheDesc == null)
- {
- return Collections.emptySet();
- }
-
- CompositeCache<K, V> c = (CompositeCache<K, V>) cacheDesc.cache;
- return c.getGroupNames();
+ return c.getKeySet();
}
/**
Modified: commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/util/RemoteCacheRequestFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/util/RemoteCacheRequestFactory.java?rev=1555918&r1=1555917&r2=1555918&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/util/RemoteCacheRequestFactory.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/util/RemoteCacheRequestFactory.java Mon Jan 6 17:01:48 2014
@@ -115,20 +115,19 @@ public class RemoteCacheRequestFactory
}
/**
- * Creates a GetGroupKeys Request.
+ * Creates a GetKeySet Request.
* <p>
* @param cacheName
- * @param groupName
* @param requesterId
* @return RemoteHttpCacheRequest
*/
- public static RemoteCacheRequest<String, String> createGetGroupKeysRequest( String cacheName, String groupName, long requesterId )
+ public static RemoteCacheRequest<String, String> createGetKeySetRequest( String cacheName, long requesterId )
{
RemoteCacheRequest<String, String> request = new RemoteCacheRequest<String, String>();
request.setCacheName( cacheName );
- request.setKey( groupName );
+ request.setKey( cacheName );
request.setRequesterId( requesterId );
- request.setRequestType( RemoteRequestType.GET_GROUP_KEYS );
+ request.setRequestType( RemoteRequestType.GET_KEYSET );
if ( log.isDebugEnabled() )
{
@@ -139,29 +138,6 @@ public class RemoteCacheRequestFactory
}
/**
- * Creates a GetGroupNames Request.
- * <p>
- * @param cacheName
- * @param requesterId
- * @return RemoteHttpCacheRequest
- */
- public static RemoteCacheRequest<String, String> createGetGroupNamesRequest( String cacheName, int requesterId)
- {
- RemoteCacheRequest<String, String> request = new RemoteCacheRequest<String, String>();
- request.setCacheName( cacheName );
- request.setKey( cacheName );
- request.setRequesterId( requesterId );
- request.setRequestType( RemoteRequestType.GET_GROUP_NAMES );
-
- if ( log.isDebugEnabled() )
- {
- log.debug( "Created: " + request );
- }
-
- return request;
- }
-
- /**
* Creates a removeAll Request.
* <p>
* @param cacheName
Modified: commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/value/RemoteRequestType.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/value/RemoteRequestType.java?rev=1555918&r1=1555917&r2=1555918&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/value/RemoteRequestType.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/auxiliary/remote/value/RemoteRequestType.java Mon Jan 6 17:01:48 2014
@@ -27,12 +27,9 @@ public enum RemoteRequestType
/** Remove All request type. */
REMOVE_ALL,
- /** Get group keys request type. */
- GET_GROUP_KEYS,
+ /** Get keys request type. */
+ GET_KEYSET,
/** Dispose request type. */
DISPOSE,
-
- /** Get group keys request type. */
- GET_GROUP_NAMES
}
Modified: commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/ZombieCacheServiceNonLocal.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/ZombieCacheServiceNonLocal.java?rev=1555918&r1=1555917&r2=1555918&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/ZombieCacheServiceNonLocal.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/ZombieCacheServiceNonLocal.java Mon Jan 6 17:01:48 2014
@@ -179,21 +179,9 @@ public class ZombieCacheServiceNonLocal<
* Does nothing.
* <p>
* @param cacheName - region name
- * @param groupName - group name
* @return empty set
*/
- public Set<K> getGroupKeys( String cacheName, String groupName )
- {
- return Collections.emptySet();
- }
-
- /**
- * Does nothing.
- * <p>
- * @param cacheName - region name
- * @return empty set
- */
- public Set<String> getGroupNames( String cacheName )
+ public Set<K> getKeySet( String cacheName )
{
return Collections.emptySet();
}
Modified: commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/behavior/ICacheServiceNonLocal.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/behavior/ICacheServiceNonLocal.java?rev=1555918&r1=1555917&r2=1555918&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/behavior/ICacheServiceNonLocal.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/behavior/ICacheServiceNonLocal.java Mon Jan 6 17:01:48 2014
@@ -69,7 +69,7 @@ public interface ICacheServiceNonLocal<K
/**
* 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 sournce of the get.
+ * Adding the requestor id, allows the cache to determine the source of the get.
* <p>
* @param cacheName
* @param key
@@ -107,23 +107,13 @@ public interface ICacheServiceNonLocal<K
throws IOException;
/**
- * Gets the set of keys of objects currently in the group.
+ * Get a set of the keys for all elements in the cache.
* <p>
* @param cacheName the name of the cache
- * @param groupName the name of the group
- * @return a Set of group keys.
- * @throws IOException
+ * @return a set of the key type
+ * @TODO This should probably be done in chunks with a range passed in. This
+ * will be a problem if someone puts a 1,000,000 or so items in a
+ * region.
*/
- Set<K> getGroupKeys( String cacheName, String groupName )
- throws IOException;
-
- /**
- * Gets the set of group names in the cache
- * <p>
- * @param cacheName the name of the cache
- * @return a Set of group names.
- * @throws IOException
- */
- Set<String> getGroupNames( String cacheName )
- throws IOException;
+ Set<K> getKeySet( String cacheName ) throws IOException;
}
Modified: commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/control/CompositeCache.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/control/CompositeCache.java?rev=1555918&r1=1555917&r2=1555918&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/control/CompositeCache.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/control/CompositeCache.java Mon Jan 6 17:01:48 2014
@@ -36,8 +36,8 @@ import org.apache.commons.jcs.engine.Cac
import org.apache.commons.jcs.engine.behavior.ICache;
import org.apache.commons.jcs.engine.behavior.ICacheElement;
import org.apache.commons.jcs.engine.behavior.ICompositeCacheAttributes;
-import org.apache.commons.jcs.engine.behavior.IElementAttributes;
import org.apache.commons.jcs.engine.behavior.ICompositeCacheAttributes.DiskUsagePattern;
+import org.apache.commons.jcs.engine.behavior.IElementAttributes;
import org.apache.commons.jcs.engine.control.event.ElementEvent;
import org.apache.commons.jcs.engine.control.event.ElementEventQueue;
import org.apache.commons.jcs.engine.control.event.behavior.ElementEventType;
@@ -1104,67 +1104,27 @@ public class CompositeCache<K extends Se
}
/**
- * Gets the set of keys of objects currently in the group.
+ * Get a set of the keys for all elements in the cache
* <p>
- * @param group the name of the group
- * @return A Set of keys, or null.
+ * @return A set of the key type
*/
- public Set<K> getGroupKeys( String group )
+ public Set<K> getKeySet()
{
- return getGroupKeys(group, false);
+ return getKeySet(false);
}
/**
- * Gets the set of keys of objects currently in the group.
+ * Get a set of the keys for all elements in the cache
* <p>
- * @param group the name of the group
- * @return A Set of keys, or null.
+ * @param localOnly true if only memory keys are requested
+ *
+ * @return A set of the key type
*/
- public Set<K> getGroupKeys( String group, boolean localOnly )
+ public Set<K> getKeySet(boolean localOnly)
{
HashSet<K> allKeys = new HashSet<K>();
- allKeys.addAll( memCache.getGroupKeys( group ) );
- for ( int i = 0; i < auxCaches.length; i++ )
- {
- AuxiliaryCache<K, V> aux = auxCaches[i];
- if ( aux != null )
- {
- if(!localOnly || aux.getCacheType() == CacheType.DISK_CACHE)
- {
- try
- {
- allKeys.addAll( aux.getGroupKeys( group ) );
- }
- catch ( IOException e )
- {
- // ignore
- }
- }
- }
- }
- return allKeys;
- }
-
- /**
- * Gets the set of group names in the cache
- * <p>
- * @return a Set of group names.
- */
- public Set<String> getGroupNames()
- {
- return getGroupNames( false );
- }
- /**
- * Gets the set of group names in the cache
- * <p>
- * @param localOnly whether to get the group names only from local caches or not
- * @return a Set of group names.
- */
- public Set<String> getGroupNames(boolean localOnly)
- {
- HashSet<String> allKeys = new HashSet<String>();
- allKeys.addAll( memCache.getGroupNames() );
+ allKeys.addAll( memCache.getKeySet() );
for ( int i = 0; i < auxCaches.length; i++ )
{
AuxiliaryCache<K, V> aux = auxCaches[i];
@@ -1174,11 +1134,7 @@ public class CompositeCache<K extends Se
{
try
{
- Set<String> groupNames = aux.getGroupNames();
- if(groupNames != null)
- {
- allKeys.addAll( groupNames );
- }
+ allKeys.addAll( aux.getKeySet() );
}
catch ( IOException e )
{
@@ -1607,7 +1563,7 @@ public class CompositeCache<K extends Se
}
/**
- * Gets the default element attribute of the Cache object This returna a copy. It does not
+ * Gets the default element attribute of the Cache object This returns a copy. It does not
* return a reference to the attributes.
* <p>
* @return The attributes value
Modified: commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/memory/AbstractMemoryCache.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/memory/AbstractMemoryCache.java?rev=1555918&r1=1555917&r2=1555918&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/memory/AbstractMemoryCache.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/memory/AbstractMemoryCache.java Mon Jan 6 17:01:48 2014
@@ -22,7 +22,6 @@ package org.apache.commons.jcs.engine.me
import java.io.IOException;
import java.io.Serializable;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
@@ -35,8 +34,6 @@ import org.apache.commons.jcs.engine.beh
import org.apache.commons.jcs.engine.behavior.IElementAttributes;
import org.apache.commons.jcs.engine.behavior.IRequireScheduler;
import org.apache.commons.jcs.engine.control.CompositeCache;
-import org.apache.commons.jcs.engine.control.group.GroupAttrName;
-import org.apache.commons.jcs.engine.control.group.GroupId;
import org.apache.commons.jcs.engine.memory.behavior.IMemoryCache;
import org.apache.commons.jcs.engine.memory.shrinking.ShrinkerThread;
import org.apache.commons.jcs.engine.memory.util.MemoryElementDescriptor;
@@ -344,50 +341,4 @@ public abstract class AbstractMemoryCach
{
return this.cache;
}
-
- /**
- * @param groupName
- * @return group keys
- */
- public Set<K> getGroupKeys( String groupName )
- {
- GroupId groupId = new GroupId( getCacheName(), groupName );
- HashSet<K> keys = new HashSet<K>();
- synchronized ( map )
- {
- for (Map.Entry<K, MemoryElementDescriptor<K, V>> entry : map.entrySet())
- {
- K k = entry.getKey();
-
- if ( k instanceof GroupAttrName && ( (GroupAttrName<K>) k ).groupId.equals( groupId ) )
- {
- keys.add(( (GroupAttrName<K>) k ).attrName );
- }
- }
- }
- return keys;
- }
-
- /**
- * Gets the set of group names in the cache
- * <p>
- * @return a Set of group names.
- */
- public Set<String> getGroupNames()
- {
- HashSet<String> names = new HashSet<String>();
- synchronized ( map )
- {
- for (Map.Entry<K, MemoryElementDescriptor<K, V>> entry : map.entrySet())
- {
- K k = entry.getKey();
-
- if ( k instanceof GroupAttrName )
- {
- names.add(( (GroupAttrName<K>) k ).groupId.groupName );
- }
- }
- }
- return names;
- }
}
Modified: commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/memory/behavior/IMemoryCache.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/memory/behavior/IMemoryCache.java?rev=1555918&r1=1555917&r2=1555918&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/memory/behavior/IMemoryCache.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/engine/memory/behavior/IMemoryCache.java Mon Jan 6 17:01:48 2014
@@ -196,19 +196,4 @@ public interface IMemoryCache<K extends
* @return The cache value
*/
CompositeCache<K, V> getCompositeCache();
-
- /**
- * Gets the set of keys of objects currently in the group.
- * <p>
- * @param group
- * @return a Set of group keys.
- */
- Set<K> getGroupKeys( String group );
-
- /**
- * Gets the set of group names in the cache
- * <p>
- * @return a Set of group names.
- */
- Set<String> getGroupNames();
}
Modified: commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/utils/access/JCSWorker.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/utils/access/JCSWorker.java?rev=1555918&r1=1555917&r2=1555918&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/utils/access/JCSWorker.java (original)
+++ commons/proper/jcs/trunk/src/java/org/apache/commons/jcs/utils/access/JCSWorker.java Mon Jan 6 17:01:48 2014
@@ -24,6 +24,8 @@ import java.util.HashMap;
import java.util.Map;
import org.apache.commons.jcs.JCS;
+import org.apache.commons.jcs.access.CacheAccess;
+import org.apache.commons.jcs.access.GroupCacheAccess;
import org.apache.commons.jcs.access.exception.CacheException;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -96,7 +98,10 @@ public class JCSWorker<K extends Seriali
private static final Log logger = LogFactory.getLog( JCSWorker.class );
/** The cache we are working with */
- private JCS<K, V> cache;
+ private CacheAccess<K, V> cache;
+
+ /** The cache we are working with */
+ private GroupCacheAccess<K, V> groupCache;
/**
* Map to hold who's doing work presently.
@@ -119,6 +124,7 @@ public class JCSWorker<K extends Seriali
try
{
cache = JCS.getInstance( aRegion );
+ groupCache = JCS.getGroupCacheInstance( aRegion );
}
catch ( CacheException e )
{
@@ -246,7 +252,7 @@ public class JCSWorker<K extends Seriali
// Try to get the item from the cache
if ( aGroup != null )
{
- result = cache.getFromGroup( aKey, aGroup );
+ result = groupCache.getFromGroup( aKey, aGroup );
}
else
{
@@ -265,7 +271,7 @@ public class JCSWorker<K extends Seriali
// Stick the result of the work in the cache.
if ( aGroup != null )
{
- cache.putInGroup( aKey, aGroup, result );
+ groupCache.putInGroup( aKey, aGroup, result );
}
else
{
Modified: commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/ConcurrentRemovalLoadTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/ConcurrentRemovalLoadTest.java?rev=1555918&r1=1555917&r2=1555918&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/ConcurrentRemovalLoadTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/ConcurrentRemovalLoadTest.java Mon Jan 6 17:01:48 2014
@@ -19,8 +19,6 @@ package org.apache.commons.jcs;
* under the License.
*/
-import org.apache.commons.jcs.JCS;
-
import junit.extensions.ActiveTestSuite;
import junit.framework.Test;
import junit.framework.TestCase;
Modified: commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/JCSCacheElementRetrievalUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/JCSCacheElementRetrievalUnitTest.java?rev=1555918&r1=1555917&r2=1555918&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/JCSCacheElementRetrievalUnitTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/JCSCacheElementRetrievalUnitTest.java Mon Jan 6 17:01:48 2014
@@ -21,7 +21,7 @@ package org.apache.commons.jcs;
import junit.framework.TestCase;
-import org.apache.commons.jcs.JCS;
+import org.apache.commons.jcs.access.CacheAccess;
import org.apache.commons.jcs.engine.behavior.ICacheElement;
/**
@@ -39,7 +39,7 @@ public class JCSCacheElementRetrievalUni
public void testSimpleElementRetrieval()
throws Exception
{
- JCS<String, String> jcs = JCS.getInstance( "testCache1" );
+ CacheAccess<String, String> jcs = JCS.getInstance( "testCache1" );
jcs.put( "test_key", "test_data" );
Modified: commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/JCSConcurrentCacheAccessUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/JCSConcurrentCacheAccessUnitTest.java?rev=1555918&r1=1555917&r2=1555918&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/JCSConcurrentCacheAccessUnitTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/JCSConcurrentCacheAccessUnitTest.java Mon Jan 6 17:01:48 2014
@@ -24,6 +24,7 @@ import java.util.concurrent.atomic.Atomi
import junit.framework.Assert;
import junit.framework.TestCase;
+import org.apache.commons.jcs.access.GroupCacheAccess;
import org.apache.commons.jcs.access.exception.CacheException;
/**
@@ -38,7 +39,7 @@ public class JCSConcurrentCacheAccessUni
/**
* the cache instance
*/
- protected JCS<Integer, String> cache;
+ protected GroupCacheAccess<Integer, String> cache;
/**
* the group name
@@ -55,7 +56,7 @@ public class JCSConcurrentCacheAccessUni
{
super.setUp();
JCS.setConfigFilename( "/TestJCS-73.ccf" );
- cache = JCS.getInstance( "cache" );
+ cache = JCS.getGroupCacheInstance( "cache" );
errcount = new AtomicInteger(0);
}
@@ -71,7 +72,7 @@ public class JCSConcurrentCacheAccessUni
/**
* Worker thread
*/
- private class Worker extends Thread
+ protected class Worker extends Thread
{
@Override
public void run()
Modified: commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/JCSLightLoadUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/JCSLightLoadUnitTest.java?rev=1555918&r1=1555917&r2=1555918&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/JCSLightLoadUnitTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/JCSLightLoadUnitTest.java Mon Jan 6 17:01:48 2014
@@ -19,12 +19,12 @@ package org.apache.commons.jcs;
* under the License.
*/
-import org.apache.commons.jcs.JCS;
-
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
+import org.apache.commons.jcs.access.CacheAccess;
+
/**
* Runs a few thousand queries.
*/
@@ -80,7 +80,7 @@ public class JCSLightLoadUnitTest
public void testSimpleLoad()
throws Exception
{
- JCS<String, String> jcs = JCS.getInstance( "testCache1" );
+ CacheAccess<String, String> jcs = JCS.getInstance( "testCache1" );
// ICompositeCacheAttributes cattr = jcs.getCacheAttributes();
// cattr.setMaxObjects( 20002 );
// jcs.setCacheAttributes( cattr );
Modified: commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/JCSRemovalSimpleConcurrentTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/JCSRemovalSimpleConcurrentTest.java?rev=1555918&r1=1555917&r2=1555918&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/JCSRemovalSimpleConcurrentTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/JCSRemovalSimpleConcurrentTest.java Mon Jan 6 17:01:48 2014
@@ -19,10 +19,10 @@ package org.apache.commons.jcs;
* under the License.
*/
-import org.apache.commons.jcs.JCS;
-
import junit.framework.TestCase;
+import org.apache.commons.jcs.access.CacheAccess;
+
/**
* Verify that basic removal functionality works.
*/
@@ -73,7 +73,7 @@ public class JCSRemovalSimpleConcurrentT
System.out.println( "testTwoDeepRemoval" );
int count = 500;
- JCS<String, String> jcs = JCS.getInstance( "testCache1" );
+ CacheAccess<String, String> jcs = JCS.getInstance( "testCache1" );
for ( int i = 0; i <= count; i++ )
{
@@ -111,7 +111,7 @@ public class JCSRemovalSimpleConcurrentT
System.out.println( "testSingleDepthRemoval" );
int count = 500;
- JCS<String, String> jcs = JCS.getInstance( "testCache1" );
+ CacheAccess<String, String> jcs = JCS.getInstance( "testCache1" );
for ( int i = 0; i <= count; i++ )
{
@@ -149,7 +149,7 @@ public class JCSRemovalSimpleConcurrentT
System.out.println( "testRemoveAll" );
int count = 500;
- JCS<String, String> jcs = JCS.getInstance( "testCache1" );
+ CacheAccess<String, String> jcs = JCS.getInstance( "testCache1" );
for ( int i = 0; i <= count; i++ )
{
@@ -192,7 +192,7 @@ public class JCSRemovalSimpleConcurrentT
System.out.println( "testRemoveAll" );
int count = 500;
- JCS<String, String> jcs = JCS.getInstance( "testCache1" );
+ CacheAccess<String, String> jcs = JCS.getInstance( "testCache1" );
jcs.clear();
Modified: commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/JCSThrashTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/JCSThrashTest.java?rev=1555918&r1=1555917&r2=1555918&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/JCSThrashTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/JCSThrashTest.java Mon Jan 6 17:01:48 2014
@@ -25,7 +25,7 @@ import java.util.List;
import junit.framework.TestCase;
-import org.apache.commons.jcs.JCS;
+import org.apache.commons.jcs.access.CacheAccess;
import org.apache.commons.jcs.engine.stats.behavior.IStatElement;
import org.apache.commons.jcs.engine.stats.behavior.IStats;
import org.apache.commons.logging.Log;
@@ -45,7 +45,7 @@ public class JCSThrashTest
/**
* the cache instance
*/
- protected JCS<String, Serializable> jcs;
+ protected CacheAccess<String, Serializable> jcs;
/**
* @param args
Modified: commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/JCSUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/JCSUnitTest.java?rev=1555918&r1=1555917&r2=1555918&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/JCSUnitTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/JCSUnitTest.java Mon Jan 6 17:01:48 2014
@@ -23,12 +23,12 @@ import java.util.HashMap;
import java.util.LinkedList;
import java.util.Random;
-import org.apache.commons.jcs.JCS;
-
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
+import org.apache.commons.jcs.access.CacheAccess;
+
/**
* Simple test for the JCS class.
*/
@@ -69,7 +69,7 @@ public class JCSUnitTest
public void testJCS()
throws Exception
{
- JCS<String, LinkedList<HashMap<String, String>>> jcs = JCS.getInstance( "testCache1" );
+ CacheAccess<String, LinkedList<HashMap<String, String>>> jcs = JCS.getInstance( "testCache1" );
LinkedList<HashMap<String, String>> list = buildList();
Modified: commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/JCSvsHashtablePerformanceTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/JCSvsHashtablePerformanceTest.java?rev=1555918&r1=1555917&r2=1555918&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/JCSvsHashtablePerformanceTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/JCSvsHashtablePerformanceTest.java Mon Jan 6 17:01:48 2014
@@ -25,7 +25,7 @@ import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
-import org.apache.commons.jcs.JCS;
+import org.apache.commons.jcs.access.CacheAccess;
import org.apache.commons.jcs.engine.memory.lru.LRUMemoryCache;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -115,7 +115,7 @@ public class JCSvsHashtablePerformanceTe
{
JCS.setConfigFilename( "/TestJCSvHashtablePerf.ccf" );
- JCS<String, String> cache = JCS.getInstance( "testCache1" );
+ CacheAccess<String, String> cache = JCS.getInstance( "testCache1" );
for ( int j = 0; j < loops; j++ )
{
Modified: commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/RemovalTestUtil.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/RemovalTestUtil.java?rev=1555918&r1=1555917&r2=1555918&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/RemovalTestUtil.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/RemovalTestUtil.java Mon Jan 6 17:01:48 2014
@@ -19,10 +19,10 @@ package org.apache.commons.jcs;
* under the License.
*/
-import org.apache.commons.jcs.JCS;
-
import junit.framework.TestCase;
+import org.apache.commons.jcs.access.CacheAccess;
+
/**
* Simple methods to be run by active test suites that test removal.
*
@@ -55,7 +55,7 @@ public class RemovalTestUtil
public void runTestPutThenRemoveCategorical( int start, int end )
throws Exception
{
- JCS<String, String> jcs = JCS.getInstance( "testCache1" );
+ CacheAccess<String, String> jcs = JCS.getInstance( "testCache1" );
for ( int i = start; i <= end; i++ )
{
@@ -93,7 +93,7 @@ public class RemovalTestUtil
public void runPutInRange( int start, int end )
throws Exception
{
- JCS<String, String> jcs = JCS.getInstance( "testCache1" );
+ CacheAccess<String, String> jcs = JCS.getInstance( "testCache1" );
for ( int i = start; i <= end; i++ )
{
@@ -121,7 +121,7 @@ public class RemovalTestUtil
public void runGetInRange( int start, int end, boolean check )
throws Exception
{
- JCS<String, String> jcs = JCS.getInstance( "testCache1" );
+ CacheAccess<String, String> jcs = JCS.getInstance( "testCache1" );
// don't care if they are found
for ( int i = end; i >= start; i-- )
Modified: commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/TestTCPLateralCache.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/TestTCPLateralCache.java?rev=1555918&r1=1555917&r2=1555918&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/TestTCPLateralCache.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/TestTCPLateralCache.java Mon Jan 6 17:01:48 2014
@@ -19,12 +19,12 @@ package org.apache.commons.jcs;
* under the License.
*/
-import org.apache.commons.jcs.JCS;
-
import junit.extensions.ActiveTestSuite;
import junit.framework.Test;
import junit.framework.TestCase;
+import org.apache.commons.jcs.access.CacheAccess;
+
/**
* Test which exercises the indexed disk cache. This one uses three different
* regions for thre threads.
@@ -121,7 +121,7 @@ public class TestTCPLateralCache
public void runTestForRegion( String region )
throws Exception
{
- JCS<String, String> jcs = JCS.getInstance( region );
+ CacheAccess<String, String> jcs = JCS.getInstance( region );
// Add items to cache
Modified: commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/ZeroSizeCacheUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/ZeroSizeCacheUnitTest.java?rev=1555918&r1=1555917&r2=1555918&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/ZeroSizeCacheUnitTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/ZeroSizeCacheUnitTest.java Mon Jan 6 17:01:48 2014
@@ -19,10 +19,10 @@ package org.apache.commons.jcs;
* under the License.
*/
-import org.apache.commons.jcs.JCS;
-
import junit.framework.TestCase;
+import org.apache.commons.jcs.access.CacheAccess;
+
/**
*
* @author Aaron Smuts
@@ -56,7 +56,7 @@ public class ZeroSizeCacheUnitTest
public void testPutGetRemove()
throws Exception
{
- JCS<String, String> jcs = JCS.getInstance( "testCache1" );
+ CacheAccess<String, String> jcs = JCS.getInstance( "testCache1" );
for ( int i = 0; i <= items; i++ )
{
Modified: commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/access/CacheAccessUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/access/CacheAccessUnitTest.java?rev=1555918&r1=1555917&r2=1555918&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/access/CacheAccessUnitTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/access/CacheAccessUnitTest.java Mon Jan 6 17:01:48 2014
@@ -26,7 +26,7 @@ import java.util.Set;
import junit.framework.TestCase;
-import org.apache.commons.jcs.access.CacheAccess;
+import org.apache.commons.jcs.JCS;
import org.apache.commons.jcs.access.exception.CacheException;
import org.apache.commons.jcs.access.exception.ObjectExistsException;
import org.apache.commons.jcs.engine.CompositeCacheAttributes;
@@ -50,7 +50,7 @@ public class CacheAccessUnitTest
public void testPutSafe()
throws Exception
{
- CacheAccess<String, String> access = CacheAccess.getAccess( "test" );
+ CacheAccess<String, String> access = JCS.getInstance( "test" );
assertNotNull( "We should have an access class", access );
String key = "mykey";
@@ -83,7 +83,7 @@ public class CacheAccessUnitTest
public void testPutNullKey()
throws Exception
{
- CacheAccess<String, String> access = CacheAccess.getAccess( "test" );
+ CacheAccess<String, String> access = JCS.getInstance( "test" );
assertNotNull( "We should have an access class", access );
String key = null;
@@ -107,7 +107,7 @@ public class CacheAccessUnitTest
public void testPutNullValue()
throws Exception
{
- CacheAccess<String, String> access = CacheAccess.getAccess( "test" );
+ CacheAccess<String, String> access = JCS.getInstance( "test" );
assertNotNull( "We should have an access class", access );
String key = "myKey";
@@ -131,7 +131,7 @@ public class CacheAccessUnitTest
public void testSetDefaultElementAttributes()
throws Exception
{
- CacheAccess<String, String> access = CacheAccess.getAccess( "test" );
+ CacheAccess<String, String> access = JCS.getInstance( "test" );
assertNotNull( "We should have an access class", access );
long maxLife = 9876;
@@ -162,7 +162,7 @@ public class CacheAccessUnitTest
throws Exception
{
//SETUP
- CacheAccess<String, String> access = CacheAccess.getAccess( "test" );
+ CacheAccess<String, String> access = JCS.getInstance( "test" );
assertNotNull( "We should have an access class", access );
String keyOne = "mykeyone";
@@ -200,7 +200,7 @@ public class CacheAccessUnitTest
public void testRegionDefiniton()
throws Exception
{
- CacheAccess<String, String> access = CacheAccess.defineRegion( "test" );
+ CacheAccess<String, String> access = JCS.defineRegion( "test" );
assertNotNull( "We should have an access class", access );
}
@@ -216,7 +216,7 @@ public class CacheAccessUnitTest
long maxIdleTime = 8765;
ca.setMaxMemoryIdleTimeSeconds( maxIdleTime );
- CacheAccess<String, String> access = CacheAccess.defineRegion( "testRegionDefinitonWithAttributes", ca );
+ CacheAccess<String, String> access = JCS.defineRegion( "testRegionDefinitonWithAttributes", ca );
assertNotNull( "We should have an access class", access );
ICompositeCacheAttributes ca2 = access.getCacheAttributes();
@@ -240,7 +240,7 @@ public class CacheAccessUnitTest
IElementAttributes attr = new ElementAttributes();
attr.setMaxLifeSeconds( maxLife );
- CacheAccess<String, String> access = CacheAccess.defineRegion( "testRegionDefinitonWithAttributes", ca, attr );
+ CacheAccess<String, String> access = JCS.defineRegion( "testRegionDefinitonWithAttributes", ca, attr );
assertNotNull( "We should have an access class", access );
ICompositeCacheAttributes ca2 = access.getCacheAttributes();
@@ -268,7 +268,7 @@ public class CacheAccessUnitTest
IElementAttributes attr = new ElementAttributes();
attr.setMaxLifeSeconds( maxLife );
- CacheAccess<String, Integer> access = CacheAccess.defineRegion( "testGetMatching_Normal", cattr, attr );
+ CacheAccess<String, Integer> access = JCS.defineRegion( "testGetMatching_Normal", cattr, attr );
// DO WORK
int numToInsertPrefix1 = 10;
@@ -325,7 +325,7 @@ public class CacheAccessUnitTest
IElementAttributes attr = new ElementAttributes();
attr.setMaxLifeSeconds( maxLife );
- CacheAccess<String, Integer> access = CacheAccess.defineRegion( "testGetMatching_Normal", cattr, attr );
+ CacheAccess<String, Integer> access = JCS.defineRegion( "testGetMatching_Normal", cattr, attr );
// DO WORK
int numToInsertPrefix1 = 10;
Modified: commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/access/SystemPropertyUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/access/SystemPropertyUnitTest.java?rev=1555918&r1=1555917&r2=1555918&view=diff
==============================================================================
--- commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/access/SystemPropertyUnitTest.java (original)
+++ commons/proper/jcs/trunk/src/test/org/apache/commons/jcs/access/SystemPropertyUnitTest.java Mon Jan 6 17:01:48 2014
@@ -50,7 +50,7 @@ public class SystemPropertyUnitTest
JCS.setConfigFilename( "/TestSystemProperties.ccf" );
- JCS<String, String> cache = JCS.getInstance( "test1" );
+ CacheAccess<String, String> cache = JCS.getInstance( "test1" );
assertEquals( "We should have used the system property for the memory size", maxMemory, cache
.getCacheAttributes().getMaxObjects() );
@@ -72,7 +72,7 @@ public class SystemPropertyUnitTest
CompositeCacheManager mgr = CompositeCacheManager.getUnconfiguredInstance();
mgr.configure( "/TestSystemProperties.ccf" );
- JCS<String, String> cache = JCS.getInstance( "missing" );
+ CacheAccess<String, String> cache = JCS.getInstance( "missing" );
// TODO check against the actual default def
assertEquals( "We should have used the default property for the memory size", 100, cache.getCacheAttributes()
.getMaxObjects() );