Class HostCache1
- public class HostCache1
Title: FreeOxy Project
Description: This class provides an implementation for the host cache for a FreeOxy servent
Copyright: Copyright (c) 2003
Company:
- Version:
- 1.0
- Author:
- Ravi Kosuri
HostCache1
public HostCache1(java.lang.String filename)
- Constructor Initializes the host cache with hosts contained in the file
- Parameters:
filename
-
addHost
public boolean addHost(Host1 host)
- adds the host to the host cache. Returns true if the add is successful. No duplicate inserts allowed.
- Parameters:
host
-
- Returns:
getRandomHost
public Host1 getRandomHost()
- Picks a random host from the host cache and returns it.
- Returns:
removeHost
public boolean removeHost(java.lang.String ipAddr)
- Removes all occurrences of the hosts with the specified ip address. Returns true if there has been at least one remove.
- Parameters:
ipAddr
-
- Returns:
removeHost
public boolean removeHost(Host1 host)
- Removes the specified host(every occurrence) from the host cache. Returns true if the remove was successful.
- Parameters:
host
-
- Returns:
displayHostCache
public void displayHostCache()
- prints out to std output all the entries in the host cache.
contains
public boolean contains(java.lang.String ip)
- Returns true if the host cache contains the specified ip address.
- Parameters:
ip
-
- Returns:
updateHostCache
public void updateHostCache(java.util.Vector vc)
- Takes a vector of ip addresses(strings) and updates the host cache with the ip addresses
- Parameters:
vc
-