[jboss-cvs] JBossRemoting/src/main/org/jboss/remoting/transport/bisocket ...
Ron Sigal
ron_sigal at yahoo.com
Sun Feb 25 16:20:39 EST 2007
User: rsigal
Date: 07/02/25 16:20:39
Modified: src/main/org/jboss/remoting/transport/bisocket Tag:
remoting_2_x BisocketServerInvoker.java
Log:
JBREM-650: Make multiple attempts to create a socket in ControlConnectionThread.
Revision Changes Path
No revision
No revision
1.1.2.10 +30 -7 JBossRemoting/src/main/org/jboss/remoting/transport/bisocket/BisocketServerInvoker.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: BisocketServerInvoker.java
===================================================================
RCS file: /cvsroot/jboss/JBossRemoting/src/main/org/jboss/remoting/transport/bisocket/BisocketServerInvoker.java,v
retrieving revision 1.1.2.9
retrieving revision 1.1.2.10
diff -u -b -r1.1.2.9 -r1.1.2.10
--- BisocketServerInvoker.java 23 Feb 2007 06:57:37 -0000 1.1.2.9
+++ BisocketServerInvoker.java 25 Feb 2007 21:20:39 -0000 1.1.2.10
@@ -57,7 +57,7 @@
/**
*
* @author <a href="ron.sigal at jboss.com">Ron Sigal</a>
- * @version $Revision: 1.1.2.9 $
+ * @version $Revision: 1.1.2.10 $
* <p>
* Copyright Nov 23, 2006
* </p>
@@ -507,10 +507,34 @@
{
case Bisocket.CREATE_ORDINARY_SOCKET:
InvokerLocator locator = (InvokerLocator) listenerIdToInvokerLocatorMap.get(listenerId);
+
+ for (int i = 0; i < 10; i++)
+ {
+ try
+ {
if (socketFactory != null)
socket = socketFactory.createSocket(locator.getHost(), locator.getPort());
else
socket = new Socket(locator.getHost(), locator.getPort());
+ }
+ catch (Exception e)
+ {
+ log.debug("Error creating a socket", e);
+ }
+
+ if (socket != null)
+ break;
+
+ try
+ {
+ Thread.sleep(1000);
+ }
+ catch (InterruptedException e)
+ {
+ log.debug("unexpected interruption");
+ }
+ }
+
DataOutputStream dos = new DataOutputStream(socket.getOutputStream());
dos.write(Bisocket.CREATE_ORDINARY_SOCKET);
dos.writeUTF(listenerId);
@@ -539,8 +563,7 @@
shutdown();
return;
}
- log.error("Unable to read from control connection: " + e.getMessage());
- e.printStackTrace();
+ log.error("Unable to process control connection: " + e.getMessage(), e);
if (++errorCount > 5)
{
shutdown();
More information about the jboss-cvs-commits
mailing list