Overview  Package   Class  Use  Tree  Deprecated  Index  Help 
PREV CLASS   NEXT CLASS FRAMES    NO FRAMES    All Classes
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD

org.alfresco.repo.lock
Interface JobLockService.JobLockRefreshCallback
Enclosing class:
JobLockService

@org.alfresco.api.AlfrescoPublicApi
public static interface JobLockService.JobLockRefreshCallback
Interface for implementations that need a timed callback in order to refresh the lock.

This callback is designed for processes that need to lock and wait for external processes to complete; keeping a local thread to refresh the lock is possible but it is more efficient for the thread pool and timer mechanisms to be shared.

The callback implementations must be thread-safe and should be independent of other callbacks i.e. the simplest and safest is to use an anonymous inner class for the implementation.

IMPORTANT: Do not block the calls to this interface - other callbacks might be held up producing inconsistent behaviour. Failure to observe this will lead to warnings and lock termination i.e. the service implementation will force early termination of the lock and will discard the callback.

Since:
3.4.0b
Author:
Derek Hulley

Method Summary
boolean
isActive()
          Timed callback from the service to determine if the lock is still required.
void
lockReleased()
          Callback received when the lock refresh has failed.
Method Detail
isActive
boolean isActive()
Timed callback from the service to determine if the lock is still required.

IMPORTANT: Do not block calls to this method for any reason and do not perform any non-trivial determination of state i.e. have the answer to this method immediately available at all times. Failure to observe this will lead to warnings and lock termination.

The original lock token is not provided in the callback; this is to prevent implementations from attempting to link the lock token back to the specific callback instances.

Returns:
Return true if the task associated with the callback is still active i.e. it still needs the lock associated with the callback or false if the lock is no longer required.
Since:
3.4.0b

lockReleased
void lockReleased()
Callback received when the lock refresh has failed. Implementations should immediately and gracefully terminate their associated processes as the associated lock is no longer valid, which is a direct indication that a competing process has taken and is using the required lock or that the process has already completed and released the lock.

As a convenenience, this method is called when a VM shutdown is detected as well; the associated lock is not refreshed and this method is called to instruct the locking process to terminate.

This method is also called if the initiating process is self-terminated i.e. if the originating process releases the lock itself. This method is not called if the process is not active.

Since:
3.4.0b

Overview  Package   Class  Use  Tree  Deprecated  Index  Help 
PREV CLASS   NEXT CLASS FRAMES    NO FRAMES    All Classes
SUMMARY: NESTED | FIELD | CONSTR | METHOD DETAIL: FIELD | CONSTR | METHOD

Copyright © 2005–2018 Alfresco Software. All rights reserved.

Java API documentation generated with DocFlex/Javadoc 1.6.1 using JavadocPro template set.