Last active
December 16, 2015 07:38
-
-
Save finnjohnsen/5399767 to your computer and use it in GitHub Desktop.
Timer spawning service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.* | |
// very silly example spawning a thread | |
class MyService { | |
TimerTask task | |
Timer timer | |
def startJobs() { | |
timer = new Timer("Job") //Setting job name is important for the test | |
task = timer.runAfter(10000, {}) | |
} | |
def endJobs() { | |
timer.cancel() | |
task.cancel() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment