watch = ( ICacheObserver ) obj;
p( "subscribing to the server" );
watch.addCacheListener( "testCache", this );
ICacheElement cb = new CacheElement( "testCache", "testKey", "testVal" );
for ( int i = 0; i < count; i++ )
{
cb = new CacheElement( "testCache", "" + i, "" + i );
if ( delete )
{
p( "deleting a cache item from the server " + i );
cache.remove( cb.getCacheName(), cb.getKey() );
}
if ( write )
{
p( "putting a cache bean to the server " + i );
try
{
cache.update( cb );
}
catch ( ObjectExistsException oee )
{
p( oee.toString() );
}
}
if ( read )
{
try
{
Object val = cache.get( cb.getCacheName(), cb.getKey() );
p( "get " + cb.getKey() + " returns " + val );
}
catch ( ObjectNotFoundException onfe )
{
}
}