Skip navigation links

Oracle® Coherence Java API Reference
Release 3.7.0.0

E18683-01


com.tangosol.util
Class WrapperReentrantGate

java.lang.Object
  extended by com.tangosol.util.WrapperReentrantGate

All Implemented Interfaces:
Gate

public class WrapperReentrantGate
extends java.lang.Object
implements Gate

A Gate implementation that allows for 2^31 reentrant calls by a single thread.

Since:
Coherence 3.7
Author:
coh 2010.10.14

Constructor Summary
WrapperReentrantGate()
          Default constructor.
WrapperReentrantGate(Gate gate)
          Construct a WrapperReentrantGate around the specified underlying gate.

 

Method Summary
 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.
 boolean isClosedByCurrentThread()
          Determine if the current thread has closed the gate.
 boolean isEnteredByCurrentThread()
          Determines if the current thread has entered the gate and not yet exited.
 void open()
          Re-open the closed gate.

 

Constructor Detail

WrapperReentrantGate

public WrapperReentrantGate()
Default constructor.

WrapperReentrantGate

public WrapperReentrantGate(Gate gate)
Construct a WrapperReentrantGate around the specified underlying gate.
Parameters:
gate - a Gate to be wrapped

Method Detail

close

public boolean close(long cMillis)
Close the gate. A thread uses this method to obtain exclusive access to the resource represented by the gate. Each invocation of this method must ultimately have a corresponding invocation of the Gate.open() method.
Specified by:
close in interface Gate
Parameters:
cMillis - maximum number of milliseconds to wait; pass -1 to wait indefinitely or 0 to return immediately
Returns:
true iff entry into the gate was successfully closed by the calling thread and no other threads remain in the gate

open

public void open()
Re-open the closed gate. This method can be called only if the calling thread successfully closed the gate.
Specified by:
open in interface Gate

enter

public boolean enter(long cMillis)
Enter the gate. A thread uses this method to obtain non-exclusive access to the resource represented by the gate. Each invocation of this method must ultimately have a corresponding invocation of the Gate.exit() method.
Specified by:
enter in interface Gate
Parameters:
cMillis - maximum number of milliseconds to wait; pass -1 to wait indefinitely or 0 to return immediately
Returns:
true iff the calling thread successfully entered the gate

exit

public void exit()
Exit the gate. A thread must invoke this method corresponding to each invocation of the Gate.enter(long) method.
Specified by:
exit in interface Gate

isClosedByCurrentThread

public boolean isClosedByCurrentThread()
Determine if the current thread has closed the gate.
Specified by:
isClosedByCurrentThread in interface Gate
Returns:
true iff the gate was closed by the calling thread

isEnteredByCurrentThread

public boolean isEnteredByCurrentThread()
Determines if the current thread has entered the gate and not yet exited.
Specified by:
isEnteredByCurrentThread in interface Gate
Returns:
true if the current thread has entered the gate

isClosed

public boolean isClosed()
Determine if any thread has closed the gate.
Specified by:
isClosed in interface Gate
Returns:
true iff the gate has been closed by any thread

Skip navigation links

Oracle® Coherence Java API Reference
Release 3.7.0.0

E18683-01


Copyright © 2000, 2011, Oracle and/or its affiliates. All rights reserved.