Author: ron.sigal(a)jboss.com
Date: 2009-09-02 13:17:29 -0400 (Wed, 02 Sep 2009)
New Revision: 5428
Modified:
remoting2/branches/2.2/src/main/org/jboss/remoting/transport/socket/MicroSocketClientInvoker.java
Log:
JBREM-1146: Extended generalized SocketException facility with regular expression.
Modified:
remoting2/branches/2.2/src/main/org/jboss/remoting/transport/socket/MicroSocketClientInvoker.java
===================================================================
---
remoting2/branches/2.2/src/main/org/jboss/remoting/transport/socket/MicroSocketClientInvoker.java 2009-09-02
01:17:16 UTC (rev 5427)
+++
remoting2/branches/2.2/src/main/org/jboss/remoting/transport/socket/MicroSocketClientInvoker.java 2009-09-02
17:17:29 UTC (rev 5428)
@@ -29,6 +29,7 @@
import java.util.LinkedList;
import java.util.Map;
import java.util.Properties;
+import java.util.regex.Pattern;
//import java.util.concurrent.Semaphore;
//import java.util.concurrent.TimeUnit;
import EDU.oswego.cs.dl.util.concurrent.Semaphore;
@@ -117,6 +118,9 @@
public static long serializeTime = 0;
public static long deserializeTime = 0;
+ private static final String patternString =
"^.*(?:connection.*reset|connection.*closed|broken.*pipe).*$";
+ private static final Pattern RETRIABLE_ERROR_MESSAGE = Pattern.compile(patternString,
Pattern.CASE_INSENSITIVE);
+
/**
* Close all sockets in a specific pool.
*/
@@ -220,7 +224,7 @@
protected boolean wrapInterruptedException = false;
/**
- * If true, an IOException with message "Connection reset by peer: socket write
error" will
+ * If true, an IOException with message such as "Connection reset by peer: socket
write error" will
* be treated like a SocketException.
*/
protected boolean generalizeSocketException;
@@ -681,7 +685,7 @@
}
catch (IOException e)
{
- if (isGeneralizeSocketException() &&
e.getMessage().startsWith("Connection reset"))
+ if (isGeneralizeSocketException() &&
RETRIABLE_ERROR_MESSAGE.matcher(e.getMessage()).matches())
{
handleSocketException(e, socketWrapper, semaphore, retryCount);
sockEx = new SocketException(e.getMessage());
Show replies by date