Tabnine Logo
CommonUtils.sleepSeconds
Code IndexAdd Tabnine to your IDE (free)

How to use
sleepSeconds
method
in
com.hazelcast.simulator.utils.CommonUtils

Best Java code snippets using com.hazelcast.simulator.utils.CommonUtils.sleepSeconds (Showing top 20 results out of 315)

origin: com.hazelcast.simulator/tests-common

  @Override
  public void afterCompletion() {
    listeners.add(listener);
    sleepSeconds(PAUSE_FOR_LAST_EVENTS_SECONDS);
  }
}
origin: com.hazelcast.simulator/tests-common

  private void sleep(TestPhase currentTestPhase) {
    if (randomWorker) {
      Random random = new Random();
      if (random.nextBoolean()) {
        return;
      }
    }
    if (allPhases || currentTestPhase.equals(testPhase)) {
      sleepSeconds(sleepSeconds);
    }
  }
}
origin: com.hazelcast.simulator/tests-common

  private void sleepRecursion(int recursionDepth, int sleepSeconds) {
    if (recursionDepth == 0) {
      sleepSeconds(sleepSeconds);
      return;
    }
    sleepRecursion(recursionDepth - 1, sleepSeconds);
  }
}
origin: com.hazelcast.simulator/tests-common

@TimeStep
public void timeStep() {
  sleepSeconds(1);
}
origin: com.hazelcast.simulator/simulator

void start() {
  if (!isEC2(cloudProvider)) {
    LOGGER.info("No Harakiri monitor is active: only on AWS-EC2 unused machines will be terminated.");
    return;
  }
  LOGGER.info(format("Harakiri monitor is active and will wait %d seconds to kill this instance", waitSeconds));
  sleepSeconds(waitSeconds);
  LOGGER.info("Trying to commit Harakiri once!");
  try {
    LOGGER.info("Harakiri command: " + command);
    execute(command);
  } catch (Exception e) {
    throw new CommandLineExitException("Failed to execute Harakiri", e);
  }
}
origin: com.hazelcast.simulator/tests-common

public void waitWhileListenerEventsIncrease(EntryListenerImpl listener, int maxIterationNoChange) {
  int iterationsWithoutChange = 0;
  long prev = 0;
  do {
    long diff = absDifference(listener);
    if (diff >= prev) {
      iterationsWithoutChange++;
    } else {
      iterationsWithoutChange = 0;
    }
    prev = diff;
    sleepSeconds(2);
  } while (!sameEventCount(listener) && iterationsWithoutChange < maxIterationNoChange);
}
origin: com.hazelcast.simulator/tests-hz35

public static void waitClusterSize(ILogger logger, HazelcastInstance hz, int clusterSize) {
  for (; ; ) {
    if (hz.getCluster().getMembers().size() >= clusterSize) {
      return;
    }
    logger.info("waiting cluster == " + clusterSize);
    sleepSeconds(1);
  }
}
origin: com.hazelcast.simulator/simulator

private void logPerformanceInfo(long startMs) {
  long actualDurationMs = currentTimeMillis() - startMs;
  if (performanceMonitorIntervalSeconds > 0) {
    LOGGER.info(testCase.getId() + " Waiting for all performance info");
    sleepSeconds(performanceMonitorIntervalSeconds);
    LOGGER.info("Performance " + testCase.getId() + "\n"
        + performanceStatsCollector.detailedPerformanceInfo(testCase.getId(), actualDurationMs));
  }
}
origin: com.hazelcast.simulator/tests-common

public static void waitClusterSize(ILogger logger, HazelcastInstance hz, int clusterSize) {
  for (; ; ) {
    if (hz.getCluster().getMembers().size() >= clusterSize) {
      return;
    }
    logger.info("waiting cluster == " + clusterSize);
    sleepSeconds(1);
  }
}
origin: com.hazelcast.simulator/tests-hz36

public static void waitClusterSize(ILogger logger, HazelcastInstance hz, int clusterSize) {
  for (; ; ) {
    if (hz.getCluster().getMembers().size() >= clusterSize) {
      return;
    }
    logger.info("waiting cluster == " + clusterSize);
    sleepSeconds(1);
  }
}
origin: com.hazelcast.simulator/simulator

private void waitForPhaseCompletion(TestPhase testPhase) {
  int completedWorkers = phaseCompletedMap.get(testPhase).size();
  int expectedWorkers = getExpectedWorkerCount(testPhase);
  long started = System.nanoTime();
  while (completedWorkers < expectedWorkers) {
    sleepSeconds(1);
    if (hasFailure()) {
      throw new TestCaseAbortedException(
          format("Waiting for %s completion aborted (critical failure)", testPhase.desc()), testPhase);
    }
    completedWorkers = phaseCompletedMap.get(testPhase).size();
    expectedWorkers = getExpectedWorkerCount(testPhase);
    logMissingWorkers(testPhase, completedWorkers, expectedWorkers, started);
  }
}
origin: com.hazelcast.simulator/simulator

