Class BasicAddressResolver
- java.lang.Object
- 
- org.apache.ignite.configuration.BasicAddressResolver
 
- 
- All Implemented Interfaces:
- AddressResolver
 
 public class BasicAddressResolver extends Object implements AddressResolver Basic implementation ofAddressResolver.Allows to provide simple mapping between different address, which is useful different parts of the cluster are located in different subnetworks and port forwarding on the router is used for communication between them. Another common case is Docker environment which can create a pair of public and private address per container. There are two different types of mapping supported by this implementation of AddressResolver.First type maps specific socket addresses (host and port pairs) are mapped to each other. This is useful for port forwarding, where multiple nodes will typically map to the same external address (router), but with different port numbers. Here is the example: <property name="addressResolver"> <bean class="org.apache.ignite.configuration.BasicAddressResolver"> <constructor-arg> <map> <entry key="10.0.0.1:47100" value="123.123.123.123:1111"/> <entry key="10.0.0.2:47100" value="123.123.123.123:2222"/> <entry key="10.0.0.3:47100" value="123.123.123.123:3333"/> </map> </constructor-arg> </bean> </property>Second type maps one host to another. In this case any internal address a node is bound to will be mapped to the corresponding external host with the same host number. Here is the example: <property name="addressResolver"> <bean class="org.apache.ignite.configuration.BasicAddressResolver"> <constructor-arg> <map> <entry key="10.0.0.1" value="123.123.123.123"/> </map> </constructor-arg> </bean> </property>Here any port on10.0.0.1will be mapped to the same port number on123.123.123.123. E.g.,10.0.0.1:47100will be mapped to123.123.123.123:47100, and10.0.0.1:47500will be mapped to123.123.123.123:47500.Two types of mappings described above can be mixed within one address resolver. 
- 
- 
Constructor SummaryConstructors Constructor Description BasicAddressResolver(Map<String,String> addrMap)Created the address resolver.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description Collection<InetSocketAddress>getExternalAddresses(InetSocketAddress addr)Maps internal address to a collection of external addresses.StringtoString()
 
- 
- 
- 
Constructor Detail- 
BasicAddressResolverpublic BasicAddressResolver(Map<String,String> addrMap) throws UnknownHostException Created the address resolver.- Parameters:
- addrMap- Address mappings.
- Throws:
- UnknownHostException- If any of the hosts can't be resolved.
 
 
- 
 - 
Method Detail- 
getExternalAddressespublic Collection<InetSocketAddress> getExternalAddresses(InetSocketAddress addr) throws IgniteCheckedException Maps internal address to a collection of external addresses.- Specified by:
- getExternalAddressesin interface- AddressResolver
- Parameters:
- addr- Internal (local) address.
- Returns:
- Collection of addresses that this local address is "known" outside. Note that if there are more than one external network the local address can be mapped differently to each and therefore may need to return multiple external addresses.
- Throws:
- IgniteCheckedException- Thrown if any exception occurs.
 
 
- 
 
-