|
Oracle® Fusion Middleware Java API Reference for Oracle Coherence 12c (12.1.3.0.0) E47890-01 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Gate
The Gate interface acts as an abstraction between the 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.
Method Summary | |
---|---|
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. |
Method Detail |
---|
boolean close(long cMillis)
open()
method.cMillis
- maximum number of milliseconds to wait; pass -1 to wait indefinitely or 0 to return immediatelyvoid open()
java.lang.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.java.lang.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()
|
Oracle® Fusion Middleware Java API Reference for Oracle Coherence 12c (12.1.3.0.0) E47890-01 |
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |