|
Project JXTA | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.jxta.impl.pipe.NonBlockingWireOutputPipe
class NonBlockingWireOutputPipe
An implementation of Ouput Pipe which sends messages on the pipe
asynchronously. The send() method for this implementation will
never block.
| Nested Class Summary | |
|---|---|
(package private) static class |
NonBlockingWireOutputPipe.workerState
Tracks the state of our worker thread. |
| Constructor Summary | |
|---|---|
NonBlockingWireOutputPipe(PeerGroup g,
WirePipe wire,
PipeAdvertisement pAdv,
Set peers)
Create a new output pipe |
|
| Method Summary | |
|---|---|
void |
close()
|
(package private) boolean |
enqueue(Message message)
Push a message on the send queue. |
protected void |
finalize()
|
PipeAdvertisement |
getAdvertisement()
|
String |
getName()
|
ID |
getPipeID()
|
String |
getType()
|
boolean |
isClosed()
|
void |
run()
Sends the messages. |
boolean |
send(Message message)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public NonBlockingWireOutputPipe(PeerGroup g,
WirePipe wire,
PipeAdvertisement pAdv,
Set peers)
g - peergroup we are working in.r - the piperesolver this pipe is bound to.pAdv - advertisement for the pipe we are supporting.destPeer - the peer this pipe is currently bound to.peers - the set of peers we allow this pipe to be bound to.| Method Detail |
|---|
protected void finalize()
finalize in class Objectpublic void close()
close in interface OutputPipepublic boolean isClosed()
isClosed in interface OutputPipepublic final String getType()
getType in interface OutputPipepublic final ID getPipeID()
getPipeID in interface OutputPipepublic final String getName()
getName in interface OutputPipepublic final PipeAdvertisement getAdvertisement()
getAdvertisement in interface OutputPipe
public boolean send(Message message)
throws IOException
send in interface OutputPipeIOException
boolean enqueue(Message message)
throws IOException
message - the message to enqueue.
IOException - for failures in queuing.public void run()
This method does a lot of things. It has several distinct states:
| STATE | Activity |
|---|---|
| SENDMESSAGES | Send messages until queue is closed and all messages have
been sent. Go to state CLOSED when done. If the messenger
becomes closed then go to ACQUIREMESSENGER. IDLEWORKERLINGER
millisecondsthen the worker thread will exit. It will only be
restarted if another message is eventually enqueued. |
| CLOSED | Exit the worker thread. |
run in interface Runnable
|
JXTA J2SE | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||