Correct debug messages for retry count

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@22934 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2010-10-07 02:20:43 +00:00
parent d4e98a7161
commit 0b8316dc4c

View File

@@ -463,9 +463,10 @@ public class JobLockServiceImpl implements JobLockService
*/
private int doWithRetry(RetryingTransactionCallback<? extends Object> callback, long retryWait, int retryCount)
{
int maxAttempts = retryCount > 0 ? retryCount : 1;
int lockAttempt = 0;
LockAcquisitionException lastException = null;
while (lockAttempt++ <= retryCount) // lockAttempt incremented after check i.e. 1 for first iteration
while (++lockAttempt <= maxAttempts) // lockAttempt incremented before check i.e. 1 for first check
{
try
{
@@ -478,10 +479,10 @@ public class JobLockServiceImpl implements JobLockService
{
if (logger.isDebugEnabled())
{
logger.debug("Lock attempt " + lockAttempt + " of " + retryCount + " failed: " + e.getMessage());
logger.debug("Lock attempt " + lockAttempt + " of " + maxAttempts + " failed: " + e.getMessage());
}
lastException = e;
if (lockAttempt >= retryCount)
if (lockAttempt >= maxAttempts)
{
// Avoid an unnecessary wait if this is the last attempt
break;