org.mentalog.test.PauseSupport Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of menta-log Show documentation
Show all versions of menta-log Show documentation
A log library that embraces the kiss principle.
package org.mentalog.test;
import java.util.Random;
import java.util.concurrent.locks.LockSupport;
public class PauseSupport {
private static final Random RANDOM = new Random();
private static int dummy;
public static int assignment(long loops) {
for(int i = 0; i < loops; i++) {
PauseSupport.dummy = i;
}
return PauseSupport.dummy;
}
public static int random(long loops) {
for(int i = 0; i < loops; i++) {
PauseSupport.dummy = RANDOM.nextInt(1000);
}
return PauseSupport.dummy;
}
public static final long lock(long nanos) {
LockSupport.parkNanos(nanos);
return nanos;
}
}