org.tranche.servers
Class ServerUtil

java.lang.Object
  extended by org.tranche.servers.ServerUtil

public class ServerUtil
extends java.lang.Object

A lazy-loading utility class that helps track which servers are currently on-line.

Author:
Jayson Falkner - jfalkner@umich.edu, James "Augie" Hill - augman85@gmail.com, Bryan E. Smith - bryanesmith@gmail.com

Method Summary
static void addServerListener(RemoteTrancheServerListener l)
          Adds a server listener to listen to all server communication.
static boolean addServerListener(java.lang.String host, RemoteTrancheServerListener l)
          Adds a servers listener to listen only to the Tranche server with the given host name.
static void clearServerListeners(java.lang.String host)
          Removes all Tranche server listeners from the Tranche server with the given URL.
static java.lang.String getHostName()
          Returns the IP addresss of this Tranche server.
static java.util.List<RemoteTrancheServerListener> getServerListeners(java.lang.String url)
          Returns the server listeners that are listening to the Tranche server with the given URL.
static boolean removeServerListener(java.lang.String host, RemoteTrancheServerListener l)
          Removes the given server listener from the set of server listeners for the Tranche server with the given URL.
static void setHostName(java.lang.String host)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

addServerListener

public static void addServerListener(RemoteTrancheServerListener l)

Adds a server listener to listen to all server communication.

Parameters:
l -

addServerListener

public static boolean addServerListener(java.lang.String host,
                                        RemoteTrancheServerListener l)

Adds a servers listener to listen only to the Tranche server with the given host name.

Parameters:
host -
l -
Returns:

getServerListeners

public static java.util.List<RemoteTrancheServerListener> getServerListeners(java.lang.String url)

Returns the server listeners that are listening to the Tranche server with the given URL.

Parameters:
url -
Returns:
A copy of the list of servers for a given URL.

removeServerListener

public static boolean removeServerListener(java.lang.String host,
                                           RemoteTrancheServerListener l)

Removes the given server listener from the set of server listeners for the Tranche server with the given URL.

Parameters:
host -
l -
Returns:

clearServerListeners

public static void clearServerListeners(java.lang.String host)

Removes all Tranche server listeners from the Tranche server with the given URL.

Parameters:
host -

getHostName

public static java.lang.String getHostName()
Returns the IP addresss of this Tranche server. IP6 is largely ignored right now and will likely result in odd behavior.

Returns:
Returns the IP address of this Tranche server.

setHostName

public static void setHostName(java.lang.String host)
Parameters:
host -


This code is free for use both commercially and non-commercially as stated in the project's license