java.lang.Runnable
public class MPING extends PING implements java.lang.Runnable
The discovery is assymetric: discovery requests are broadcast via the multicast socket, and received via the multicast socket by everyone in the group. However, the discovery responses are sent back via the regular transport (e.g. TCP) to the sender (discovery request contained sender's regular address, e.g. 192.168.0.2:7800).
discovery_reception, name
Constructor | Description |
---|---|
MPING() |
Modifier and Type | Method | Description |
---|---|---|
java.net.InetAddress |
getBindAddr() |
|
java.net.InetAddress |
getMcastAddr() |
|
int |
getMcastPort() |
|
java.lang.String |
getName() |
|
java.util.List<java.net.NetworkInterface> |
getReceiveInterfaces() |
|
java.util.List<java.net.NetworkInterface> |
getSendInterfaces() |
|
int |
getTTL() |
|
boolean |
isReceiveOnAllInterfaces() |
|
boolean |
isSendOnAllInterfaces() |
|
void |
run() |
|
void |
setBindAddr(java.net.InetAddress bind_addr) |
|
void |
setMcastAddr(java.net.InetAddress mcast_addr) |
|
void |
setMcastPort(int mcast_port) |
|
boolean |
setProperties(java.util.Properties props) |
sets the properties of the PING protocol.
|
void |
setTTL(int ip_ttl) |
|
void |
start() |
This method is called on a
Channel.connect(String) . |
void |
stop() |
This method is called on a
Channel.disconnect() . |
java.lang.Object |
up(Event evt) |
An event was received from the layer below.
|
down, findInitialMembers, findInitialMembersAsString, getNumberOfDiscoveryRequestsSent, getNumInitialMembers, getNumPingRequests, getTimeout, makeView, providedUpServices, resetStats, setNumInitialMembers, setNumPingRequests, setTimeout
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getGossipPort, getGossipRefresh, handleConnect, handleDisconnect, init, localAddressSet, sendGetMembersRequest, setGossipPort, setGossipRefresh, waitForDiscoveryRequestReception
destroy, downThreadEnabled, dumpStats, enableStats, getDownProtocol, getProperties, getProtocolStack, getThreadFactory, getTransport, getUpProtocol, printStats, providedDownServices, requiredDownServices, requiredUpServices, setDownProtocol, setPropertiesInternal, setProtocolStack, setUpProtocol, statsEnabled, upThreadEnabled
public java.net.InetAddress getBindAddr()
public void setBindAddr(java.net.InetAddress bind_addr)
public java.util.List<java.net.NetworkInterface> getReceiveInterfaces()
public java.util.List<java.net.NetworkInterface> getSendInterfaces()
public boolean isReceiveOnAllInterfaces()
public boolean isSendOnAllInterfaces()
public int getTTL()
public void setTTL(int ip_ttl)
public java.net.InetAddress getMcastAddr()
public void setMcastAddr(java.net.InetAddress mcast_addr)
public int getMcastPort()
public void setMcastPort(int mcast_port)
public boolean setProperties(java.util.Properties props)
PING
setProperties
in class PING
props
- - a property set containing only PING propertiespublic java.lang.Object up(Event evt)
Discovery
PassDown
or c) the event (or another event) is sent up
the stack using PassUp
.
For the PING protocol, the Up operation does the following things.
1. If the event is a Event.MSG then PING will inspect the message header.
If the header is null, PING simply passes up the event
If the header is PingHeader.GET_MBRS_REQ then the PING protocol
will PassDown a PingRequest message
If the header is PingHeader.GET_MBRS_RSP we will add the message to the initial members
vector and wake up any waiting threads.
2. If the event is Event.SET_LOCAL_ADDR we will simple set the local address of this protocol
3. For all other messages we simple pass it up to the protocol abovepublic void start() throws java.lang.Exception
Protocol
Channel.connect(String)
. Starts work.
Protocols are connected and queues are ready to receive events.
Will be called from bottom to top. This call will replace
the START and START_OK events.start
in class Discovery
java.lang.Exception
- Thrown if protocol cannot be started successfully. This will cause the ProtocolStack
to fail, so Channel.connect(String)
will throw an exceptionpublic void stop()
Protocol
Channel.disconnect()
. Stops work (e.g. by closing multicast socket).
Will be called from top to bottom. This means that at the time of the method invocation the
neighbor protocol below is still working. This method will replace the
STOP, STOP_OK, CLEANUP and CLEANUP_OK events. The ProtocolStack guarantees that
when this method is called all messages in the down queue will have been flushedpublic void run()
run
in interface java.lang.Runnable
Copyright ? 1998-2008 Bela Ban. All Rights Reserved.