|
org.netbeans.modules.editor.util/1 1.17 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.netbeans.lib.editor.util.PriorityMutex
public class PriorityMutex
Mutex that allows only one thread to proceed
other threads must wait until that one finishes.
The thread that "holds" the mutex (has the mutex access granted)
may reenter the mutex arbitrary number of times
(just increasing a "depth" of the locking).
If the priority thread enters waiting on the mutex
then it will get serviced first once the current thread
leaves the mutex.
Constructor Summary | |
---|---|
PriorityMutex()
|
Method Summary | |
---|---|
Thread |
getLockThread()
Return a thread that acquired this mutex. |
protected boolean |
isPriorityThread()
Return true if the current thread that is entering this method is a priority thread and should be allowed to enter as soon as possible. |
boolean |
isPriorityThreadWaiting()
Can be called by the thread that acquired the mutex to check whether there is a priority thread (such as AWT event-notification thread) waiting. |
void |
lock()
Acquire the ownership of the mutex. |
void |
unlock()
Release the ownership of the mutex. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PriorityMutex()
Method Detail |
---|
public void lock()
The following pattern should always be used:
mutex.lock(); try { ... } finally { mutex.unlock(); }
public void unlock()
lock()
public boolean isPriorityThreadWaiting()
public final Thread getLockThread()
null
if there is currently no thread holding that acquired this mutex.protected boolean isPriorityThread()
The default implementation assumes that
SwingUtilities.isEventDispatchThread()
is a priority thread.
|
org.netbeans.modules.editor.util/1 1.17 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |