public interface Gate
ThreadGate implementation that precedes JDK 1.5 locks and the ThreadGateLite that uses the ReentrantReadWriteLock.
Note: the Gate's method names have been chosen to be backwards compatible with the legacy ThreadGate implementation.
| Modifier and Type | Method and Description | 
|---|---|
boolean | 
barEntry(long cMillis)
Bar entry to the thread gate by other threads, but do not wait for the gate to close. 
 | 
boolean | 
close(long cMillis)
Close the gate. 
 | 
boolean | 
enter(long cMillis)
Enter the gate. 
 | 
void | 
exit()
Exit the gate. 
 | 
boolean | 
isClosed()
Determine if any thread has closed the gate and continues to hold exclusive access. 
 | 
boolean | 
isClosedByCurrentThread()
Determine if the calling thread has closed the gate and continues to hold exclusive access. 
 | 
boolean | 
isEnteredByCurrentThread()
Determines if the current thread has entered the gate and not yet exited. 
 | 
void | 
open()
Re-open the closed gate. 
 | 
boolean close(long cMillis)
open() method.cMillis - maximum number of milliseconds to wait; pass -1 to wait indefinitely or 0 to return immediatelyvoid open()
IllegalMonitorStateException - if the gate is not closed or was closed by a different threadboolean enter(long cMillis)
exit() method.cMillis - maximum number of milliseconds to wait; pass -1 to wait indefinitely or 0 to return immediatelyvoid exit()
enter(long) method.IllegalMonitorStateException - if the gate is not entered by the current threadboolean barEntry(long cMillis)
Each successful invocation of this method must ultimately have a corresponding invocation of the open method (assuming the thread gate is not destroyed) even if the calling thread does not subsequently close the gate.
 gate.barEntry(-1);
 try
     {
     // processing that does not require the gate to be closed
     // ...
     }
 finally
     {
     gate.close(-1);
     try
         {
         // processing that does require the gate to be closed
         // ...
         }
     finally
         {
         gate.open(); // matches gate.close()
         }
     gate.open(); // matches gate.barEntry()
     }
 
cMillis - maximum number of milliseconds to wait; pass -1 for forever or 0 for no waitboolean isClosedByCurrentThread()
boolean isEnteredByCurrentThread()
boolean isClosed()