mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
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:
@@ -463,9 +463,10 @@ public class JobLockServiceImpl implements JobLockService
|
|||||||
*/
|
*/
|
||||||
private int doWithRetry(RetryingTransactionCallback<? extends Object> callback, long retryWait, int retryCount)
|
private int doWithRetry(RetryingTransactionCallback<? extends Object> callback, long retryWait, int retryCount)
|
||||||
{
|
{
|
||||||
|
int maxAttempts = retryCount > 0 ? retryCount : 1;
|
||||||
int lockAttempt = 0;
|
int lockAttempt = 0;
|
||||||
LockAcquisitionException lastException = null;
|
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
|
try
|
||||||
{
|
{
|
||||||
@@ -478,10 +479,10 @@ public class JobLockServiceImpl implements JobLockService
|
|||||||
{
|
{
|
||||||
if (logger.isDebugEnabled())
|
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;
|
lastException = e;
|
||||||
if (lockAttempt >= retryCount)
|
if (lockAttempt >= maxAttempts)
|
||||||
{
|
{
|
||||||
// Avoid an unnecessary wait if this is the last attempt
|
// Avoid an unnecessary wait if this is the last attempt
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user