|
JXTA | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.jxta.impl.pipe.WirePipe
public class WirePipe
WirePipe (aka Propagated pipe) is very similar to IGMP, where a creation of an input pipe results in a propagated pipe membership registration with the peer's rendezvous peer, and a closure results in a propagated pipe group resignation, these group registration/resignation are simply PipeService SRDI messages.
Field Summary | |
---|---|
(package private) int |
messagesReceived
|
Constructor Summary | |
---|---|
WirePipe(PeerGroup group,
PipeResolver pipeResolver,
WirePipeImpl wireService,
PipeAdvertisement adv)
Constructor |
Method Summary | |
---|---|
void |
close()
Close the pipe. |
(package private) static String |
createMsgId()
Create a unique (mostly) identifier for this message |
protected void |
finalize()
Closes the pipe. |
boolean |
forget(InputPipe wireinputpipe)
This peer is no longer listening on the specified 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 |
Message |
poll(int timeout)
Poll for a message from the pipe. |
void |
processIncomingMessage(Message message,
EndpointAddress srcAddr,
EndpointAddress dstAddr)
This method is invoked by the EndpointService for each incoming message which is addressed to this listener. |
(package private) void |
processIncomingMessage(Message message,
WireHeader header,
EndpointAddress srcAddr,
EndpointAddress dstAddr)
local version with the wire header already parsed. |
boolean |
register(InputPipe wireinputpipe)
Register that this peer is an InputPipe for the specified Pipe ID. |
(package private) void |
repropagate(Message message,
WireHeader header)
Repropagate a message. |
(package private) void |
sendMessage(Message message,
Set<? extends ID> peers,
WireHeader header)
Sends a message on the propagated pipe. |
Message |
waitForMessage()
Wait (block) for a message to be received. |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
int messagesReceived
Constructor Detail |
---|
public WirePipe(PeerGroup group, PipeResolver pipeResolver, WirePipeImpl wireService, PipeAdvertisement adv)
group
- The Group associated with this servicepipeResolver
- the associated pipe resolverwireService
- The pipe service associated with this pipeadv
- pipe advertisementMethod Detail |
---|
protected void finalize() throws Throwable
finalize
in class Object
Throwable
public boolean register(InputPipe wireinputpipe)
register
in interface PipeRegistrar
wireinputpipe
- The InputPipe to be registered.
true
then the pipe was registered, otherwise
false
.public boolean forget(InputPipe wireinputpipe)
forget
in interface PipeRegistrar
wireinputpipe
- The InputPipe to be forgotten.
true
if the pipe was removed otherwise false
.public Message waitForMessage() throws InterruptedException
waitForMessage
in interface InputPipe
InterruptedException
- If another thread interrupted while we
were waiting for a message.public Message poll(int timeout) throws InterruptedException
poll
in interface InputPipe
timeout
- Maximum number of milliseconds to wait (block) for a
message to be received. If zero then wait indefinitely for a message.
InterruptedException
- If another thread interrupted while we
were waiting for a message.public void close()
close
in interface InputPipe
public String getType()
getType
in interface InputPipe
public ID getPipeID()
getPipeID
in interface InputPipe
public String getName()
getName
in interface InputPipe
public PipeAdvertisement getAdvertisement()
getAdvertisement
in interface InputPipe
public void processIncomingMessage(Message message, EndpointAddress srcAddr, EndpointAddress dstAddr)
processIncomingMessage
in interface EndpointListener
message
- Incoming messagesrcAddr
- Endpoint Address of the source of the message.dstAddr
- Endpoint Address of the destination of the message.void processIncomingMessage(Message message, WireHeader header, EndpointAddress srcAddr, EndpointAddress dstAddr)
message
- the messageheader
- the wire headersrcAddr
- sourcedstAddr
- destinationvoid repropagate(Message message, WireHeader header)
message
- the messageheader
- the headervoid sendMessage(Message message, Set<? extends ID> peers, WireHeader header) throws IOException
message
- The message to send.peers
- The peers to which the message will be sent. If the
set is empty then the message is sent to all members of the pipe that are
connected to the rendezvous, as well as walk the message through the networkheader
- message header
IOException
- if an io error occursstatic String createMsgId()
|
JXSE | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |