Class TcpDiscoveryMulticastIpFinder
- java.lang.Object
- 
- org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinderAdapter
- 
- org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder
- 
- org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder
 
 
 
- 
- All Implemented Interfaces:
- TcpDiscoveryIpFinder
 
 public class TcpDiscoveryMulticastIpFinder extends TcpDiscoveryVmIpFinder Multicast-based IP finder.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)andsetAddressRequestAttempts(int)).In addition to address received via multicast this finder can work with pre-configured list of addresses specified via TcpDiscoveryVmIpFinder.setAddresses(Collection)method.ConfigurationMandatoryThere are no mandatory configuration parameters.Optional- Multicast IP address (see setMulticastGroup(String)).
- Multicast port number (see setMulticastPort(int)).
- Address response wait time (see setResponseWaitTime(int)).
- Address request attempts (see setAddressRequestAttempts(int)).
- Pre-configured addresses (see TcpDiscoveryVmIpFinder.setAddresses(Collection))
- Local address (see setLocalAddress(String))
 
- 
- 
Field SummaryFields Modifier and Type Field Description static intDFLT_ADDR_REQ_ATTEMPTSDefault number of attempts to send multicast address request (value is2).static StringDFLT_MCAST_GROUPDefault multicast IP address (value is228.1.2.4).static intDFLT_MCAST_PORTDefault multicast port number (value is47400).static intDFLT_RES_WAIT_TIMEDefault time IP finder waits for reply to multicast address request (value is500).- 
Fields inherited from class org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinderAdapterignite
 
- 
 - 
