void markNameCacheInitialized() { writeLock(); try { nameCache.initialized(); } finally { writeUnlock(); } }
void markNameCacheInitialized() { writeLock(); try { nameCache.initialized(); } finally { writeUnlock(); } }
void markNameCacheInitialized() { writeLock(); try { nameCache.initialized(); } finally { writeUnlock(); } }
try { this.ready = true; this.nameCache.initialized(); cond.signalAll(); } finally {
@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); } }
cache.initialized(); cache.initialized();