java2gomd
Class Cluster

java.lang.Object
  extended byjava2gomd.GomdObject
      extended byjava2gomd.Cluster

public class Cluster
extends java2gomd.GomdObject

Represents a whole cluster with Gomd running on each node. Each instance has its own hash, usable to check if we have multiple connections to the same cluster.

See Also:
Hashtable

Field Summary
 GomdClient clientConnection
           
 
Constructor Summary
Cluster(GomdClient c)
          Creates a Cluster object communicating via GomdClient c
 
Method Summary
 int[] cwc(java.lang.String cmd)
          Runs a command on every node using Secure Cluster eXecution
 int getHash()
          Returns a hash unique for every cluster.
 int getLoad()
          Returns the average load of all the nodes in the cluster in percents.
 int getLoadbalancingEfficiency()
          Returns the Loadbalancing efficiency of the cluster It calculates 100%-(maxload - minload).
 long getMemory()
          Returns the total amount of memory psysically available in the cluster It requests all nodes and then requests the memory available in each node.
 java.util.Hashtable getNodes()
          Returns a Hashtable containing all available nodes in the cluster.
 long getSpeed()
          Returns the total speed of all nodes in the cluster running gomd.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

clientConnection

public GomdClient clientConnection
Constructor Detail

Cluster

public Cluster(GomdClient c)
Creates a Cluster object communicating via GomdClient c

Parameters:
c - The GomdClient it is going to use to get info from. This GomdClient is also used by all other objects in this Cluster
Method Detail

getHash

public int getHash()
            throws java.io.IOException
Returns a hash unique for every cluster. This helps us checking if we have multiple connections to the same cluster.

Returns:
int representing the hashCode.
Throws:
java.io.IOException

getLoad

public int getLoad()
            throws java.io.IOException
Returns the average load of all the nodes in the cluster in percents. It requests all nodes and then requests the load of each node.

Returns:
int representing the avarage load in the cluster
Throws:
java.io.IOException

getMemory

public long getMemory()
               throws java.io.IOException
Returns the total amount of memory psysically available in the cluster It requests all nodes and then requests the memory available in each node.

Returns:
long representing the total psysical memory in the cluster
Throws:
java.io.IOException

getSpeed

public long getSpeed()
              throws java.io.IOException
Returns the total speed of all nodes in the cluster running gomd. It requests all nodes and then requests the speed of each node.

Returns:
long respresenting the total speed of all nodes in the cluster.
Throws:
java.io.IOException

getLoadbalancingEfficiency

public int getLoadbalancingEfficiency()
                               throws java.io.IOException
Returns the Loadbalancing efficiency of the cluster It calculates 100%-(maxload - minload). This function is equivalent to the one found in openMosixView

Returns:
int respresenting the percentage of loadbalancing performed by the cluster.
Throws:
java.io.IOException

getNodes

public java.util.Hashtable getNodes()
                             throws java.io.IOException
Returns a Hashtable containing all available nodes in the cluster.
Node n = (Node)getNodes().get("257");

Returns:
Hashtable filled with all nodes.
Throws:
java.io.IOException

cwc

public int[] cwc(java.lang.String cmd)
          throws java.io.IOException
Runs a command on every node using Secure Cluster eXecution

Returns:
int[] representing the exit status of the program ran on each node
Throws:
java.io.IOException