blob: 276138f3ada722466f56cd332845ae71aa057065 [file] [log] [blame]
package org.onlab.util;
import org.jboss.netty.util.HashedWheelTimer;
/**
* Hashed-wheel timer singleton. Care must be taken to shutdown the timer
* only when the VM is ready to exit.
*/
public final class Timer {
private static HashedWheelTimer timer;
// Ban public construction
private Timer() {
}
/**
* Returns the singleton hashed-wheel timer.
*
* @return hashed-wheel timer
*/
public static HashedWheelTimer getTimer() {
if (Timer.timer == null) {
Timer.timer = new HashedWheelTimer();
Timer.timer.start();
}
return Timer.timer;
}
}