pulling.availability_predection
Class AvailabilityManager

java.lang.Object
  extended by pulling.availability_predection.AvailabilityManager
All Implemented Interfaces:
java.lang.Runnable

public class AvailabilityManager
extends java.lang.Object
implements java.lang.Runnable

This thread is responsible for measuring the Usage of the server, updating the history file and letting the Mapper know when the node is idle. This Thread uses the AvailabilityLogger to access the history file.

Version:
1
Author:
Majd Kokaly

Field Summary
static int RECURSIVE
          Is one mode of operation.
static int WEIGHTED_MEAN
          Is one mode of operation.
 
Constructor Summary
AvailabilityManager()
          The default constructor
AvailabilityManager(int timeresolution, java.lang.String mapperHostName)
           
AvailabilityManager(int timeresolution, java.lang.String mapperHostName, double c)
           
AvailabilityManager(int timeresolution, java.lang.String mapperHostName, double[] weights)
           
AvailabilityManager(int timeresolution, java.lang.String mapperHostName, int mode)
           
 
Method Summary
 int getAvailablityPort()
           
 double getAverage()
          This method returns the average of the readings elements ignoring UNKOWN elements
 double getC()
           
 double getEstimatedAvailability(java.util.GregorianCalendar calendar)
          Please refer to Section Availability Model in the thesis document.
 AvailabilityLogger getLogger()
           
 java.lang.String getMapperHostName()
           
 int getMode()
           
 int getPastReadingsCount()
           
 double getPreviousEstimation()
           
 int getReadingFrequency()
           
 int getTimeresolution()
           
 double[] getWeights()
           
 void initReadings()
          Set every element in the reading array to be unknown
 boolean isAlive()
           
 boolean isDistributedReadingsMode()
           
 void notifyMapperWithThenNewAvailability(double availability)
          This method notifies Mapper with the availability.
 void print()
           
static void print(java.util.GregorianCalendar cal)
           
 void printAllTimeIntervals()
           
 void run()
           
 void setAlive(boolean alive)
           
 void setAvailablityPort(int availablityPort)
           
 void setC(double c)
           
 void setDistributedReadingsMode(boolean distributedReadingsMode)
           
 void setLogger(AvailabilityLogger logger)
           
 void setMapperHostName(java.lang.String mapperHostName)
           
 void setMode(int mode)
           
 void setPreviousEstimation(double previousEstimation)
           
 void setReadingFrequency(int readingFrequency)
           
 void setTimeresolution(int timeresolution)
           
 void setWeights(double[] weights)
           
 void startThread()
          This method starts the Thread
 void stopThread()
          This method stops the Thread
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

WEIGHTED_MEAN

public static int WEIGHTED_MEAN
Is one mode of operation.


RECURSIVE

public static int RECURSIVE
Is one mode of operation.

Constructor Detail

AvailabilityManager

public AvailabilityManager()
The default constructor


AvailabilityManager

public AvailabilityManager(int timeresolution,
                           java.lang.String mapperHostName)

AvailabilityManager

public AvailabilityManager(int timeresolution,
                           java.lang.String mapperHostName,
                           int mode)

AvailabilityManager

public AvailabilityManager(int timeresolution,
                           java.lang.String mapperHostName,
                           double c)

AvailabilityManager

public AvailabilityManager(int timeresolution,
                           java.lang.String mapperHostName,
                           double[] weights)
Method Detail

startThread

public void startThread()
This method starts the Thread


stopThread

public void stopThread()
This method stops the Thread


getLogger

public AvailabilityLogger getLogger()

setLogger

public void setLogger(AvailabilityLogger logger)

isAlive

public boolean isAlive()

setAlive

public void setAlive(boolean alive)

isDistributedReadingsMode

public boolean isDistributedReadingsMode()

setDistributedReadingsMode

public void setDistributedReadingsMode(boolean distributedReadingsMode)

getTimeresolution

public int getTimeresolution()

setTimeresolution

public void setTimeresolution(int timeresolution)

getReadingFrequency

public int getReadingFrequency()

setReadingFrequency

public void setReadingFrequency(int readingFrequency)

getMapperHostName

public java.lang.String getMapperHostName()

setMapperHostName

public void setMapperHostName(java.lang.String mapperHostName)

getAvailablityPort

public int getAvailablityPort()

setAvailablityPort

public void setAvailablityPort(int availablityPort)

getMode

public int getMode()

setMode

public void setMode(int mode)

getPastReadingsCount

public int getPastReadingsCount()

getWeights

public double[] getWeights()

setWeights

public void setWeights(double[] weights)

getC

public double getC()

setC

public void setC(double c)

getPreviousEstimation

public double getPreviousEstimation()

setPreviousEstimation

public void setPreviousEstimation(double previousEstimation)

initReadings

public void initReadings()
Set every element in the reading array to be unknown


getAverage

public double getAverage()
This method returns the average of the readings elements ignoring UNKOWN elements

Returns:
average of readings elements.

getEstimatedAvailability

public double getEstimatedAvailability(java.util.GregorianCalendar calendar)
Please refer to Section Availability Model in the thesis document.

Parameters:
calendar - is the time for which the estimation is desired
Returns:
the estimated availability

run

public void run()
Specified by:
run in interface java.lang.Runnable

print

public static void print(java.util.GregorianCalendar cal)

printAllTimeIntervals

public void printAllTimeIntervals()

notifyMapperWithThenNewAvailability

public void notifyMapperWithThenNewAvailability(double availability)
                                         throws java.net.UnknownHostException
This method notifies Mapper with the availability.

Parameters:
availability - The new aj value.
Throws:
java.net.UnknownHostException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

print

public void print()