T - public class Fifo<T>
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static boolean |
DEBUG_ENABLE |
static int |
DEFAULT_MAX_SIZE
'10000' The default maximum size of this FIFO
|
protected int |
maxSize |
static int |
TIMEOUT_NO_WAIT
The constant of timeout, which means don't wait if FIFO is empty
|
static int |
TIMEOUT_WAIT_FOREVER
The constant of timeout, which means wait for ever if FIFO is empty
|
| Constructor and Description |
|---|
Fifo() |
| Modifier and Type | Method and Description |
|---|---|
void |
clear() |
void |
in(T object)
Put an object into the FIFO if the FIFO is not full.
|
T |
out(int timeout)
Get an object from the FIFO if it is not empty.
If the FIFO is empty, this method may throw an Exception or wait for a certain-time or wait for ever, which depends on the timeout value. |
void |
setMaxSize(int maxSize)
Set the maximum size of this FIFO, the default maximum size is
DEFAULT_MAX_SIZE |
public static final int DEFAULT_MAX_SIZE
public static final int TIMEOUT_NO_WAIT
public static final int TIMEOUT_WAIT_FOREVER
protected int maxSize
public static boolean DEBUG_ENABLE
public void in(T object) throws SAFSException
object - T, the object to put into the FIFOSAFSException - if the FIFO is fullpublic T out(int timeout) throws SAFSException
timeout - int, the time to wait for FIFO is not empty, in millisecondsTIMEOUT_NO_WAIT, this method will throw Exception if FIFO is empty.
it can be TIMEOUT_WAIT_FOREVER, this method will wait for ever until the FIFO is not empty.SAFSExceptionpublic void setMaxSize(int maxSize)
DEFAULT_MAX_SIZEmaxSize - public void clear()
Copyright © SAS Institute. All Rights Reserved.