public class TcpDiscoveryMulticastIpFinder extends TcpDiscoveryVmIpFinder
When TCP discovery starts this finder sends multicast request and waits
for some time when others nodes reply to this request with messages containing
their addresses (time IP finder waits for response and number of attempts to
re-send multicast request in case if no replies are received can be configured,
see setResponseWaitTime(int)
and setAddressRequestAttempts(int)
).
In addition to address received via multicast this finder can work with pre-configured
list of addresses specified via TcpDiscoveryVmIpFinder.setAddresses(Collection)
method.
setMulticastGroup(String)
).setMulticastPort(int)
).setResponseWaitTime(int)
).setAddressRequestAttempts(int)
).TcpDiscoveryVmIpFinder.setAddresses(Collection)
)setLocalAddress(String)
)Modifier and Type | Field and Description |
---|---|
static int |
DFLT_ADDR_REQ_ATTEMPTS
Default number of attempts to send multicast address request (value is
2 ). |
static String |
DFLT_MCAST_GROUP
Default multicast IP address (value is
228.1.2.4 ). |
static int |
DFLT_MCAST_PORT
Default multicast port number (value is
47400 ). |
static int |
DFLT_RES_WAIT_TIME
Default time IP finder waits for reply to multicast address request (value is
500 ). |
Constructor and Description |
---|
TcpDiscoveryMulticastIpFinder()
Constructs new IP finder.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this IP finder and releases any system resources associated with it.
|
int |
getAddressRequestAttempts()
Gets number of attempts to send multicast address request.
|
String |
getLocalAddress()
Gets local address that multicast IP finder uses.
|
String |
getMulticastGroup()
Gets IP address of multicast group.
|
int |
getMulticastPort()
Gets port number which multicast messages are sent to.
|
int |
getResponseWaitTime()
Gets time in milliseconds IP finder waits for reply to
multicast address request.
|
void |
initializeLocalAddresses(Collection<InetSocketAddress> addrs)
Initializes addresses discovery SPI binds to.
|
void |
onSpiContextInitialized(IgniteSpiContext spiCtx)
Callback invoked when SPI context is initialized after
TcpDiscoverySpi.spiStart(String)
method is completed, SPI context can be stored for future access. |
void |
setAddressRequestAttempts(int addrReqAttempts)
Sets number of attempts to send multicast address request.
|
void |
setLocalAddress(String locAddr)
Sets local host address used by this IP finder.
|
void |
setMulticastGroup(String mcastGrp)
Sets IP address of multicast group.
|
void |
setMulticastPort(int mcastPort)
Sets port number which multicast messages are sent to.
|
void |
setResponseWaitTime(int resWaitTime)
Sets time in milliseconds IP finder waits for reply to
multicast address request.
|
String |
toString() |
getRegisteredAddresses, registerAddresses, setAddresses, unregisterAddresses
isShared, onSpiContextDestroyed, setShared, spiContext
public static final String DFLT_MCAST_GROUP
228.1.2.4
).public static final int DFLT_MCAST_PORT
47400
).public static final int DFLT_RES_WAIT_TIME
500
).public static final int DFLT_ADDR_REQ_ATTEMPTS
2
).public TcpDiscoveryMulticastIpFinder()
@IgniteSpiConfiguration(optional=true) public void setMulticastGroup(String mcastGrp)
If not provided, default value is DFLT_MCAST_GROUP
.
mcastGrp
- Multicast IP address.public String getMulticastGroup()
@IgniteSpiConfiguration(optional=true) public void setMulticastPort(int mcastPort)
If not provided, default value is DFLT_MCAST_PORT
.
mcastPort
- Multicast port number.public int getMulticastPort()
@IgniteSpiConfiguration(optional=true) public void setResponseWaitTime(int resWaitTime)
If not provided, default value is DFLT_RES_WAIT_TIME
.
resWaitTime
- Time IP finder waits for reply to multicast address request.public int getResponseWaitTime()
@IgniteSpiConfiguration(optional=true) public void setAddressRequestAttempts(int addrReqAttempts)
If not provided, default value is DFLT_ADDR_REQ_ATTEMPTS
.
addrReqAttempts
- Number of attempts to send multicast address request.public int getAddressRequestAttempts()
@IgniteSpiConfiguration(optional=true) public void setLocalAddress(String locAddr)
If not provided then this property is initialized by the local address set in TcpDiscoverySpi
configuration.
locAddr
- Local host address.TcpDiscoverySpiAdapter.setLocalAddress(String)
public String getLocalAddress()
public void initializeLocalAddresses(Collection<InetSocketAddress> addrs) throws IgniteSpiException
initializeLocalAddresses
in interface TcpDiscoveryIpFinder
initializeLocalAddresses
in class TcpDiscoveryIpFinderAdapter
addrs
- Addresses discovery SPI binds to.IgniteSpiException
- In case of error.public void onSpiContextInitialized(IgniteSpiContext spiCtx) throws IgniteSpiException
TcpDiscoverySpi.spiStart(String)
method is completed, SPI context can be stored for future access.onSpiContextInitialized
in interface TcpDiscoveryIpFinder
onSpiContextInitialized
in class TcpDiscoveryIpFinderAdapter
spiCtx
- Spi context.IgniteSpiException
- In case of error.public void close()
close
in interface TcpDiscoveryIpFinder
close
in class TcpDiscoveryIpFinderAdapter
public String toString()
toString
in class TcpDiscoveryVmIpFinder
Follow @ApacheIgnite
Ignite Fabric : ver. 1.1.0-incubating Release Date : May 20 2015