|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.rabbitmq.utility.BlockingCell<T>
public class BlockingCell<T>
Simple one-shot IPC mechanism. Essentially a one-place buffer that cannot be emptied once filled.
| Constructor Summary | |
|---|---|
BlockingCell()
Instantiate a new BlockingCell waiting for a value of the specified type. |
|
| Method Summary | |
|---|---|
T |
get()
Wait for a value, and when one arrives, return it (without clearing it). |
T |
get(long timeout)
Wait for a value, and when one arrives, return it (without clearing it). |
void |
set(T newValue)
Store a value in this BlockingCell, throwing AssertionError if the cell already has a value. |
boolean |
setIfUnset(T newValue)
Store a value in this BlockingCell if it doesn't already have a value. |
T |
uninterruptibleGet()
As get(), but catches and ignores InterruptedException, retrying until a value appears. |
T |
uninterruptibleGet(int timeout)
As get(long timeout), but catches and ignores InterruptedException, retrying until a value appears or until specified timeout is reached. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public BlockingCell()
| Method Detail |
|---|
public T get()
throws java.lang.InterruptedException
java.lang.InterruptedException - if this thread is interrupted
public T get(long timeout)
throws java.lang.InterruptedException,
java.util.concurrent.TimeoutException
timeout - timeout in milliseconds. -1 effectively means infinity
java.lang.InterruptedException - if this thread is interrupted
java.util.concurrent.TimeoutExceptionpublic T uninterruptibleGet()
public T uninterruptibleGet(int timeout)
throws java.util.concurrent.TimeoutException
timeout - timeout in milliseconds. -1 means 'infinity': never time out
java.util.concurrent.TimeoutExceptionpublic void set(T newValue)
newValue - the new value to storepublic boolean setIfUnset(T newValue)
newValue - the new value to store
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||