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 ). |
ignite
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.
|
Collection<InetSocketAddress> |
getRegisteredAddresses()
Gets all addresses registered in this finder.
|
int |
getResponseWaitTime()
Gets time in milliseconds IP finder waits for reply to
multicast address request.
|
int |
getTimeToLive()
Set the default time-to-live for multicast packets sent out on this
IP finder.
|
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. |
TcpDiscoveryMulticastIpFinder |
setAddressRequestAttempts(int addrReqAttempts)
Sets number of attempts to send multicast address request.
|
TcpDiscoveryMulticastIpFinder |
setLocalAddress(String locAddr)
Sets local host address used by this IP finder.
|
TcpDiscoveryMulticastIpFinder |
setMulticastGroup(String mcastGrp)
Sets IP address of multicast group.
|
TcpDiscoveryMulticastIpFinder |
setMulticastPort(int mcastPort)
Sets port number which multicast messages are sent to.
|
TcpDiscoveryMulticastIpFinder |
setResponseWaitTime(int resWaitTime)
Sets time in milliseconds IP finder waits for reply to
multicast address request.
|
TcpDiscoveryMulticastIpFinder |
setShared(boolean shared)
Sets shared flag.
|
TcpDiscoveryMulticastIpFinder |
setTimeToLive(int ttl)
Set the default time-to-live for multicast packets sent out on this
IP finder in order to control the scope of the multicast.
|
String |
toString() |
registerAddresses, setAddresses, unregisterAddresses
discoveryClientMode, isShared, onSpiContextDestroyed, 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 TcpDiscoveryMulticastIpFinder setMulticastGroup(String mcastGrp)
If not provided, default value is DFLT_MCAST_GROUP
.
mcastGrp
- Multicast IP address.this
for chaining.public String getMulticastGroup()
@IgniteSpiConfiguration(optional=true) public TcpDiscoveryMulticastIpFinder setMulticastPort(int mcastPort)
If not provided, default value is DFLT_MCAST_PORT
.
mcastPort
- Multicast port number.this
for chaining.public int getMulticastPort()
@IgniteSpiConfiguration(optional=true) public TcpDiscoveryMulticastIpFinder setResponseWaitTime(int resWaitTime)
If not provided, default value is DFLT_RES_WAIT_TIME
.
resWaitTime
- Time IP finder waits for reply to multicast address request.this
for chaining.public int getResponseWaitTime()
@IgniteSpiConfiguration(optional=true) public TcpDiscoveryMulticastIpFinder setAddressRequestAttempts(int addrReqAttempts)
If not provided, default value is DFLT_ADDR_REQ_ATTEMPTS
.
addrReqAttempts
- Number of attempts to send multicast address request.this
for chaining.public int getAddressRequestAttempts()
@IgniteSpiConfiguration(optional=true) public TcpDiscoveryMulticastIpFinder setLocalAddress(String locAddr)
If not provided then this property is initialized by the local address set in
TcpDiscoverySpi
configuration.
locAddr
- Local host address.this
for chaining.TcpDiscoverySpi.setLocalAddress(String)
public String getLocalAddress()
@IgniteSpiConfiguration(optional=true) public TcpDiscoveryMulticastIpFinder setTimeToLive(int ttl)
The TTL has to be in the range 0 <= TTL <= 255
.
If TTL is 0
, packets are not transmitted on the network,
but may be delivered locally.
Default value is -1
which corresponds to system default value.
ttl
- Time to live.this
for chaining.public int getTimeToLive()
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 Collection<InetSocketAddress> getRegisteredAddresses()
getRegisteredAddresses
in interface TcpDiscoveryIpFinder
getRegisteredAddresses
in class TcpDiscoveryVmIpFinder
null
.public void close()
close
in interface TcpDiscoveryIpFinder
close
in class TcpDiscoveryIpFinderAdapter
public TcpDiscoveryMulticastIpFinder setShared(boolean shared)
true
then it is expected that IP addresses registered
with IP finder will be seen by IP finders on all other nodes.setShared
in class TcpDiscoveryVmIpFinder
shared
- true
if this IP finder is shared.this
for chaining.public String toString()
toString
in class TcpDiscoveryVmIpFinder
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.16.0 Release Date : December 15 2023