private static HazelcastInstanceImpl getHazelcastInstanceImpl(HazelcastInstance hz) { HazelcastInstanceImpl impl = null; if (hz instanceof HazelcastInstanceProxy) { return getFieldValue(hz, "original"); } else if (hz instanceof HazelcastInstanceImpl) { impl = (HazelcastInstanceImpl) hz; } return impl; }
private static HazelcastInstanceImpl getHazelcastInstanceImpl(HazelcastInstance hz) { HazelcastInstanceImpl impl = null; if (hz instanceof HazelcastInstanceProxy) { return getFieldValue(hz, "original"); } else if (hz instanceof HazelcastInstanceImpl) { impl = (HazelcastInstanceImpl) hz; } return impl; }
private static HazelcastInstanceImpl getHazelcastInstanceImpl(HazelcastInstance hz) { HazelcastInstanceImpl impl = null; if (hz instanceof HazelcastInstanceProxy) { return getFieldValue(hz, "original"); } else if (hz instanceof HazelcastInstanceImpl) { impl = (HazelcastInstanceImpl) hz; } return impl; }
@Verify public void verify() { if (isClient) { return; } long putCount = putCounter.get(); long getCount = getCounter.get(); Map<Integer, Object> slowOperationLogs = getFieldValue(slowOperationDetector, "slowOperationLogs"); int expected = (int) (Math.min(putCount, 1) + Math.min(getCount, 1)); long operationCount = putCount + getCount; logger.info(format("Expecting %d slow operation logs after completing %d operations (%d put, %d get).", expected, operationCount, putCount, getCount)); assertNotNull("Could not retrieve slow operation logs", slowOperationLogs); assertEqualsStringFormat("Expected %d slow operation logs, but was %d", expected, slowOperationLogs.size()); assertTrue("Expected at least one completed operations, but was " + operationCount + ". Please run the test for a longer time!", operationCount > 0); }
@Setup public void setUp() { isClient = isClient(targetInstance); keys = generateIntKeys(keyCount, KeyLocality.LOCAL, targetInstance); map = targetInstance.getMap(name); // try to find the slowOperationDetector instance (since Hazelcast 3.5) if (isMemberNode(targetInstance)) { slowOperationDetector = getFieldValue(getOperationService(targetInstance), "slowOperationDetector"); if (slowOperationDetector == null) { fail(name + ": This test needs Hazelcast 3.5 or newer"); } } }