Modifier and Type | Field and Description |
---|---|
protected com.oracle.common.util.Sentry |
f_exitSentry
Sentry to return from
enter(long) that will exit() when the sentry is closed. |
Constructor and Description |
---|
WrapperReentrantGate()
Default constructor.
|
WrapperReentrantGate(Gate<Void> gate)
Construct a WrapperReentrantGate around the specified underlying gate.
|
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.
|
com.oracle.common.util.Sentry |
close()
Wait to close the gate.
|
boolean |
close(long cMillis)
Close the gate.
|
com.oracle.common.util.Sentry |
enter()
Wait to enter 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.
|
protected final com.oracle.common.util.Sentry f_exitSentry
enter(long)
that will exit()
when the sentry is closed.public boolean close(long cMillis)
Gate.open()
method.close
in interface com.oracle.common.util.Gate<Void>
cMillis
- maximum number of milliseconds to wait;
pass -1 to wait indefinitely or 0 to return immediatelypublic void open()
open
in interface com.oracle.common.util.Gate<Void>
public boolean enter(long cMillis)
Gate.exit()
method.enter
in interface com.oracle.common.util.Gate<Void>
cMillis
- maximum number of milliseconds to wait;
pass -1 to wait indefinitely or 0 to return immediatelypublic com.oracle.common.util.Sentry close()
com.oracle.common.util.Gate
close
in interface com.oracle.common.util.Gate<Void>
Gate.open()
.public com.oracle.common.util.Sentry enter()
com.oracle.common.util.Gate
enter
in interface com.oracle.common.util.Gate<Void>
Gate.exit()
.public void exit()
Gate.enter()
method.exit
in interface com.oracle.common.util.Gate<Void>
public boolean 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()
}
barEntry
in interface com.oracle.common.util.Gate<Void>
cMillis
- maximum number of milliseconds to wait;
pass -1 for forever or 0 for no waitpublic boolean isClosedByCurrentThread()
isClosedByCurrentThread
in interface com.oracle.common.util.Gate<Void>
public boolean isEnteredByCurrentThread()
isEnteredByCurrentThread
in interface com.oracle.common.util.Gate<Void>
public boolean isClosed()
isClosed
in interface com.oracle.common.util.Gate<Void>