public Status scan(String table, String startkey, int recordcount, Set<String> fields, Vector<HashMap<String, ByteIterator>> result) { LOGGER.warn("Infinispan does not support scan semantics"); return Status.OK; }
@Override public Status scan(String table, String startkey, int recordcount, Set<String> fields, Vector<HashMap<String, ByteIterator>> result) { LOGGER.warn("Infinispan does not support scan semantics"); return Status.NOT_IMPLEMENTED; }
public void closeAll() { synchronized (this) { for (Entry<String, EntityManagerFactory> entry : registry.entrySet()) { try { if (entry.getValue().isOpen()) entry.getValue().close(); } catch (IllegalStateException e) { log.warn("Entity manager factory was already closed: " + entry.getKey()); } } } }
private Properties loadPropertiesFromFile(final Resource propertiesFileLocation) throws IOException { InputStream propsStream = null; try { propsStream = propertiesFileLocation.getInputStream(); final Properties answer = new Properties(); answer.load(propsStream); return answer; } finally { if (propsStream != null) { try { propsStream.close(); } catch (final IOException e) { this.logger.warn( "Failed to close InputStream used to load configuration properties: " + e.getMessage(), e); } } } }
public void closeEntityManagerFactory(String persistenceUnitName) { synchronized (this) { if (!registry.containsKey(persistenceUnitName)) { return; } int count = decrementUsage(persistenceUnitName); if (count == 0) { EntityManagerFactory emf = registry.remove(persistenceUnitName); try { if (emf.isOpen()) emf.close(); } catch (IllegalStateException e) { log.warn("Entity manager factory was already closed: " + persistenceUnitName); } } } }
@Override public void beforeOperation(Cache cache) { try { cache.put(SHARED_KEY, "someValue"); } catch (CacheException e) { log.warn("Write skew check error while inserting the key", e); } }
public static void killCacheManagers(List<? extends EmbeddedCacheManager> cacheManagers) { // Stop the managers in reverse order to prevent each of them from becoming coordinator in turn for (int i = cacheManagers.size() - 1; i >= 0; i--) { EmbeddedCacheManager cm = cacheManagers.get(i); try { if (cm != null) cm.stop(); } catch (Throwable e) { log.warn("Problems killing cache manager " + cm, e); } } }
public static void clearContent(List<? extends EmbeddedCacheManager> cacheManagers) { for (EmbeddedCacheManager cm : cacheManagers) { try { clearContent(cm); } catch (Throwable e) { log.warn("Problems clearing cache manager " + cm, e); } } }
@AfterMethod(alwaysRun = true) public void shutDownDistributedExecutorService() { if (cleanupService != null) { cleanupService.shutdownNow(); } else { log.warn("Should have shutdown DistributedExecutorService but none was set"); } }
/** * The following test phases can be profiled individually using triggers in JProfiler. */ protected void init() { long startTime = System.currentTimeMillis(); log.warn("Starting init() phase"); fqns.clear(); for (int i = 0; i < MAX_OVERALL_NODES; i++) { Fqn fqn; do { fqn = FqnGenerator.createRandomFqn(MAX_DEPTH); } while (fqns.contains(fqn)); if (i % 100 == 0) log.warn("Generated " + i + " fqns"); fqns.add(fqn); } System.gc(); long duration = System.currentTimeMillis() - startTime; log.warn("Finished init() phase. " + printDuration(duration)); }
@Override public void run() { try { log.trace("Started fork runnable.."); realOne.run(); log.debug("Exiting fork runnable."); } catch (Throwable e) { log.warn("Exiting fork runnable due to exception", e); throw e; } } }
@Override public T call() throws Exception { try { log.trace("Started fork callable.."); T result = c.call(); log.debug("Exiting fork callable."); return result; } catch (Exception e) { log.warn("Exiting fork callable due to exception", e); throw e; } } }
@Override public Void call() throws Exception { try { log.trace("Started concurrent callable"); barrier.await(10, TimeUnit.SECONDS); log.trace("Synchronized with the other concurrent runnables"); task.run(); log.debug("Exiting fork runnable."); return null; } catch (Throwable e) { log.warn("Exiting fork runnable due to exception", e); throw e; } } }
public void testSimple() throws Exception { prepareTestData(); cacheQuery = createCacheQuery("blurb:playing"); List<Person> found = cacheQuery.list(); assertEquals(1, found.size()); if (found.get(0) == null) { log.warn("found.get(0) is null"); Person p1 = cache2.get(key1); if (p1 == null) { log.warn("Person p1 is null in sc2 and cannot actually see the data of person1 in sc1"); } else { log.trace("p1 name is " + p1.getName()); } } assertEquals(person1, found.get(0)); StaticTestingErrorHandler.assertAllGood(cache1, cache2); }
@Test public void testGetBlockingAnotherGetWithMiss() throws Throwable { final Cache<Object, String> nonOwnerCache = getFirstNonOwner(key); final Cache<Object, String> ownerCache = getFirstOwner(key); assertIsNotInL1(nonOwnerCache, key); CheckPoint checkPoint = new CheckPoint(); L1Manager l1Manager = waitUntilL1Registration(nonOwnerCache, checkPoint); try { log.warn("Doing get here - ignore all previous"); Future<String> getFuture = fork(() -> nonOwnerCache.get(key)); // Wait until we are about to write value into data container on non owner checkPoint.awaitStrict("pre_acquire_shared_topology_lock_invoked", 10, TimeUnit.SECONDS); Future<String> getFuture2 = fork(() -> nonOwnerCache.get(key)); Exceptions.expectException(TimeoutException.class, () -> getFuture2.get(1, TimeUnit.SECONDS)); // Let the get complete finally checkPoint.triggerForever("pre_acquire_shared_topology_lock_released"); assertNull(getFuture.get(10, TimeUnit.SECONDS)); assertNull(getFuture2.get(10, TimeUnit.SECONDS)); } finally { TestingUtil.replaceComponent(nonOwnerCache, L1Manager.class, l1Manager, true); } }
@Test public void testGetBlockedInvalidation() throws Throwable { final Cache<Object, String> nonOwnerCache = getFirstNonOwner(key); final Cache<Object, String> ownerCache = getFirstOwner(key); ownerCache.put(key, firstValue); assertIsNotInL1(nonOwnerCache, key); CheckPoint checkPoint = new CheckPoint(); waitUntilAboutToAcquireLock(nonOwnerCache, checkPoint); log.warn("Doing get here - ignore all previous"); Future<String> getFuture = fork(() -> nonOwnerCache.get(key)); // Wait until we are about to write value into data container on non owner checkPoint.awaitStrict("pre_acquire_shared_topology_lock_invoked", 10, TimeUnit.SECONDS); Future<String> putFuture = fork(() -> ownerCache.put(key, secondValue)); Exceptions.expectException(TimeoutException.class, () -> putFuture.get(1, TimeUnit.SECONDS)); // Let the get complete finally checkPoint.triggerForever("pre_acquire_shared_topology_lock_released"); assertEquals(firstValue, getFuture.get(10, TimeUnit.SECONDS)); assertEquals(firstValue, putFuture.get(10, TimeUnit.SECONDS)); assertIsNotInL1(nonOwnerCache, key); }
/** * Simulates a node crash, discarding all the messages from/to this node and then stopping the caches. */ public static void crashCacheManagers(EmbeddedCacheManager... cacheManagers) { for (EmbeddedCacheManager cm : cacheManagers) { JGroupsTransport t = (JGroupsTransport) cm.getGlobalComponentRegistry().getComponent(Transport.class); JChannel channel = t.getChannel(); try { DISCARD discard = new DISCARD(); discard.setDiscardAll(true); channel.getProtocolStack().insertProtocol(discard, ProtocolStack.Position.ABOVE, TP.class); } catch (Exception e) { log.warn("Problems inserting discard", e); throw new RuntimeException(e); } View view = View.create(channel.getAddress(), 100, channel.getAddress()); ((GMS) channel.getProtocolStack().findProtocol(GMS.class)).installView(view); } killCacheManagers(cacheManagers); }
public void testPutAsyncWithLifespanAndMaxIdle() throws Exception { // lifespan only Future<String> f = c.putAsync("k", "v", 1000, TimeUnit.MILLISECONDS); markStartTime(); assertFutureResult(f, null); verifyEviction("k", "v", 1000, 500, true); log.warn("STARTING FAILING ONE"); // lifespan and max idle (test max idle) f = c.putAsync("k", "v", 3000, TimeUnit.MILLISECONDS, 1000, TimeUnit.MILLISECONDS); markStartTime(); assertFutureResult(f, null); verifyEviction("k", "v", 1000, 500, false); // lifespan and max idle (test lifespan) f = c.putAsync("k", "v", 3000, TimeUnit.MILLISECONDS, 1000, TimeUnit.MILLISECONDS); markStartTime(); assertFutureResult(f, null); verifyEviction("k", "v", 3000, 500, true); }