@ThreadSafe
public class GateKeeper
extends java.lang.Object
Constructor and Description |
---|
GateKeeper() |
Modifier and Type | Method and Description |
---|---|
boolean |
awaitDrained(long timeout,
java.util.concurrent.TimeUnit unit)
Waits for the server to finish outstanding requests, giving up if the timeout is reached.
|
void |
close()
Closes the gate to disallow incoming requests to be processed.
|
int |
getNumOutstandingRequests()
Returns the number of outstanding requests.
|
boolean |
isOpen()
Returns if the gate is open or not.
|
void |
letIn()
Lets a new request in to process it in the server if the gate is open.
|
void |
letOut()
Lets a processed request out.
|
void |
open()
Opens the gate to allow incoming requests to be processed.
|
public void open()
public void close()
public boolean isOpen()
public int getNumOutstandingRequests()
public boolean awaitDrained(long timeout, java.util.concurrent.TimeUnit unit)
timeout
- the maximum time to waitunit
- the time unit of the timeout argumentpublic void letIn()
public void letOut()