[jboss-cvs] JBossRemoting/src/main/org/jboss/remoting/transport/bisocket ...
Ron Sigal
ron_sigal at yahoo.com
Fri May 18 22:35:20 EDT 2007
User: rsigal
Date: 07/05/18 22:35:20
Modified: src/main/org/jboss/remoting/transport/bisocket Tag:
remoting_2_x BisocketClientInvoker.java
Log:
JBREM-735: PingTimerTask.run() will retry to send ping maxRetries times.
Revision Changes Path
No revision
No revision
1.1.2.16 +23 -6 JBossRemoting/src/main/org/jboss/remoting/transport/bisocket/BisocketClientInvoker.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: BisocketClientInvoker.java
===================================================================
RCS file: /cvsroot/jboss/JBossRemoting/src/main/org/jboss/remoting/transport/bisocket/BisocketClientInvoker.java,v
retrieving revision 1.1.2.15
retrieving revision 1.1.2.16
diff -u -b -r1.1.2.15 -r1.1.2.16
--- BisocketClientInvoker.java 11 Apr 2007 08:00:02 -0000 1.1.2.15
+++ BisocketClientInvoker.java 19 May 2007 02:35:20 -0000 1.1.2.16
@@ -464,11 +464,15 @@
{
private Object controlLock;
private OutputStream controlOutputStream;
+ private int maxRetries;
+ private Exception savedException;
+ private boolean pingSent;
PingTimerTask(BisocketClientInvoker invoker)
{
controlLock = invoker.controlLock;
controlOutputStream = invoker.controlOutputStream;
+ maxRetries = invoker.getMaxRetries();
}
public void shutDown()
@@ -482,17 +486,30 @@
public void run()
{
- synchronized (controlLock)
+ pingSent = false;
+
+ for (int i = 0; i < maxRetries; i++)
{
try
{
+ synchronized (controlLock)
+ {
controlOutputStream.write(Bisocket.PING);
}
- catch (IOException e)
+ pingSent = true;
+ break;
+ }
+ catch (Exception e)
{
- log.warn("Unable to send ping: shutting down PingTimerTask");
- shutDown();
+ savedException = e;
+ log.debug("Unable to send ping: trying again");
+ }
}
+
+ if (!pingSent)
+ {
+ log.warn("Unable to send ping: shutting down PingTimerTask", savedException);
+ shutDown();
}
}
}
More information about the jboss-cvs-commits
mailing list