Package org.eclipse.core.runtime.jobs
Class LockListener
- java.lang.Object
-
- org.eclipse.core.runtime.jobs.LockListener
-
public class LockListener extends Object
A lock listener is notified whenever a thread is about to wait on a lock, and when a thread is about to release a lock.This class is for internal use by the platform-related plug-ins. Clients outside of the base platform should not reference or subclass this class.
- Since:
- 3.0
- See Also:
IJobManager.setLockListener(LockListener)
-
-
Constructor Summary
Constructors Constructor Description LockListener()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaboutToRelease()Notification that a thread is about to release a lock.booleanaboutToWait(Thread lockOwner)Notification that a thread is about to block on an attempt to acquire a lock.booleancanBlock()Returns if it is safe for the calling thread to block while waiting to obtain a lock.protected booleanisLockOwnerThread()Returns whether this thread currently owns any locks
-
-
-
Method Detail
-
aboutToWait
public boolean aboutToWait(Thread lockOwner)
Notification that a thread is about to block on an attempt to acquire a lock. Returns whether the thread should be granted immediate access to the lock.This default implementation always returns
false. Subclasses may override.- Parameters:
lockOwner- the thread that currently owns the lock this thread is waiting for, ornullif unknown.- Returns:
trueif the thread should be granted immediate access, andfalseif it should wait for the lock to be available
-
aboutToRelease
public void aboutToRelease()
Notification that a thread is about to release a lock.This default implementation does nothing. Subclasses may override.
-
canBlock
public boolean canBlock()
Returns if it is safe for the calling thread to block while waiting to obtain a lock. When blocking in the calling thread is not safe, the caller will ensure that the thread is kept alive and responsive to cancellation while waiting.- Returns:
trueif this thread can block, andfalseotherwise.- Since:
- org.eclipse.core.jobs 3.5
-
isLockOwnerThread
protected final boolean isLockOwnerThread()
Returns whether this thread currently owns any locks- Returns:
trueif this thread owns any locks, andfalseotherwise.
-
-