Author: ron.sigal(a)jboss.com
Date: 2008-05-01 18:18:39 -0400 (Thu, 01 May 2008)
New Revision: 4112
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/SocketServerInvoker.java
Log:
JBREM-930: refreshServerSocket() closes old ServerSocket before recreating it.
Modified:
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/SocketServerInvoker.java
===================================================================
---
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/SocketServerInvoker.java 2008-05-01
21:57:23 UTC (rev 4111)
+++
remoting2/branches/2.x/src/main/org/jboss/remoting/transport/socket/SocketServerInvoker.java 2008-05-01
22:18:39 UTC (rev 4112)
@@ -170,9 +170,10 @@
ServerSocket oldServerSocket = acceptThreads[i].getServerSocket();
InetAddress address = oldServerSocket.getInetAddress();
int port = oldServerSocket.getLocalPort();
+ oldServerSocket.close();
ServerSocket newServerSocket = null;
- for (int j = 0; j < 4; j++)
+ for (int j = 0; j < 5; j++)
{
try
{
@@ -181,7 +182,7 @@
}
catch (Exception e)
{
- if (j < 3)
+ if (j < 4)
{
// Wait for end of TIME_WAIT state (1 to 4 minutes).
log.warn("Unable to recreate ServerSocket: will try again in 65
seconds", e);
@@ -196,7 +197,6 @@
}
acceptThreads[i].setServerSocket(newServerSocket);
- oldServerSocket.close();
log.info(acceptThreads[i] + " has been updated with new
ServerSocket");
}
}
@@ -1029,7 +1029,6 @@
if(running)
{
log.error(this + " failed to handle socket", ex);
- if (serverSocket.isClosed()) return;
}
else
{