-
1. Re: Howto create a new Thread? (the right way)
wolfgangknauf Mar 16, 2009 11:58 AM (in response to anime-otaku)Hi,
you shouldn't use threads in your server-side apps, because the server cannot control those threads, and thus it cannot care for cleaning them up when the application is e.g. undeployed.
What is your use case? Could it be achieved through SessionBeans, MessageDrivenBeans, WebServices or Servlets?
Best regards
Wolfgang -
2. Re: Howto create a new Thread? (the right way)
anime-otaku Mar 18, 2009 2:53 AM (in response to anime-otaku)"anime-otaku" wrote:
The reason, why I am doing this is because I need to start a Socket Server. -
3. Re: Howto create a new Thread? (the right way)
wolfgangknauf Mar 18, 2009 9:12 AM (in response to anime-otaku)What for do you need the socket server? What does this socket server do that cannot be handled by JBoss services?
If JBoss cannot handle your request: I think you should encapsulate it in a MBean service, which can be started/stopped by the server. The MBean should keep track of all threads and stop them, when it is stopped.
I found this wiki doc about port bindings, hopefully it is helpful: http://www.jboss.org/community/docs/DOC-9038
Another interesting class seems to be this one:
http://docs.huihoo.com/javadoc/jboss/4.0.2/org/jboss/remoting/transport/socket/SocketServerInvoker.java.html (I think it is a MBean, which handles socket requests and calls some custom thread/invoker. But I don't know whether you can plug in your own code in it, it is just a result of doing some google.
Hope this helps
Wolfgang -
4. Re: Howto create a new Thread? (the right way)
anime-otaku Mar 19, 2009 3:24 AM (in response to anime-otaku)Thanks for your help.
I'm not familiar with JBoss Services yet. It's a shame to say, but we will create the thread ourselves. As always we have no time to make it the right way :-(
But it's good to know how to make it next time right ;-)