Announcement Announcement Module
Collapse
No announcement yet.
Socket connections and J2EE Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Socket connections and J2EE

    Hello,

    What is the best way to use TCP socket connections in J2EE appserver (cluster)?

    My usecase is like this: two kind of socket connections, one for sending "requests" and the second for receiving "responses" to requests sent via the other connection. There can't be more than one "response" connection, but several "request" connections are allowed.

    So the app have to create at least two _client_ connections to the server outside. No listening connections. Connections must be stayed open for the lifetime of application (except time-outs or periodically refreshs etc).

    Response connection must be started when the appserver starts and closed when appserver shuts down (also "request" connections should be cleaned when server shuts down).

    How the app can hook to server start and shutdown process?
    I had an idea of creating some kind of "control" servlet that creates the response connection in the init() method and closes it in the destroy(), but it seems to be that the servlet spec is not requiring tieing these lifecycle methods _only_ in server start or shutdown process. Server can call these anytime it want.

    -ripok-
Working...
X