Constructor SummaryConstructors Constructor Description TcpDiscoveryMulticastIpFinder()Constructs new IP finder.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes this IP finder and releases any system resources associated with it.intgetAddressRequestAttempts()Gets number of attempts to send multicast address request.StringgetLocalAddress()Gets local address that multicast IP finder uses.StringgetMulticastGroup()Gets IP address of multicast group.intgetMulticastPort()Gets port number which multicast messages are sent to.Collection<InetSocketAddress>getRegisteredAddresses()Gets all addresses registered in this finder.intgetResponseWaitTime()Gets time in milliseconds IP finder waits for reply to multicast address request.intgetTimeToLive()Set the default time-to-live for multicast packets sent out on this IP finder.voidinitializeLocalAddresses(Collection<InetSocketAddress> addrs)Initializes addresses discovery SPI binds to.voidonSpiContextInitialized(IgniteSpiContext spiCtx)Callback invoked when SPI context is initialized afterTcpDiscoverySpi.spiStart(String)method is completed, SPI context can be stored for future access.TcpDiscoveryMulticastIpFindersetAddressRequestAttempts(int addrReqAttempts)Sets number of attempts to send multicast address request.voidsetIgnite(org.apache.ignite.internal.IgniteEx ignite)TcpDiscoveryMulticastIpFindersetLocalAddress(String locAddr)Sets local host address used by this IP finder.TcpDiscoveryMulticastIpFindersetMulticastGroup(String mcastGrp)Sets IP address of multicast group.TcpDiscoveryMulticastIpFindersetMulticastPort(int mcastPort)Sets port number which multicast messages are sent to.TcpDiscoveryMulticastIpFindersetResponseWaitTime(int resWaitTime)Sets time in milliseconds IP finder waits for reply to multicast address request.TcpDiscoveryMulticastIpFindersetShared(boolean shared)Sets shared flag.TcpDiscoveryMulticastIpFindersetTimeToLive(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.StringtoString()- 
Methods inherited from class org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinderregisterAddresses, setAddresses, unregisterAddresses
 - 
Methods inherited from class org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinderAdapterdiscoveryClientMode, isShared, onSpiContextDestroyed, spiContext
 
- 
 
- 
- 
- 
Field Detail- 
DFLT_MCAST_GROUPpublic static final String DFLT_MCAST_GROUP Default multicast IP address (value is228.1.2.4).- See Also:
- Constant Field Values
 
 - 
DFLT_MCAST_PORTpublic static final int DFLT_MCAST_PORT Default multicast port number (value is47400).- See Also:
- Constant Field Values
 
 - 
DFLT_RES_WAIT_TIMEpublic static final int DFLT_RES_WAIT_TIME Default time IP finder waits for reply to multicast address request (value is500).- See Also:
- Constant Field Values
 
 - 
DFLT_ADDR_REQ_ATTEMPTSpublic static final int DFLT_ADDR_REQ_ATTEMPTS Default number of attempts to send multicast address request (value is2).- See Also:
- Constant Field Values
 
 
- 
 - 
Method Detail- 
setMulticastGroup@IgniteSpiConfiguration(optional=true) public TcpDiscoveryMulticastIpFinder setMulticastGroup(String mcastGrp) Sets IP address of multicast group.If not provided, default value is DFLT_MCAST_GROUP.- Parameters:
- mcastGrp- Multicast IP address.
- Returns:
- thisfor chaining.
 
 - 
setIgnite@IgniteInstanceResource public void setIgnite(org.apache.ignite.internal.IgniteEx ignite) - Parameters:
- ignite- Ignite instance.
 
 - 
getMulticastGrouppublic String getMulticastGroup() Gets IP address of multicast group.- Returns:
- Multicast IP address.
 
 - 
setMulticastPort@IgniteSpiConfiguration(optional=true) public TcpDiscoveryMulticastIpFinder setMulticastPort(int mcastPort) Sets port number which multicast messages are sent to.If not provided, default value is DFLT_MCAST_PORT.- Parameters:
- mcastPort- Multicast port number.
- Returns:
- thisfor chaining.
 
 - 
getMulticastPortpublic int getMulticastPort() Gets port number which multicast messages are sent to.- Returns:
- Port number.
 
 - 
setResponseWaitTime@IgniteSpiConfiguration(optional=true) public TcpDiscoveryMulticastIpFinder setResponseWaitTime(int resWaitTime) Sets time in milliseconds IP finder waits for reply to multicast address request.If not provided, default value is DFLT_RES_WAIT_TIME.- Parameters:
- resWaitTime- Time IP finder waits for reply to multicast address request.
- Returns:
- thisfor chaining.
 
 - 
getResponseWaitTimepublic int getResponseWaitTime() Gets time in milliseconds IP finder waits for reply to multicast address request.- Returns:
- Time IP finder waits for reply to multicast address request.
 
 - 
setAddressRequestAttempts@IgniteSpiConfiguration(optional=true) public TcpDiscoveryMulticastIpFinder setAddressRequestAttempts(int addrReqAttempts) Sets number of attempts to send multicast address request. IP finder re-sends request only in case if no reply for previous request is received.If not provided, default value is DFLT_ADDR_REQ_ATTEMPTS.- Parameters:
- addrReqAttempts- Number of attempts to send multicast address request.
- Returns:
- thisfor chaining.
 
 - 
getAddressRequestAttemptspublic int getAddressRequestAttempts() Gets number of attempts to send multicast address request. IP finder re-sends request only in case if no reply for previous request is received.- Returns:
- Number of attempts to send multicast address request.
 
 - 
setLocalAddress@IgniteSpiConfiguration(optional=true) public TcpDiscoveryMulticastIpFinder setLocalAddress(String locAddr) Sets local host address used by this IP finder. If provided address is non-loopback then multicast socket is bound to this interface. If local address is not set or is any local address then IP finder creates multicast sockets for all found non-loopback addresses.If not provided then this property is initialized by the local address set in TcpDiscoverySpiconfiguration.- Parameters:
- locAddr- Local host address.
- Returns:
- thisfor chaining.
- See Also:
- TcpDiscoverySpi.setLocalAddress(String)
 
 - 
getLocalAddresspublic String getLocalAddress() Gets local address that multicast IP finder uses.- Returns:
- Local address.
 
 - 
setTimeToLive@IgniteSpiConfiguration(optional=true) public 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.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 -1which corresponds to system default value.- Parameters:
- ttl- Time to live.
- Returns:
- thisfor chaining.
 
 - 
getTimeToLivepublic int getTimeToLive() Set the default time-to-live for multicast packets sent out on this IP finder.- Returns:
- Time to live.
 
 - 
initializeLocalAddressespublic void initializeLocalAddresses(Collection<InetSocketAddress> addrs) throws IgniteSpiException Initializes addresses discovery SPI binds to.- Specified by:
- initializeLocalAddressesin interface- TcpDiscoveryIpFinder
- Overrides:
- initializeLocalAddressesin class- TcpDiscoveryIpFinderAdapter
- Parameters:
- addrs- Addresses discovery SPI binds to.
- Throws:
- IgniteSpiException- In case of error.
 
 - 
onSpiContextInitializedpublic void onSpiContextInitialized(IgniteSpiContext spiCtx) throws IgniteSpiException Callback invoked when SPI context is initialized afterTcpDiscoverySpi.spiStart(String)method is completed, SPI context can be stored for future access.- Specified by:
- onSpiContextInitializedin interface- TcpDiscoveryIpFinder
- Overrides:
- onSpiContextInitializedin class- TcpDiscoveryIpFinderAdapter
- Parameters:
- spiCtx- Spi context.
- Throws:
- IgniteSpiException- In case of error.
 
 - 
getRegisteredAddressespublic Collection<InetSocketAddress> getRegisteredAddresses() Gets all addresses registered in this finder.- Specified by:
- getRegisteredAddressesin interface- TcpDiscoveryIpFinder
- Overrides:
- getRegisteredAddressesin class- TcpDiscoveryVmIpFinder
- Returns:
- All known addresses, potentially empty, but never null.
 
 - 
closepublic void close() Closes this IP finder and releases any system resources associated with it.- Specified by:
- closein interface- TcpDiscoveryIpFinder
- Overrides:
- closein class- TcpDiscoveryIpFinderAdapter
 
 - 
setSharedpublic TcpDiscoveryMulticastIpFinder setShared(boolean shared) Sets shared flag. Iftruethen it is expected that IP addresses registered with IP finder will be seen by IP finders on all other nodes.- Overrides:
- setSharedin class- TcpDiscoveryVmIpFinder
- Parameters:
- shared-- trueif this IP finder is shared.
- Returns:
- thisfor chaining.
 
 - 
toStringpublic String toString() - Overrides:
- toStringin class- TcpDiscoveryVmIpFinder
 
 
- 
 
-