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
I also need to create several threads where each thread will open a socket to another remote processes running in my Glassfish App. Server. I looked into the LifecycleListener bean provided by Glassfish that you need to implement.
I created a prototype to perform the threading and socket work in the LifecycleListener implementation and it really didn't help with the management of these resources. To get access to the LifecycleListener I had to put a public static method that would execute the actions desired.
I see no value in LifecycleListener because I could have performed the exact same work inside my EJB, which is the client calling the LifecycleListener. Because there really is no proper management of the Thread and Socket in the bean.
I was told that JCA may be the best way to go. I have not tried this.