All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.mentalog.test.PauseSupport Maven / Gradle / Ivy

There is a newer version: 2.1.2
Show newest version
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;
	}
	
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy