/** * Mark the name cache as initialized. The use count is no longer tracked * and the transient map used for initializing the cache is discarded to * save heap space. */ void initialized() { LOG.info("initialized with " + size() + " entries " + lookups + " lookups"); this.initialized = true; transientMap.clear(); transientMap = null; }
/** * Mark the name cache as initialized. The use count is no longer tracked * and the transient map used for initializing the cache is discarded to * save heap space. */ void initialized() { LOG.info("initialized with " + size() + " entries " + lookups + " lookups"); this.initialized = true; transientMap.clear(); transientMap = null; }
/** * Mark the name cache as initialized. The use count is no longer tracked * and the transient map used for initializing the cache is discarded to * save heap space. */ void initialized() { LOG.info("initialized with " + size() + " entries " + lookups + " lookups"); this.initialized = true; transientMap.clear(); transientMap = null; }
/** * Mark the name cache as initialized. The use count is no longer tracked * and the transient map used for initializing the cache is discarded to * save heap space. */ void initialized() { LOG.info("initialized with " + size() + " entries " + lookups + " lookups"); this.initialized = true; transientMap.clear(); transientMap = null; }
@Test public void testDictionary() throws Exception { // Create dictionary with useThreshold 2 NameCache<String> cache = new NameCache<String>(2); String[] matching = {"part1", "part10000000", "fileabc", "abc", "filepart"}; String[] notMatching = {"spart1", "apart", "abcd", "def"}; for (String s : matching) { // Add useThreshold times so the names are promoted to dictionary cache.put(s); assertTrue(s == cache.put(s)); } for (String s : notMatching) { // Add < useThreshold times so the names are not promoted to dictionary cache.put(s); } // Mark dictionary as initialized cache.initialized(); for (String s : matching) { verifyNameReuse(cache, s, true); } // Check dictionary size assertEquals(matching.length, cache.size()); for (String s : notMatching) { verifyNameReuse(cache, s, false); } }
assertEquals(matching.length, cache.size());