|
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.
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. |
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.
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.
|