Class HostCache

public class HostCache

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
Constructor Detail

HostCache

public HostCache(java.lang.String filename)
Constructor Initializes the host cache with hosts contained in the file
Parameters:
filename -

Method Detail

addHost

public boolean addHost(Host host)
adds the host to the host cache. Returns true if the add is successful.
Parameters:
host -
Returns:

getRandomHost

public Host 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(Host host)
Removes the specified host(every occurrence) from the host cache. Returns true if the remove was successful.
Parameters:
host -
Returns:

removeHost

public boolean removeHost(java.lang.String ipAddr,
                          int port)
Removes the host specified by ip addr and port, from the host cache.
Parameters:
ipAddr -
port -
Returns:

displayHostCache

public void displayHostCache()
prints out to std output all the entries in the host cache.