Home Ask Login Register

Developers Planet

Your answer is one click away!

Vinod Jayachandran February 2016

How to start a Java Thread once Grails App is up?

I have a requirement to start a Java Thread after Grails App (Tomcat) is up, What is the correct way to do it ?


Vinay Prajapati February 2016

I'm not 100% sure with the question you have asked but it appears that you need to start some threads once the grails app is up. Java threads term doesn't make much sense so let's just call these threads.

You could do this in bootstrap file's init method as init is the place that gets executed just after the application loads.

class Bootstrap{
    def init = { servletContext ->


def destroy = {


you could also kill heavy / costly resources in destroy method .

Hope it helps!

Post Status

Asked in February 2016
Viewed 2,724 times
Voted 12
Answered 1 times


Leave an answer

Quote of the day: live life