Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## mapping.data
Class ServersTable

    java.lang.Object
      java.util.Dictionary<K,V>
          java.util.Hashtable<java.lang.Integer,Server>
              mapping.data.ServersTable

All Implemented Interfaces:
  java.io.Serializable, java.lang.Cloneable, java.util.Map<java.lang.Integer,Server>

    public class ServersTable

extends java.util.Hashtable<java.lang.Integer,Server>
implements java.io.Serializable

This class represents the collection of servers in the system. It was implemented as a Hashtable. This class is thread safe.

Author:
  Majd Kokaly
See Also:
  Serialized Form

Constructor Summary
`ServersTable()`
`ServersTable(int initialCapacity)`
`ServersTable(int initialCapacity, float loadFactor)`

Method Summary
`void` | `addServer(Server server)` This method adds a Server object to the table and gives it its unique ID.
`void` | `addServersListener(ServersTableListener listener)` Adds a listener to this object.
`void` | `clearServerActiveJobsNumber(int serverID)`
`double` | `getFailurePeriodsMeanOfAllServersInMinutes()`
`Server` | `getServer(java.lang.String hostname)`
`double` | `getUpTimeMeanOfAllServersInMinutes()`
`boolean` | `isServerDown(int serverID)`
`void` | `printAll()`
`void` | `removeServer(int id)` This method removes a server with ID id and reorders the servers.
`void` | `setServerDown(int serverID, boolean down)` This method set the server of ID serverID to down.

Methods inherited from class java.util.Hashtable
`clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, remove, size, toString, values`

Methods inherited from class java.lang.Object
`getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### ServersTable

    public ServersTable()

### ServersTable

    public ServersTable(int initialCapacity)

### ServersTable

    public ServersTable(int initialCapacity,
                        float loadFactor)

Method Detail

### addServersListener

    public void addServersListener(ServersTableListener listener)

  Adds a listener to this object.

  Parameters:
    `listener` - The listener to be added.

### printAll

    public void printAll()

### addServer

    public void addServer(Server server)

  This method adds a Server object to the table and gives it its unique ID.

  Parameters:
    `server` - the server to be added.

### getServer

    public Server getServer(java.lang.String hostname)

  Parameters:
    `hostname` - The hostname of the machine being sought.
  Returns:
    The Server object that has the host name hostname. It returns null if server is not found.

### removeServer

    public void removeServer(int id)

  This method removes a server with ID id and reorders the servers. It is always true that if there is N servers in the system that the IDs of the server are in the set {1 , 2, .. N}.

  Parameters:
    `id` - The id of the server to be deleted.

### isServerDown

    public boolean isServerDown(int serverID)

  Parameters:
    `serverID` - The ID of the server in subject.
  Returns:
    true if the server with serverID is down, false otherwise.

### setServerDown

    public void setServerDown(int serverID,
                              boolean down)

  This method set the server of ID serverID to down.

  Parameters:
    `serverID` - The ID of the server in subject.
    `down` - A boolean value determining wheather the server is down or not.

### clearServerActiveJobsNumber

    public void clearServerActiveJobsNumber(int serverID)

  Parameters:
    `serverID` - The ID of the server in subject.

### getFailurePeriodsMeanOfAllServersInMinutes

    public double getFailurePeriodsMeanOfAllServersInMinutes()

  Returns:
    The failure periods mean of all servers in minutes.
  See Also:
    `Server.clearActiveJobsNumber()`

### getUpTimeMeanOfAllServersInMinutes

    public double getUpTimeMeanOfAllServersInMinutes()

  Returns:
    The up-time mean of all servers in minutes

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD