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

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

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

origin: com.hazelcast.simulator/tests-common

private void delay() {
  if (maxDelayMs != 0) {
    sleepMillis(minDelayMs + random.nextInt(maxDelayMs));
  }
}
origin: com.hazelcast.simulator/tests-common

private void delay() {
  if (maxDelayMs > 0) {
    sleepMillis(minDelayMs + random.nextInt(maxDelayMs));
  }
}
origin: com.hazelcast.simulator/simulator

public static void sleepUntilMs(long deadlineMs) {
  long now = System.currentTimeMillis();
  long duration = deadlineMs - now;
  if (duration > 0) {
    sleepMillis(duration);
  }
}
origin: com.hazelcast.simulator/tests-common

  @Override
  public Object process(Map.Entry<Integer, Long> entry) {
    sleepMillis(delayMs);
    long newValue = entry.getValue() + increment;
    entry.setValue(newValue);
    return null;
  }
}
origin: com.hazelcast.simulator/tests-common

@Override
@SuppressWarnings("unchecked")
public void delete(Object object) {
  if (deleteDelayMs > 0) {
    sleepMillis(deleteDelayMs);
  }
  K key = (K) object;
  V value = writtenKeys.remove(key);
  if (value != null) {
    deletedEntries.put(key, value);
  }
  deleteCount.incrementAndGet();
}
origin: com.hazelcast.simulator/tests-common

@Override
public Map<K, K> loadAll(Iterable<? extends K> keys) {
  if (loadAllDelayMs > 0) {
    sleepMillis(loadAllDelayMs);
  }
  Map<K, K> map = new HashMap<K, K>();
  for (K key : keys) {
    load(key);
    map.put(key, key);
  }
  return map;
}
origin: com.hazelcast.simulator/tests-common

  @Override
  public void afterCompletion() {
    // wait, so that our entry listener implementation can catch the last incoming events from other members / clients
    sleepMillis(SLEEP_CATCH_EVENTS_MILLIS);
    listeners.add(listener);
  }
}
origin: com.hazelcast.simulator/tests-common

@Override
public K load(final K key) {
  checkNotNull(key, "load null key!");
  if (loadDelayMs > 0) {
    sleepMillis(loadDelayMs);
  }
  loaded.put(key, key);
  loadCount.incrementAndGet();
  return key;
}
origin: com.hazelcast.simulator/tests-common

@Override
public void writeAll(Collection<Cache.Entry<? extends K, ? extends V>> entries) {
  if (writeAllDelayMs > 0) {
    sleepMillis(writeAllDelayMs);
  }
  for (Cache.Entry<? extends K, ? extends V> entry : entries) {
    write(entry);
  }
}
origin: com.hazelcast.simulator/tests-common

@Override
public void deleteAll(Collection<?> entries) {
  if (deleteAllDelayMs > 0) {
    sleepMillis(deleteAllDelayMs);
  }
  for (Iterator<?> keys = entries.iterator(); keys.hasNext(); ) {
    delete(keys.next());
    keys.remove();
  }
}
origin: com.hazelcast.simulator/tests-common

@AfterRun
public void afterRun() throws Exception {
  sleepMillis((maxTryTimeMillis + maxLeaseTimeMillis) * 2);
}
origin: com.hazelcast.simulator/simulator

  public void shutdown() {
    messageQueue.add(POISON_PILL);
    SimulatorMessage message = messageQueue.peek();
    while (message != null) {
      if (!POISON_PILL.equals(message)) {
        int queueSize = messageQueue.size();
        LOGGER.debug(format("%d messages pending on messageQueue, first message: %s", queueSize, message));
      }
      sleepMillis(WAIT_FOR_EMPTY_QUEUE_MILLIS);
      message = messageQueue.peek();
    }
    joinThread(messageQueueThread);
  }
}
origin: com.hazelcast.simulator/tests-common

