private static int detectVersion() { Log log = LogFactory.getLog(LuceneVersionDetector.class, Log.class); int version = 3; try { Class.forName("org.apache.lucene.store.IOContext", true, LuceneVersionDetector.class.getClassLoader()); version = 4; } catch (ClassNotFoundException e) { } log.detectedLuceneVersion(version); return version; }
@Override public void before(InvocationContext context, VisitableCommand command, Cache cache) { try { cache.getAdvancedCache().getComponentRegistry().getStateTransferLock().waitForTopology(currentTopology + 2, 10, TimeUnit.SECONDS); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } catch (TimeoutException e) { throw LogFactory.getLog(getClass()).failedWaitingForTopology(currentTopology + 2); } }
@Override public void before(InvocationContext context, VisitableCommand command, Cache cache) { try { cache.getAdvancedCache().getComponentRegistry().getStateTransferLock().waitForTopology(currentTopology + 1, 10, TimeUnit.SECONDS); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } catch (TimeoutException e) { throw LogFactory.getLog(getClass()).failedWaitingForTopology(currentTopology + 1); } }
public void testCacheNotYetSelected() throws Exception { Interpreter interpreter = getInterpreter(); String sessionId = interpreter.createSessionId(null); Map<String, String> response = interpreter.execute(sessionId, "cache;"); assertTrue(response.containsKey(ResultKeys.ERROR.toString())); String errorMsg = LogFactory.getLog(CacheStatement.class, Log.class).noCacheSelectedYet().getMessage(); assertTrue(response.get(ResultKeys.ERROR.toString()).contains(errorMsg)); }
public void testCacheNotYetSelected() throws Exception { Interpreter interpreter = getInterpreter(); String sessionId = interpreter.createSessionId(null); Map<String, String> response = interpreter.execute(sessionId, "cache;"); assertTrue(response.containsKey(ResultKeys.ERROR.toString())); String errorMsg = LogFactory.getLog(CacheStatement.class, Log.class).noCacheSelectedYet().getMessage(); assertTrue(response.get(ResultKeys.ERROR.toString()).contains(errorMsg)); }
public static void assertIsInL1OrNull(Cache<?, ?> cache, Object key) { Log log = LogFactory.getLog(BaseDistFunctionalTest.class); DataContainer dc = cache.getAdvancedCache().getDataContainer(); InternalCacheEntry ice = dc.get(key); if (ice instanceof ImmortalCacheEntry) { String msg = "Entry for key [" + key + "] on cache at [" + addressOf(cache) + "] should be mortal or null but was [" + ice + "]!"; log.fatal(msg); assert false : msg; } }
public static void assertIsInContainerImmortal(Cache<?, ?> cache, Object key) { Log log = LogFactory.getLog(BaseDistFunctionalTest.class); DataContainer dc = cache.getAdvancedCache().getDataContainer(); InternalCacheEntry ice = dc.get(key); if (ice == null) { String msg = "Entry for key [" + key + "] should be in data container on cache at [" + addressOf(cache) + "]!"; log.fatal(msg); assert false : msg; } if (!(ice instanceof ImmortalCacheEntry)) { String msg = "Entry for key [" + key + "] on cache at [" + addressOf(cache) + "] should be immortal but was [" + ice + "]!"; log.fatal(msg); assert false : msg; } }