org.apache.hadoop.util
Class MachineList

java.lang.Object
  extended by org.apache.hadoop.util.MachineList

public class MachineList
extends Object

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
static class MachineList.InetAddressFactory
          InetAddressFactory is used to obtain InetAddress from host.
 
Field Summary
static org.apache.commons.logging.Log LOG
           
 
Constructor Summary
MachineList(Collection<String> hostEntries)
           
MachineList(Collection<String> hostEntries, MachineList.InetAddressFactory addressFactory)
          Accepts a collection of ip/cidr/host addresses
MachineList(String hostEntries)
           
 
Method Summary
 Collection<String> getCollection()
          returns the contents of the MachineList as a Collection This can be used for testing
 boolean includes(String ipAddress)
          Accepts an ip address and return true if ipAddress is in the list
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

public static final org.apache.commons.logging.Log LOG
Constructor Detail

MachineList

public MachineList(String hostEntries)
Parameters:
hostEntries - comma separated ip/cidr/host addresses

MachineList

public MachineList(Collection<String> hostEntries)
Parameters:
hostEntries - collection of separated ip/cidr/host addresses

MachineList

public MachineList(Collection<String> hostEntries,
                   MachineList.InetAddressFactory addressFactory)
Accepts a collection of ip/cidr/host addresses

Parameters:
hostEntries -
addressFactory - addressFactory to convert host to InetAddress
Method Detail

includes

public boolean includes(String ipAddress)
Accepts an ip address and return true if ipAddress is in the list

Parameters:
ipAddress -
Returns:
true if ipAddress is part of the list

getCollection

public Collection<String> getCollection()
returns the contents of the MachineList as a Collection This can be used for testing

Returns:
contents of the MachineList


Copyright © 2014 Apache Software Foundation. All Rights Reserved.