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
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.
Callback received when the lock refresh has failed.
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
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.
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
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