TimeSlicerpublic class TimeSlicer extends Thread
Fields Summary |
---|
private long | timeslice |
Constructors Summary |
---|
public TimeSlicer(long milliseconds, int priority)
this.timeslice = milliseconds;
this.setPriority(priority);
// If this is the last thread left, it should not
// stop the VM from exiting
this.setDaemon(true);
| public TimeSlicer(long milliseconds)
this(milliseconds, 10);
| public TimeSlicer()
this(100, 10);
|
Methods Summary |
---|
public void | run()
while (true) {
try {
Thread.sleep(timeslice);
}
catch (InterruptedException e) {
}
}
|
|