JXTA

net.jxta.impl.pipe
Class BlockingWireOutputPipe

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

public class BlockingWireOutputPipe
extends Object
implements OutputPipe

This Object is created when a call to PipeService.createOutputPipe(propgateAdv) with a Set containing a single PeerID. This pipe blocks until a valid messeger is created (i.e. resolved and useable). With this object it is possible to detect connection failures during the messenger resolution. Notge, this pipe also avoids utilitizing the rendezvous for propagation, effectively reducing message overhead, resulting in improved performance.

#send is remains asynchronous.


Constructor Summary
BlockingWireOutputPipe(PeerGroup group, PipeAdvertisement pAdv, PeerID peerID)
          Create a new blocking output pipe
BlockingWireOutputPipe(PeerGroup group, PipeAdvertisement pAdv, PeerID peerID, RouteAdvertisement route)
          Create a new blocking 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.

 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BlockingWireOutputPipe

public BlockingWireOutputPipe(PeerGroup group,
                              PipeAdvertisement pAdv,
                              PeerID peerID)
Create a new blocking output pipe

Parameters:
group - The peergroup context.
pAdv - advertisement for the pipe we are supporting.
peerID - the destination PeerID.

BlockingWireOutputPipe

public BlockingWireOutputPipe(PeerGroup group,
                              PipeAdvertisement pAdv,
                              PeerID peerID,
                              RouteAdvertisement route)
Create a new blocking output pipe

Parameters:
group - The peergroup context.
pAdv - advertisement for the pipe we are supporting.
peerID - the destination PeerID.
route - the destination route.
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

JXSE