bootstrapP
Class ManagedMessageServer
java.lang.Object
common.MessageServer
bootstrapP.ManagedMessageServer
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Comparable<ManagedMessageServer>
public class ManagedMessageServer
- extends MessageServer
- implements java.lang.Comparable<ManagedMessageServer>
A representation of a Message Server managed by the Bootstrap server.
- Author:
- Marco Cornolti
- See Also:
- Serialized Form
Constructor Summary |
ManagedMessageServer(java.net.InetAddress ip,
int RMIPort,
int UDPPort,
java.lang.String password)
|
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
load
private int load
UDPPort
private int UDPPort
password
private java.lang.String password
safeInt
public SafeMSForBSInterface safeInt
ManagedMessageServer
public ManagedMessageServer(java.net.InetAddress ip,
int RMIPort,
int UDPPort,
java.lang.String password)
throws java.rmi.RemoteException
- Parameters:
ip
- the MS IP addressRMIPort
- the MS RMI port.UDPPort
- the MS UDP port.password
- the MS password.
- Throws:
java.rmi.RemoteException
- if the server could not be reached.
getPw
public java.lang.String getPw()
- Returns:
- the MS password.
getUDPPort
public int getUDPPort()
- Returns:
- the MS UDP port.
getRMIPort
public int getRMIPort()
- Returns:
- the MS RMI port
getLoad
public int getLoad()
- Returns:
- the current MS load (higher values mean higher load).
refreshLoad
public void refreshLoad(java.lang.String dataS)
- Calculate and sets the load of a server from a received string.
- Parameters:
dataS
- the string containing the data of the server load.
compareTo
public int compareTo(ManagedMessageServer ms)
- Compares the load of two message servers
- Specified by:
compareTo
in interface java.lang.Comparable<ManagedMessageServer>
- Parameters:
ms
- the managed message server to compare to.
- Returns:
- >0 if this server is more loaded than the given one, 0 if the servers' loads are the same, <0 otherwise.
equals
public boolean equals(ManagedMessageServer ms)
- Checks if a message server is equal to another, witch means that it tests the RMI ports, UDP ports, IP addresses.
- Parameters:
ms
- the ms to check this one againts.
- Returns:
- true if the two message servers are the same.