Gate Interface | 
Namespace: Tangosol.Util
public interface Gate
The Gate type exposes the following members.
| Name | Description | |
|---|---|---|
| IsClosedByCurrentThread | 
            Determines if the current thread has Closed the Gate but not yet
            Opened the Gate.
              | |
| IsEnteredByCurrentThread | 
            Determines if the current thread has Entered, but not yet Exited 
            the Gate.
              | 
| Name | Description | |
|---|---|---|
| Close | 
            Tries to acquire the exclusive lock, the attempt is
            willing to wait up the specified millis or -1 to wait
            infinite.
              | |
| Enter | 
            Tries to acquire the non-exclusive lock, the attempt is
            willing to wait up the specified millis or -1 to wait
            infinite.
              | |
| Exit | 
            Releases the non-exclusive lock. If the non-exclusive lock has 
            no more matching Enter(millis) from any thread the exclusive 
            lock is released so that threads wanting to Close the Gate
            can proceed.
              | |
| Open | 
            Releases the exclusive lock. If the exclusive lock has 
            no more matching Close(millis) the exclusive lock is released.
            Any Threads waiting to Enter(millis) or Close(millis) will
            continue executing.
            
            If the thread currently is also holding the non-exclusive
            lock, the thread will immediately Enter the lock. The thread
            will have to match all calls to Enter(millis) with the 
            corresponding count of Exit().
              | 
Each call to Enter requires a corresponding call to Exit. For example, the following would ensure proper clean-up using a Gate:
            gate.Enter();
            try
            {
                ...
            }
            finally
            {
                gate.Exit();
            }
            Similarly, each call to Close should be matched with a call to Open:
            gate.Close();
            try
            {
                ...
            }
            finally
            {
                gate.Open();
            }
            The Enter/Exit calls can be nested; the same thread can invoke Enter multiple times as long as Exit is invoked a corresponding number of times. The Close/Open calls work in the same manner. Lastly, the thread that closes the gate may continue to Enter/Exit the gate even when it is closed since that thread has exclusive control of the gate.