private void processTerminateWorker(TerminateWorkerOperation operation) {
  LOGGER.warn("Terminating worker");
  if (type == WorkerType.MEMBER) {
    sleepSeconds(operation.getMemberWorkerShutdownDelaySeconds());
  }
  worker.shutdown(operation.isEnsureProcessShutdown());
}
origin: com.hazelcast.simulator/tests-common

  @Verify(global = false)
  public void verify() {
    sleepSeconds(maxTTLExpirySeconds * 2);

    logger.info(name + ": map size  =" + map.size());
  }
}
origin: com.hazelcast.simulator/tests-hz36

  @Verify(global = false)
  public void verify() {
    sleepSeconds(maxTTLExpirySeconds * 2);

    logger.info(name + ": map size  =" + map.size());
  }
}
origin: com.hazelcast.simulator/tests-common

  @Verify(global = true)
  public void globalVerify() {
    sleepSeconds(61);

    // provoke expire after TTL
    for (int i = 0; i < keyCount; i++) {
      cache.containsKey(i);
    }

    assertTrueEventually(new AssertTask() {
      @Override
      public void run() throws Exception {
        int cacheSize = cache.size();
        logger.info(name + " ICache size: " + cacheSize);
        assertEquals(name + " ICache should be empty, but TTL events are not processed", 0, cacheSize);
      }
    });
  }
}
origin: com.hazelcast.simulator/tests-common

  @Override
  public void run() throws Exception {
    // hack to prevent overloading the system with get calls, else it is done many times a second
    sleepSeconds(10);
    long actual = 0;
    for (DistributedObject distributedObject : targetInstance.getDistributedObjects()) {
      String key = distributedObject.getName();
      if (serviceName.equals(distributedObject.getServiceName()) && key.startsWith(name)) {
        actual += targetInstance.getAtomicLong(key).get();
      }
    }
    assertEquals(expected, actual);
  }
}, assertEventuallySeconds);
origin: com.hazelcast.simulator/simulator

public boolean run(TestSuite testSuite) throws Exception {
  if (testSuite.getDurationSeconds() == 0) {
    LOGGER.info("Test suite runs without time-limit, it will complete when it decides it's ready or CTRL-C is pressed");
  }
  try {
    coordinator.createRunTestSuiteTask(testSuite).run();
  } catch (CommandLineExitException e) {
    for (int i = 0; i < WAIT_FOR_WORKER_FAILURE_RETRY_COUNT && failureCollector.getFailureCount() == 0; i++) {
      sleepSeconds(1);
    }
    throw e;
  }
  return !failureCollector.hasCriticalFailure();
}
origin: com.hazelcast.simulator/simulator

public String testStop(RcTestStopOperation op) throws Exception {
  awaitInitialized();
  LOGGER.info(format("Test [%s] stopping...", op.getTestId()));
  TestData test = componentRegistry.getTestByAddress(SimulatorAddress.fromString(op.getTestId()));
  if (test == null) {
    throw new IllegalStateException(format("no test with id [%s] found", op.getTestId()));
  }
  for (int i = 0; i < testCompletionTimeoutSeconds; i++) {
    test.setStopRequested(true);
    sleepSeconds(1);
    if (test.isCompleted()) {
      return test.getStatusString();
    }
  }
  throw new Exception("Test failed to stop within " + testCompletionTimeoutSeconds
      + " seconds, current status: " + test.getStatusString());
}
origin: com.hazelcast.simulator/tests-common

@TimeStep
public void timeStep(ThreadState state) throws Exception {
  double usedPercentage = heapUsedPercentage();
  if (usedPercentage >= maxHeapUsagePercentage) {
    logger.info(name + " heap used: " + usedPercentage + " %, map size: " + map.size());
    sleepSeconds(10);
  } else {
    for (int i = 0; i < 1000; i++) {
      state.counter++;
      if (state.counter % 100000 == 0) {
        logger.info(name + " at: " + state.counter + ", heap used: " + usedPercentage
            + " %, map size: " + map.size());
      }
      long key = state.randomLong();
      map.put(key, 0L, 24, HOURS);
    }
  }
}
origin: com.hazelcast.simulator/tests-common

@Prepare
public void prepare() {
  if (!isMemberNode(targetInstance)) {
    return;
  }
  int retry = 0;
  while (!partitionService.isClusterSafe() && retry++ < isClusterSafeRetries) {
    logger.info(name + ": isClusterSafe() " + partitionService.isClusterSafe());
    sleepSeconds(1);
  }
  logger.info(name + ": isClusterSafe() " + partitionService.isClusterSafe());
  logger.info(name + ": isLocalMemberSafe() " + partitionService.isLocalMemberSafe());
  logger.info(name + ": getCluster().getMembers().size() " + targetInstance.getCluster().getMembers().size());
  logPartitionStatistics(logger, name, map, false);
}
com.hazelcast.simulator.utilsCommonUtilssleepSeconds

Popular methods of CommonUtils

  • sleepMillis
  • closeQuietly
  • exitWithError
  • exit
  • rethrow
  • sleepMillisThrowException
  • sleepNanos
  • throwableToString
  • await
  • awaitTermination
  • getElapsedSeconds
  • getSimulatorVersion
  • getElapsedSeconds,
  • getSimulatorVersion,
  • joinThread,
  • sleepRandomNanos,
  • sleepTimeUnit,
  • sleepUntilMs

Popular in Java

  • Reading from database using SQL prepared statement
  • scheduleAtFixedRate (ScheduledExecutorService)
  • addToBackStack (FragmentTransaction)
  • getContentResolver (Context)
  • BufferedReader (java.io)
    Wraps an existing Reader and buffers the input. Expensive interaction with the underlying reader is
  • Proxy (java.net)
    This class represents proxy server settings. A created instance of Proxy stores a type and an addres
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • TimeZone (java.util)
    TimeZone represents a time zone offset, and also figures out daylight savings. Typically, you get a
  • Collectors (java.util.stream)
  • JOptionPane (javax.swing)
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now