I have a application that accepts SSL connections on a particular port. When I stop the application from the Websphere Administrative Console and then start it again, I get an exception that complains that the port is still in use. I need to shutdown and restart Websphere entirely to get the application working again.
What is the correct way to stop listening to a port in Java?
Create a context listener and register it in web.xml. Then you can close all your open socket in the
contextDestroyed()call.See this for details,
http://publib.boulder.ibm.com/infocenter/wasinfo/v7r0/index.jsp?topic=/com.ibm.websphere.base.doc/info/aes/ae/cweb_sctxl.html