|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.ObjectthreadExamples.SingleMessageBox<V>
V - The type of "message" that may be put into
this SingleMessageBox.public class SingleMessageBox<V>
Implements a message box which can hold only a single
message at a time. Behavior is almost identical to that
of BatonMessageBox, but the implementation
is different: the put and get
methods are themselves synchronized, rather than using
a separate object on which to synchronize.
| Constructor Summary | |
|---|---|
SingleMessageBox()
Creates an empty SingleMessageBox. |
|
| Method Summary | |
|---|---|
V |
get()
Waits until there is a "message" of type V in this SingleMessageBox, then removes and returns it. |
void |
put(V nextValue)
Waits until this SingleMessageBox is empty, then puts the given "message" of type V into it. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SingleMessageBox()
| Method Detail |
|---|
public void put(V nextValue)
nextValue - The message to be added. Should not be
null.public V get()
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||