Search code examples
javamultithreadingglassfishejbapplication-server

Threading in an Application Server


I have a Java program/thread that I want to deploy into an Application Server (GlassFish). The thread should run as a "service" that starts when the Application Server starts and stops when the Application Server closes.

How would I go about doing this? It's not really a Session Bean or MDB. It's just a thread.


Solution

  • Check out the LifecycleListener interface:

    http://glassfish.java.net/nonav/docs/v3/api/index.html?com/sun/appserv/server/LifecycleListener.html

    http://docs.oracle.com/cd/E18930_01/html/821-2418/beamc.html