Skip to content

Instantly share code, notes, and snippets.

@finnjohnsen
Last active December 16, 2015 07:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save finnjohnsen/5399767 to your computer and use it in GitHub Desktop.
Save finnjohnsen/5399767 to your computer and use it in GitHub Desktop.
Timer spawning service
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