@Override
public void write(Cache.Entry<? extends K, ? extends V> entry) {
  if (writeDelayMs > 0) {
    sleepMillis(writeDelayMs);
  }
  writtenKeys.put(entry.getKey(), entry.getValue());
  writeCount.incrementAndGet();
}
origin: com.hazelcast.simulator/simulator

private void waitForWorkerShutdown(int expectedWorkerCount) {
  int timeoutSeconds = simulatorProperties.getWaitForWorkerShutdownTimeoutSeconds();
  long started = System.nanoTime();
  LOGGER.info(format("Waiting up to %d seconds for shutdown of %d Workers...", timeoutSeconds, expectedWorkerCount));
  long expirationTimeMillis = System.currentTimeMillis() + SECONDS.toMillis(timeoutSeconds);
  while (componentRegistry.workerCount() > 0 && System.currentTimeMillis() < expirationTimeMillis) {
    sleepMillis(FINISHED_WORKERS_SLEEP_MILLIS);
  }
  List<WorkerData> remainingWorkers = componentRegistry.getWorkers();
  if (remainingWorkers.isEmpty()) {
    LOGGER.info(format("Finished shutdown of all Workers (%d seconds)", getElapsedSeconds(started)));
  } else {
    LOGGER.warn(format("Aborted waiting for shutdown of all Workers (%d still running)...", remainingWorkers.size()));
    LOGGER.warn(format("Unfinished workers: %s", toString(remainingWorkers)));
  }
}
origin: com.hazelcast.simulator/tests-common

@AfterRun
public void afterRun(ThreadState state) {
  // sleep to give time for the last EntryProcessor tasks to complete
  sleepMillis(maxProcessorDelayMs * 2);
  resultsPerWorker.add(state.localIncrementsAtKey);
}
origin: com.hazelcast.simulator/tests-common

@AfterRun
public void afterRun(ThreadState state) {
  // sleep to give time for the last EntryProcessor tasks to complete
  sleepMillis(maxProcessorDelayMs * 2);
  resultsPerWorker.add(state.result);
}
origin: com.hazelcast.simulator/tests-common

  @Override
  public Object process(MutableEntry<Integer, Long> entry, Object... arguments) {
    if (delayMs > 0) {
      sleepMillis(delayMs);
    }
    long newValue = entry.getValue() + increment;
    entry.setValue(newValue);
    return null;
  }
}
origin: com.hazelcast.simulator/tests-common

  @Run
  public void run() {
    while (!testContext.isStopped()) {
      probe.recordValue(LATENCY_NANOS);
      sleepMillis(1);
    }
  }
}
origin: com.hazelcast.simulator/simulator

  @Override
  public void run() {
    PingOperation operation = new PingOperation();
    while (running) {
      try {
        invokeOnAllWorkers(operation);
        sleepMillis(pingIntervalMillis);
      } catch (SimulatorProtocolException e) {
        if (e.getCause() instanceof InterruptedException) {
          break;
        }
      }
    }
  }
}
origin: com.hazelcast.simulator/simulator

@Override
public void run() {
  while (running) {
    try {
      for (WorkerProcess workerProcess : workerProcessManager.getWorkerProcesses()) {
        detectFailures(workerProcess);
        if (workerProcess.isFinished()) {
          workerProcessManager.remove(workerProcess);
        }
      }
    } catch (Exception e) {
      LOGGER.fatal("Failed to scan for failures", e);
    }
    sleepMillis(checkIntervalMillis);
  }
}
com.hazelcast.simulator.utilsCommonUtilssleepMillis

Popular methods of CommonUtils

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

Popular in Java

  • Parsing JSON documents to java classes using gson
  • setRequestProperty (URLConnection)
  • startActivity (Activity)
  • getExternalFilesDir (Context)
  • VirtualMachine (com.sun.tools.attach)
    A Java virtual machine. A VirtualMachine represents a Java virtual machine to which this Java vir
  • BigDecimal (java.math)
    An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • JFileChooser (javax.swing)
  • CodeWhisperer alternatives
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