Author: ShaunA
Date: 2013-03-26 11:55:37 -0400 (Tue, 26 Mar 2013)
New Revision: 6484
Modified:
remoting2/branches/2.5.4.SP4_JBREM-1316/src/main/org/jboss/remoting/transport/socket/MicroSocketClientInvoker.java
Log:
bz927097: JBREM-1316 applies to remoting used in EAP 5.2.0
Modified:
remoting2/branches/2.5.4.SP4_JBREM-1316/src/main/org/jboss/remoting/transport/socket/MicroSocketClientInvoker.java
===================================================================
---
remoting2/branches/2.5.4.SP4_JBREM-1316/src/main/org/jboss/remoting/transport/socket/MicroSocketClientInvoker.java 2013-03-26
13:47:11 UTC (rev 6483)
+++
remoting2/branches/2.5.4.SP4_JBREM-1316/src/main/org/jboss/remoting/transport/socket/MicroSocketClientInvoker.java 2013-03-26
15:55:37 UTC (rev 6484)
@@ -264,6 +264,11 @@
protected boolean generalizeSocketException;
protected int writeTimeout = -1;
+
+ /**
+ * Determines if transport() should attempt retries after versionedWrite() has
succeeded.
+ */
+ protected boolean idempotent;
// Constructors
---------------------------------------------------------------------------------
@@ -286,7 +291,8 @@
pool = null;
maxPoolSize = MAX_POOL_SIZE;
onewayConnectionTimeout = ONEWAY_CONNECTION_TIMEOUT_DEFAULT;
-
+ idempotent = true;
+
try
{
setup();
@@ -421,6 +427,16 @@
this.generalizeSocketException = generalizeSocketException;
}
+ public boolean isIdempotent()
+ {
+ return idempotent;
+ }
+
+ public void setIdempotent(boolean idempotent)
+ {
+ this.idempotent = idempotent;
+ }
+
public synchronized void disconnect()
{
log.debug(this + " disconnecting ...");
@@ -795,8 +811,9 @@
int retryCount = 0;
Exception sockEx = null;
+ boolean versionedWriteComplete = false;
- for (; retryCount < numberOfCallRetries; retryCount++)
+ for (; retryCount < numberOfCallRetries && (idempotent ||
!versionedWriteComplete); retryCount++)
{
if (trace) log.trace(this + " retryCount: " + retryCount);
if (0 < tempTimeout)
@@ -866,7 +883,8 @@
//TODO: -TME so this is messed up as now ties remoting versioning to using a
marshaller type
versionedWrite(outputStream, marshaller, invocation, version);
-
+ versionedWriteComplete = true;
+
if (serverSideOneway)
{
if(trace) { log.trace(this + " sent oneway invocation, so not waiting
for response, returning null"); }
@@ -958,7 +976,7 @@
}
// need to check if ran out of retries
- if (retryCount >= numberOfCallRetries)
+ if (retryCount >= numberOfCallRetries || (response == null &&
!idempotent && versionedWriteComplete))
{
handleException(sockEx, socketWrapper);
}
Show replies by date