@Override protected boolean beforeHandle(CacheRpcCommand command, Reply reply, DeliverOrder order) { log.debugf("Before invoking %s. expected origin=%s", command, origin); return super.beforeHandle(command, reply, order); }
public void stopBlocking() { if (exception != null) { throw exception; } if (!queuedTopologies.isEmpty()) { log.error("Stopped blocking topology updates, but there are " + queuedTopologies.size() + " blocked updates in the queue: " + queuedTopologies); } enabled = false; log.debugf("Stopped blocking topology updates"); }
@Override protected final void beforeConfirmRebalancePhase(String cacheName, int topologyId, Throwable throwable) { if (!expectedCacheName.equals(cacheName)) return; Event event = new Event(null, topologyId, -1, Type.CONFIRMATION); queuedTopologies.add(event); log.debugf("Blocking rebalance confirmation for cache %s: %s", cacheName, topologyId); event.awaitUnblock(); log.debugf("Continue rebalance confirmation for cache %s: %s", cacheName, topologyId); }
protected void marshallAndAssertArrayEquality(Object[] writeObj) throws Exception { byte[] bytes = marshaller.objectToByteBuffer(writeObj); log.debugf("Payload size for %s[]=%s : %s", writeObj.getClass().getComponentType().getName(), Arrays.toString(writeObj), bytes.length); Object[] readObj = (Object[]) marshaller.objectFromByteBuffer(bytes); assertArrayEquals("Writen[" + Arrays.toString(writeObj) + "] and read[" + Arrays.toString(readObj) + "] objects should be the same", writeObj, readObj); }
@Override public void handle(CacheRpcCommand command, Reply reply, DeliverOrder order) { final Filter currentFilter = filter; if (currentFilter != null && currentFilter.before(command, reply, order)) { delegate.handle(command, reply, order); } else { log.debugf("Ignoring command %s", command); } } }
private void insertTestData() { Cache<String, String> cache = manager(0).getCache(TEST_CACHE_NAME); for (int i = 0; i < NUM_KEYS; i++) { cache.put("key" + i, Integer.toString(i)); } log.debugf("Added %d entries to test cache", NUM_KEYS); }
@CacheEntryCreated @CacheEntryModified @CacheEntryRemoved public void onCacheEvent(CacheEntryEvent event) { log.debugf("Adding new cluster event %s", event); events.add(event); } }
@Override public Object visitRollbackCommand(TxInvocationContext ctx, RollbackCommand command) throws Throwable { if (!ctx.isOriginLocal()) { log.debugf("Received remote rollback for transaction %s", command.getGlobalTransaction()); numberRollbacks.incrementAndGet(); } return invokeNextInterceptor(ctx, command); }
private void printStoreContents() { DummyInMemoryStore store = (DummyInMemoryStore) TestingUtil.getFirstLoader(cache(0, TEST_CACHE_NAME)); Set<Object> keySet = store.keySet(); log.debugf("Shared store has %d keys: %s", keySet.size(), keySet); } }
void awaitXSiteStateSent(String site) { log.debugf("Await until all nodes in '%s' has sent the state!", site); assertEventuallyInSite(site, cache -> extractComponent(cache, XSiteStateProvider.class).getCurrentStateSending().isEmpty(), 30, TimeUnit.SECONDS); }
public boolean awaitForRemoteCompletion(GlobalTransaction globalTransaction, long timeout, TimeUnit unit) throws InterruptedException { long endTimeout = unit.toMillis(timeout) + System.currentTimeMillis(); while (System.currentTimeMillis() < endTimeout && !completedRemoteTransactions(globalTransaction)) { sleep(); } boolean completed = completedRemoteTransactions(globalTransaction); if (log.isDebugEnabled()) { log.debugf("[remote] is %d completed? %s", (Object)globalTransaction.getId(), completed); } return completed; }
@Override public Object visitGetKeysInGroupCommand(InvocationContext ctx, GetKeysInGroupCommand command) throws Throwable { log.debugf("Visit Get Keys in Group. Open? %s. CheckPoint=%s", open, checkPoint); if (!open) { checkPoint.trigger("before"); checkPoint.awaitStrict("after", 30, TimeUnit.SECONDS); } return invokeNextInterceptor(ctx, command); }
private void assertNoTransactionsInPartitionHandler(final String cacheName) { eventually("Transactions pending in PartitionHandlingManager", () -> { for (Cache<?, ?> cache : caches(cacheName)) { Collection<GlobalTransaction> partialTransactions = extractComponent(cache, PartitionHandlingManager.class).getPartialTransactions(); if (!partialTransactions.isEmpty()) { getLog().debugf("transactions not finished in %s. %s", address(cache), partialTransactions); return false; } } return true; }); }
private void addNewCacheManagerAndWaitForRehash() { EmbeddedCacheManager cacheManager = addClusterEnabledCacheManager(getDefaultClusteredCacheConfig( CacheMode.DIST_SYNC, false)); cacheManager.defineConfiguration(testCacheName, buildCfg(true)); log.debugf("\n\nstarted CacheManager #%d", getCacheManagers().size() - 1); waitForClusterToForm(testCacheName); }
private void addNewCacheManagerAndWaitForRehash(int index, boolean preload) { EmbeddedCacheManager cacheManager = addClusterEnabledCacheManager(getDefaultClusteredCacheConfig( cacheMode, false)); Configuration config = buildCfg(index, true, preload); cacheManager.defineConfiguration(TEST_CACHE_NAME, config); log.debugf("\n\nstarted CacheManager #%d", getCacheManagers().size() - 1); waitForClusterToForm(TEST_CACHE_NAME); }
void awaitLocalStateTransfer(String site) { log.debugf("Await until rebalance in site '%s' is finished!", site); assertEventuallyInSite(site, cache -> !extractComponent(cache, StateConsumer.class).isStateTransferInProgress() && !extractComponent(cache, StateProvider.class).isStateTransferInProgress(), 30, TimeUnit.SECONDS); }
public BlockedRequest addResponse(Address sender, Response response) { assertFalse(isDone()); log.debugf("Replying to remote invocation %s with %s from %s", getCommand(), response, sender); Object result = collector.addResponse(sender, response); if (result != null) { complete(result); } return this; }
protected void marshallAndAssertByteArrayEquality(byte[] writeObj) throws Exception { byte[] bytes = marshaller.objectToByteBuffer(writeObj); log.debugf("Payload size for byte[]=%s : %s", Util.toHexString(writeObj), bytes.length); byte[] readObj = (byte[]) marshaller.objectFromByteBuffer(bytes); assertArrayEquals("Writen[" + Util.toHexString(writeObj)+ "] and read[" + Util.toHexString(readObj)+ "] objects should be the same", writeObj, readObj); }
protected void verifyInitialData(Cache<Object, Object> c) { Address address = c.getAdvancedCache().getRpcManager().getAddress(); log.debugf("Checking values on cache " + address); assertEquals("Incorrect value for key " + A_B_NAME, JOE, c.get(A_B_NAME)); assertEquals("Incorrect value for key " + A_B_AGE, TWENTY, c.get(A_B_AGE)); assertEquals("Incorrect value for key " + A_C_NAME, BOB, c.get(A_C_NAME)); assertEquals("Incorrect value for key " + A_C_AGE, FORTY, c.get(A_C_AGE)); }
public void verifyTopology(CacheTopology topology, int topologyId, List<Address> currentMembers, List<Address> pendingMembers, CacheTopology.Phase phase) { log.debugf("Verifying topology %s", topology); assertEquals(topologyId, topology.getTopologyId()); assertEquals(phase, topology.getPhase()); assertEquals(currentMembers, topology.getCurrentCH().getMembers()); if (pendingMembers != null) { assertEquals(pendingMembers, topology.getPendingCH().getMembers()); } else { assertNull(topology.getPendingCH()); } }