当前页面:
在线文档首页 >
NetBeans API Javadoc (Current Development Version)
ViewHierarchyMutex (Editor Library) - NetBeans API Javadoc (Current Development Version)
org.netbeans.editor.view.spi
Class ViewHierarchyMutex
java.lang.Object
org.netbeans.editor.view.spi.ViewHierarchyMutex
public class ViewHierarchyMutex
- extends Object
Mutex that allows only one thread to proceed
other threads must wait until the ONE finishes.
The thread that "holds" the mutex (has the mutex access granted)
may reenter the mutex any number of times
(just increasing a "depth" of the locking).
If the priority thread enters waiting the mutex
then it will get serviced first once the current thread
leaves the mutex.
Method Summary |
Thread |
getLockThread()
Return the thread that holds a lock on this mutex. |
protected boolean |
isPriorityThread(Thread thread)
|
boolean |
isPriorityThreadWaiting()
This method is intended to be called by the non-priority thread
that acquired the mutex to check whether there
is no priority thread (such as AWT event-notification thread)
waiting. |
void |
lock()
|
void |
unlock()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ViewHierarchyMutex
public ViewHierarchyMutex()
lock
public void lock()
unlock
public void unlock()
isPriorityThreadWaiting
public boolean isPriorityThreadWaiting()
- This method is intended to be called by the non-priority thread
that acquired the mutex to check whether there
is no priority thread (such as AWT event-notification thread)
waiting.
If there is a priority thread waiting the non-priority thread
should attempt to stop its work as soon as possible and unlock
the hierarchy.
The method must *not* be called without first locking the hierarchy
(it is intentionally not synchronized).
isPriorityThread
protected boolean isPriorityThread(Thread thread)
getLockThread
public final Thread getLockThread()
- Return the thread that holds a lock on this mutex.
This method is intended for diagnostic purposes only to determine
an intruder thread that entered the view hierarchy without obtaining
the lock first.
- Returns:
- thread that currently holds a lock on the hierarchy or null
if there is currently no thread holding a lock on the hierarchy.