JXTA

net.jxta.impl.pipe
Class NonBlockingWireOutputPipe

java.lang.Object
  extended by net.jxta.impl.pipe.NonBlockingWireOutputPipe
All Implemented Interfaces:
OutputPipe

 class NonBlockingWireOutputPipe
extends Object
implements OutputPipe

An implementation of Ouput Pipe which sends messages on the pipe asynchronously. The send() method for this implementation will never block.


Constructor Summary
NonBlockingWireOutputPipe(PeerGroup group, WirePipe wire, PipeAdvertisement pAdv, Set<? extends ID> peers)
          Create a new output pipe
 
Method Summary
 void close()
          close the pipe
 PipeAdvertisement getAdvertisement()
          Gets the pipe advertisement
 String getName()
          Gets the pipe name
 ID getPipeID()
          Gets the pipe id
 String getType()
          Gets the pipe type
 boolean isClosed()
          Returns true if this pipe is closed and no longer accepting messages to be sent.
 boolean send(Message message)
          Send a message through the pipe

WARNING: The message object used when sending a pipe message should not be reused or modified after the OutputPipe.send(Message) call is made.

(package private)  boolean sendUnModified(Message msg, WireHeader header)
          Sends a message unaltered
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NonBlockingWireOutputPipe

public NonBlockingWireOutputPipe(PeerGroup group,
                                 WirePipe wire,
                                 PipeAdvertisement pAdv,
                                 Set<? extends ID> peers)
Create a new output pipe

Parameters:
group - The peergroup we are working in.
wire - The propagate pipe service.
pAdv - advertisement for the pipe we are supporting.
peers - the set of peers we allow this pipe to be bound to.
Method Detail

close

public void close()
close the pipe

Specified by:
close in interface OutputPipe

isClosed

public boolean isClosed()
Returns true if this pipe is closed and no longer accepting messages to be sent. The pipe should be discarded.

Specified by:
isClosed in interface OutputPipe
Returns:
true if this pipe is closed, otherwise false.

getType

public final String getType()
Gets the pipe type

Specified by:
getType in interface OutputPipe
Returns:
The type

getPipeID

public final ID getPipeID()
Gets the pipe id

Specified by:
getPipeID in interface OutputPipe
Returns:
The type

getName

public final String getName()
Gets the pipe name

Specified by:
getName in interface OutputPipe
Returns:
The name

getAdvertisement

public final PipeAdvertisement getAdvertisement()
Gets the pipe advertisement

Specified by:
getAdvertisement in interface OutputPipe
Returns:
The advertisement

send

public boolean send(Message message)
             throws IOException
Send a message through the pipe

WARNING: The message object used when sending a pipe message should not be reused or modified after the OutputPipe.send(Message) call is made. Concurrent modification of messages will produce unexpected result.

Specified by:
send in interface OutputPipe
Parameters:
message - is the PipeMessage to be sent.
Returns:
boolean true if the message has been sent otherwise false. false. is commonly returned for non-error related congestion, meaning that you should be able to send the message after waiting some amount of time.
Throws:
IOException - output pipe error

sendUnModified

boolean sendUnModified(Message msg,
                       WireHeader header)
                 throws IOException
Sends a message unaltered

Parameters:
msg - the message to send
header - message header
Returns:
true if successful
Throws:
IOException - if an io error occurs

JXSE