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

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

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

origin: com.hazelcast.simulator/utils

  @Override
  public void run() {
    sleepNanos(sleepNanos);
    callerThread.interrupt();
  }
}
origin: com.hazelcast.simulator/utils

/**
 * Sleeps a random amount of time.
 *
 * The call is ignored if maxDelayNanos equals or smaller than zero.
 *
 * @param random        the Random used to randomize
 * @param maxDelayNanos the maximum sleeping period in nanoseconds
 */
public static void sleepRandomNanos(Random random, long maxDelayNanos) {
  if (maxDelayNanos <= 0) {
    return;
  }
  long randomValue = Math.abs(random.nextLong() + 1);
  sleepNanos(randomValue % maxDelayNanos);
}
origin: com.hazelcast.simulator/simulator

/**
 * Sleeps a random amount of time.
 * <p>
 * The call is ignored if maxDelayNanos equals or smaller than zero.
 *
 * @param random        the Random used to randomize
 * @param maxDelayNanos the maximum sleeping period in nanoseconds
 */
public static void sleepRandomNanos(Random random, long maxDelayNanos) {
  if (maxDelayNanos <= 0) {
    return;
  }
  long randomValue = Math.abs(random.nextLong() + 1);
  sleepNanos(randomValue % maxDelayNanos);
}
origin: com.hazelcast.simulator/simulator

@Override
public void run() {
  while (!shutdown.get()) {
    long startedNanos = System.nanoTime();
    long currentTimestamp = System.currentTimeMillis();
    boolean runningTestFound = hasRunningTests();
    updateTrackers(currentTimestamp);
    sendPerformanceStats();
    writeStatsToFiles(currentTimestamp);
    long elapsedNanos = System.nanoTime() - startedNanos;
    if (intervalNanos > elapsedNanos) {
      if (runningTestFound) {
        sleepNanos(intervalNanos - elapsedNanos);
      } else {
        sleepNanos(WAIT_FOR_TEST_CONTAINERS_DELAY_NANOS - elapsedNanos);
      }
    } else {
      LOGGER.warn(getName() + ".run() took " + NANOSECONDS.toMillis(elapsedNanos) + " ms");
    }
  }
}
com.hazelcast.simulator.utilsCommonUtilssleepNanos

Popular methods of CommonUtils

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

Popular in Java

  • Start an intent from android
  • scheduleAtFixedRate (Timer)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • scheduleAtFixedRate (ScheduledExecutorService)
  • Thread (java.lang)
    A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • Pattern (java.util.regex)
    Patterns are compiled regular expressions. In many cases, convenience methods such as String#matches
  • JOptionPane (javax.swing)
  • BasicDataSource (org.apache.commons.dbcp)
    Basic implementation of javax.sql.DataSource that is configured via JavaBeans properties. This is no
  • Best plugins for Eclipse
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