2016-12-30 17:23:13 -08:00

21 lines
541 B
Java

// concurrent/NapTask.java
// (c)2017 MindView LLC: see Copyright.txt
// We make no guarantees that this code is fit for any purpose.
// Visit http://OnJava8.com for more book information.
import onjava.Nap;
public class NapTask implements Runnable {
final int id;
public NapTask(int id) { this.id = id; }
@Override
public void run() {
new Nap(100); // Milliseconds
System.out.println(this + " " +
Thread.currentThread().getName());
}
@Override
public String toString() {
return "NapTask[" + id + "]";
}
}