Announcement Announcement Module
No announcement yet.
Running a multithreaded server as a Spring bean Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Running a multithreaded server as a Spring bean

    I have read some vague generalities in Spring books about using Spring to tie 2 different, multithreaded servers into one Spring app. Is this possible?

    Are there any Spring experts out there who can tell me if you can run a web application (HTTP Server-based) and also a separate mutithreaded protocol server (such as a telnet server or an ftp server or a custom server) within one Spring application? One JVM? Wouldn't this mean trying to run > 1 main() method (internally) in a single JVM--and therefore impossible?

    I hope not. Is it possible to write a 2nd TCP/IP server application, run from a main() method, that shares the same JVM as a running J2EE webapp, (which means a web server is running at the same time).

    Because TCP/IP server applications are multithreaded, wouldn't the APplication server (Glassfish in this case) prevent you from creating new threads from within a Java bean?

    I ask because using simple experiments, I have found that running a simple TCP/IP server alone from a main() method works fine--but as soon as you start up a web application(and therefore a web server) in that same application server, same JVM, your 2ndary server is no longer able to accept connections from clients.

    How do you ensure both servers accept client connections in their respective protocols?