Makes a Timer in the form of a StormTimerTask Object. @param name name of the timer @param onKill function to call when timer is killed unexpectedly
(String name, Thread.UncaughtExceptionHandler onKill)
| 37 | * @param onKill function to call when timer is killed unexpectedly |
| 38 | */ |
| 39 | public StormTimer(String name, Thread.UncaughtExceptionHandler onKill) { |
| 40 | if (onKill == null) { |
| 41 | throw new RuntimeException("onKill func is null!"); |
| 42 | } |
| 43 | if (name == null) { |
| 44 | this.task.setName("timer"); |
| 45 | } else { |
| 46 | this.task.setName(name); |
| 47 | } |
| 48 | this.task.setOnKillFunc(onKill); |
| 49 | this.task.setActive(true); |
| 50 | |
| 51 | this.task.setDaemon(true); |
| 52 | this.task.setPriority(Thread.MAX_PRIORITY); |
| 53 | this.task.start(); |
| 54 | } |
| 55 | |
| 56 | /** |
| 57 | * Schedule a function to be executed in the timer. |
nothing calls this directly
no test coverage detected