|
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 |
java.lang.Object
com.tangosol.util.ThreadGateLite
public final class ThreadGateLite
ThreadGateLite is a Gate implementation built around the ReentrantReadWriteLock
.
Nested Class Summary | |
---|---|
protected static class |
ThreadGateLite.Bar Bar represents the state of the bars placed on this gate. |
Field Summary | |
---|---|
protected static java.util.concurrent.atomic.AtomicReferenceFieldUpdater |
UPDATER_BAR AtomicUpdater for the internal Bar member. |
Constructor Summary | |
---|---|
ThreadGateLite() |
Method Summary | |
---|---|
protected long |
adjustWaitTime(long cMillis, long ldtStart) Calculate the time remaining from the total time allotted for an operation. |
boolean |
barEntry(long cMillis) Bar entry to the thread gate by other threads, but do not wait for the gate to close. |
protected boolean |
casBar(ThreadGateLite.Bar barExpect, ThreadGateLite.Bar barNew) Atomically set the bar in this gate to the new Bar object iff the current value of the bar is the expected one. |
boolean |
close(long cMillis) Close the gate. |
boolean |
enter(long cMillis) Enter the gate. |
void |
exit() Exit the gate. |
protected ThreadGateLite.Bar |
getBar() Get this gate's bar. |
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 void |
setBar(ThreadGateLite.Bar bar) Set this gate's bar. |
java.lang.String |
toString() |
protected long |
waitForOpen(ThreadGateLite.Bar bar, long cMillis) Wait for notification that the bar has been lifted completely, i.e. all re-entrant barEntry calls were matched. |
Field Detail |
---|
protected static final java.util.concurrent.atomic.AtomicReferenceFieldUpdater UPDATER_BAR
Constructor Detail |
---|
public ThreadGateLite()
Method Detail |
---|
public boolean close(long cMillis)
Gate.open()
method.close
in interface Gate
cMillis
- maximum number of milliseconds to wait; pass -1 to wait indefinitely or 0 to return immediatelypublic boolean enter(long cMillis)
Gate.exit()
method.enter
in interface Gate
cMillis
- maximum number of milliseconds to wait; pass -1 to wait indefinitely or 0 to return immediatelypublic void exit()
Gate.enter(long)
method.exit
in interface Gate
public boolean isClosedByCurrentThread()
isClosedByCurrentThread
in interface Gate
public boolean isClosed()
isClosed
in interface Gate
public boolean isEnteredByCurrentThread()
isEnteredByCurrentThread
in interface Gate
public void open()
open
in interface Gate
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 Gate
cMillis
- maximum number of milliseconds to wait; pass -1 for forever or 0 for no waitpublic java.lang.String toString()
protected long waitForOpen(ThreadGateLite.Bar bar, long cMillis)
open()
.bar
- the bar that needs to be lifted for this thread to proceed (cannot be null)cMillis
- time to wait or -1 for unlimited waitprotected long adjustWaitTime(long cMillis, long ldtStart)
cMillis
- the total time allotted for an operationldtStart
- the start of the time interval that have passedprotected ThreadGateLite.Bar getBar()
protected void setBar(ThreadGateLite.Bar bar)
bar
- the new Bar valueprotected boolean casBar(ThreadGateLite.Bar barExpect, ThreadGateLite.Bar barNew)
barExpect
- the Bar expected to be the current valuebarNew
- the new Bar value
|
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 |