Package org.apache.hadoop.util
Class MachineList
java.lang.Object
org.apache.hadoop.util.MachineList
Container class which holds a list of ip/host addresses and
answers membership queries.
Accepts list of ip addresses, ip addreses in CIDR format and/or
host addresses.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classInetAddressFactory is used to obtain InetAddress from host. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionMachineList(String hostEntries) MachineList(String hostEntries, MachineList.InetAddressFactory addressFactory) MachineList(Collection<String> hostEntries) MachineList(Collection<String> hostEntries, MachineList.InetAddressFactory addressFactory) Accepts a collection of ip/cidr/host addresses -
Method Summary
Modifier and TypeMethodDescriptionreturns the contents of the MachineList as a Collection<String> .booleanAccepts an ip address and return true if ipAddress is in the list.booleanincludes(InetAddress address) Accepts an inet address and return true if address is in the list.
-
Field Details
-
LOG
public static final org.slf4j.Logger LOG -
WILDCARD_VALUE
- See Also:
-
-
Constructor Details
-
MachineList
- Parameters:
hostEntries- comma separated ip/cidr/host addresses
-
MachineList
-
MachineList
- Parameters:
hostEntries- collection of separated ip/cidr/host addresses
-
MachineList
Accepts a collection of ip/cidr/host addresses- Parameters:
hostEntries- hostEntries.addressFactory- addressFactory to convert host to InetAddress
-
-
Method Details
-
includes
Accepts an ip address and return true if ipAddress is in the list.includes(InetAddress)should be preferred to avoid possibly re-resolving the ip address.- Parameters:
ipAddress- ipAddress.- Returns:
- true if ipAddress is part of the list
-
includes
Accepts an inet address and return true if address is in the list.- Parameters:
address- address.- Returns:
- true if address is part of the list
-
getCollection
returns the contents of the MachineList as a Collection<String> . This can be used for testing .- Returns:
- contents of the MachineList.
-