/** * For post reflection creation initialization * <p> * @param hub */ @Override public void initialize( CompositeCache<K, V> hub ) { hitCnt = new AtomicLong(0); missCnt = new AtomicLong(0); putCnt = new AtomicLong(0); this.cacheAttributes = hub.getCacheAttributes(); this.chunkSize = cacheAttributes.getSpoolChunkSize(); this.cache = hub; this.map = createMap(); this.status = CacheStatus.ALIVE; }
/** * For post reflection creation initialization * <p> * @param hub */ @Override public void initialize( CompositeCache<K, V> hub ) { lock.lock(); try { this.cacheName = hub.getCacheName(); this.cacheAttributes = hub.getCacheAttributes(); this.cache = hub; map = createMap(); chunkSize = cacheAttributes.getSpoolChunkSize(); status = CacheStatus.ALIVE; } finally { lock.unlock(); } }
/** * Verify that we can parse the spool chunk size */ public void testParseSpoolChunkSize_Normal() { // SETUP String regionName = "MyRegion"; int chunkSize = 5; Properties props = new Properties(); props.put( "jcs.default", "" ); props.put( "jcs.default.cacheattributes.SpoolChunkSize", String.valueOf( chunkSize ) ); CompositeCacheManager manager = CompositeCacheManager.getUnconfiguredInstance(); // DO WORK manager.configure( props ); // VERIFY CompositeCache<String, String> cache = manager.getCache( regionName ); assertEquals( "Wrong chunkSize", cache.getCacheAttributes().getSpoolChunkSize(), chunkSize ); } }
/** * Verify that we can parse the spool chunk size */ public void testParseSpoolChunkSize_Normal() { // SETUP String regionName = "MyRegion"; int chunkSize = 5; Properties props = new Properties(); props.put( "jcs.default", "" ); props.put( "jcs.default.cacheattributes.SpoolChunkSize", String.valueOf( chunkSize ) ); CompositeCacheManager manager = CompositeCacheManager.getUnconfiguredInstance(); // DO WORK manager.configure( props ); // VERIFY CompositeCache<String, String> cache = manager.getCache( regionName ); assertEquals( "Wrong chunkSize", cache.getCacheAttributes().getSpoolChunkSize(), chunkSize ); } }