Threading in an Application Server

前端 未结 6 1166
礼貌的吻别
礼貌的吻别 2021-02-19 21:41

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

6条回答
  •  梦谈多话
    2021-02-19 22:11

    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.

提交回复
热议问题