Author: chris.laprun(a)jboss.com
Date: 2007-09-24 20:21:20 -0400 (Mon, 24 Sep 2007)
New Revision: 8485
Modified:
trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/InvocationHandler.java
Log:
- JBPORTAL-1717: Improved logic.
Modified: trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/InvocationHandler.java
===================================================================
--- trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/InvocationHandler.java 2007-09-25
00:20:27 UTC (rev 8484)
+++ trunk/wsrp/src/main/org/jboss/portal/wsrp/consumer/InvocationHandler.java 2007-09-25
00:21:20 UTC (rev 8485)
@@ -92,9 +92,9 @@
Object response = null;
// as long as we don't get a non-null response and we're allowed to try
again, try to perform the request
- while (response == null && retryCount < MAXIMUM_RETRY_NUMBER)
+ while (response == null && retryCount++ <= MAXIMUM_RETRY_NUMBER)
{
- log.debug("performRequest: " + (retryCount + 1) + " attempt(s)
out of " + MAXIMUM_RETRY_NUMBER + " possible");
+ log.debug("performRequest: " + retryCount + " attempt(s) out of
" + MAXIMUM_RETRY_NUMBER + " possible");
SessionHandler sessionHandler = consumer.getSessionHandler();
// prepare everything for the request
@@ -128,28 +128,19 @@
{
return errorResponse;
}
- else
- {
- retryCount++;
- }
}
finally
{
- if (response == null)
- {
- retryCount++;
- }
-
// we're done: reset currently held information
sessionHandler.resetCurrentlyHeldInformation();
}
}
- if (retryCount == MAXIMUM_RETRY_NUMBER)
+ if (retryCount >= MAXIMUM_RETRY_NUMBER)
{
- return new ErrorResponse("Tried to perform request " +
MAXIMUM_RETRY_NUMBER
+ return new ErrorResponse(new RuntimeException("Tried to perform request
" + MAXIMUM_RETRY_NUMBER
+ " times before giving up. This usually happens if an error in the WS
stack prevented the messages to be " +
- "properly transmitted. Look at server.log for clues as to what
happened...");
+ "properly transmitted. Look at server.log for clues as to what
happened..."));
}
log.debug("performRequest finished. Response is " + (response != null ?
response.getClass().getName() : null));