Package com.tangosol.net
Class LoadBalancer.Queue
- java.lang.Object
-
- com.tangosol.util.Base
-
- com.tangosol.net.LoadBalancer.Queue
-
- Enclosing class:
- LoadBalancer
public static class LoadBalancer.Queue extends Base
A Queue is used to effeciently queue up items for daemon threads to work on.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.tangosol.util.Base
Base.LoggingWriter
-
-
Constructor Summary
Constructors Constructor Description Queue()
Construct a queue.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(Object o)
Add an object to the end of the queue.boolean
isEmpty()
Determine if the queue is empty.Object
remove()
Wait for and remove an item from the from of the queue.Object
removeNoWait()
Remove an item from the queue if the queue is not empty.int
size()
Determine the number of items in the queue.-
Methods inherited from class com.tangosol.util.Base
azzert, azzert, azzert, azzertFailed, breakLines, breakLines, capitalize, checkNotEmpty, checkNotNull, checkRange, computeSafeWaitTime, decimalValue, dup, dup, ensureBigDecimal, ensureClassLoader, ensureRuntimeException, ensureRuntimeException, equals, equalsDeep, err, err, err, err, err, escape, formatDateTime, getCallerStackFrame, getCommonMonitor, getCommonMonitor, getCommonMonitor, getContextClassLoader, getContextClassLoader, getDeepMessage, getErr, getLastSafeTimeMillis, getLog, getMaxDecDigits, getMaxHexDigits, getOriginalException, getOut, getProcessRandom, getRandom, getRandomBinary, getRandomBinary, getRandomString, getSafeTimeMillis, getStackFrame, getStackFrames, getStackTrace, getStackTrace, getStackTrace, getThreadFactory, getTimeZone, getUpTimeMillis, hashCode, hexValue, indentString, indentString, isDecimal, isHex, isLogEcho, isOctal, log, log, log, log, log, makeInteger, makeLong, makeThread, mergeArray, mergeBooleanArray, mergeByteArray, mergeCharArray, mergeDoubleArray, mergeFloatArray, mergeIntArray, mergeLongArray, mod, mod, octalValue, out, out, out, out, out, pad, parseBandwidth, parseBandwidth, parseDelimitedString, parseHex, parseHex, parseMemorySize, parseMemorySize, parsePercentage, parseTime, parseTime, parseTimeNanos, parseTimeNanos, printStackTrace, randomize, randomize, randomize, randomize, read, read, read, read, read, read, read, replace, setErr, setLog, setLogEcho, setOut, sleep, toBandwidthString, toBandwidthString, toCharEscape, toCrc, toCrc, toCrc, toCrc, toCrc, toDecString, toDelimitedString, toDelimitedString, toDelimitedString, toDelimitedString, toHex, toHex, toHexDump, toHexEscape, toHexEscape, toHexEscape, toHexEscape, toHexString, toMemorySizeString, toMemorySizeString, toQuotedCharEscape, toQuotedStringEscape, toSqlString, toString, toString, toStringEscape, toUnicodeEscape, trace, trace, trace, trace, trace, trace, trace, trace, trace, truncateString, truncateString, wait
-
-
-
-
Field Detail
-
m_list
protected List m_list
A list of items that have been queued.
-
-
Method Detail
-
size
public int size()
Determine the number of items in the queue.- Returns:
- the number of items in the queue
-
isEmpty
public boolean isEmpty()
Determine if the queue is empty.- Returns:
- true if the queue currently has no items in it
-
add
public void add(Object o)
Add an object to the end of the queue.- Parameters:
o
- the item to add to the end of the queue
-
remove
public Object remove() throws InterruptedException
Wait for and remove an item from the from of the queue.- Returns:
- an item from the queue
- Throws:
InterruptedException
- if the thread is interrupted while waiting for something to be added to the queue
-
removeNoWait
public Object removeNoWait()
Remove an item from the queue if the queue is not empty.- Returns:
- an item if the queue is not empty, otherwise null
-
-