0

I have to write a java servlet which opens and maintain a socket client alive; this for every http session:

during first http request the servlet will open a socket communication with other server, during others requests coming from same http session the servlet will forward some infos to the socket previously opened and will receive back some data sent to the browser as response.

The goal is to maintan active a socket connection for each http session in the servlet.

To solve this i think to create an array of sockets in the global variables of the servlet, indexed depending on the session id.

could it work? any suggestions?

thanks in advance

ruggbo
  • 1
  • 1
  • Doesn't sound like a very good idea. Why do you want to do this? What's the end result you're looking for? – Kayaman Sep 22 '16 at 18:42
  • i have to strongly separate the web application from the server behind the socket, which has already implemented the backend with sockets.. – ruggbo Sep 22 '16 at 20:44
  • Check this ---> http://stackoverflow.com/questions/3984076/what-are-the-advantages-of-using-an-executorservice. Using this would probably solve your issue. – Am_I_Helpful Sep 23 '16 at 05:32

0 Answers0