Fixed JobLockService refresh callback code

- Fallout from ALF-4898
 - Unit tests perform and check callback counts


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@22966 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2010-10-07 14:54:27 +00:00
parent ee52855f62
commit 517569d27b
3 changed files with 60 additions and 19 deletions

View File

@@ -287,7 +287,7 @@ public class JobLockServiceImpl implements JobLockService
// First check the VM
if (shutdownListener.isVmShuttingDown())
{
callback.lockReleased();
callLockReleased(callback);
return;
}
boolean isActive = false;
@@ -324,13 +324,13 @@ public class JobLockServiceImpl implements JobLockService
try
{
releaseLock(lockToken, lockQName);
// The callback must be informed as we released the lock automatically
callLockReleased(callback);
}
catch (LockAcquisitionException e)
{
// The lock is already gone: job done
}
// The callback must be informed
callLockReleased(callback);
}
else
{
@@ -338,6 +338,8 @@ public class JobLockServiceImpl implements JobLockService
{
refreshLock(lockToken, lockQName, timeToLive);
// Success. The callback does not need to know.
// NB: Reschedule this task
scheduler.schedule(this, delay, TimeUnit.MILLISECONDS);
}
catch (LockAcquisitionException e)
{