How to deploy socket server inside appserver?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Ronald_Wildenberg
Posted On:   Wednesday, January 29, 2003 01:26 AM

Hi, I have a standalone server application that clients can connect to on a certain port and interact with via sockets. The application uses the New I/O API to perform non-blocking socket I/O. Now I'm required to somehow deploy this application into an appserver. I have reviewed several options, but none seem right. The problem is that the server contains one blocking method (acceptConnections) that runs a loop as long as the server is up. This means I would have to create a thread to run the server in. The best place I have come up with until now to create this thread is from the init() method of a servlet. This works fine, but I'm not sure if it's the best way. Is there another way to run a (possibly    More>>

Hi,


I have a standalone server application that clients can connect to on a certain port and interact with via sockets. The application uses the New I/O API to perform non-blocking socket I/O. Now I'm required to somehow deploy this application into an appserver.


I have reviewed several options, but none seem right. The problem is that the server contains one blocking method (acceptConnections) that runs a loop as long as the server is up. This means I would have to create a thread to run the server in. The best place I have come up with until now to create this thread is from the init() method of a servlet. This works fine, but I'm not sure if it's the best way.


Is there another way to run a (possibly multi-threaded) socket application inside an application server?


Thanks in advance,
Ronald Wildenberg.

   <<Less

Re: How to deploy socket server inside appserver?

Posted By:   Nick_Maiorano  
Posted On:   Wednesday, January 29, 2003 07:42 PM

Ronald,



It looks like standard, out-of-the-box J2EE components can't help you here. Servlets were meant to be used for HTTP and you are using a lower-level protocol (TCP/IP). There's no use in using a servlet if it won't do anything for you. Plus, threads are not meant to be used in servlets since they interfere with the servlet container.



Why don't you keep your standalone server application as is and have it call ejb methods inside the ejb container? Your standalone server application would act as a fa├žade to a back-end, ejb-based system.



The only way to use servlets would be to convert from sockets to HTTP. Then you could use standard servlets.

About | Sitemap | Contact