mapping
Class Mapper

java.lang.Object
  extended by mapping.Mapper
All Implemented Interfaces:
java.io.Serializable

public class Mapper
extends java.lang.Object
implements java.io.Serializable

This class is the centre of operation to the software. The jobs table, servers table and the job classes table are data members of this class. Along with the MappingScheme this class is responsible for the mapping decisions. The jobs are submitted to this class.

Author:
Majd Kokaly
See Also:
Serialized Form

Field Summary
static long JOB_FAILED
          This final long is used by the Mapping schemes when sending a job fails.
static long JOB_FAILED_DUE_ACTUAL_ERROR
          This final long is used by the Mapping schemes when sending a job fails due to actual error like communication error.
static long JOB_SECONDARY_ID_NOT_KNOWN
          This final long is used by the Mapping schemes when the secondary id is not known.
 
Constructor Summary
Mapper()
          Default constructor
 
Method Summary
 long cancelJob(long jobID_received, int serverID)
           
 double[][] constructActualMueMatrix()
           
 double[][] constructMueMatrix()
          This method returns the mue matrix as a double array.
 void fillActualProcessingRates()
          This method calculate the actual rates for all servers but does not modify the assumed rates.
 void fillAllFailureTraces()
          This method generates new FailureTrace objects for the servers.
 void fillAllFailureTraces(double failurePeriodsMean, double upTimeMean)
          This method generates new FailureTrace objects for the servers
 void fillProcessingRates()
          This method calculate the actual rates for all servers and set the assumed rates the same as the actual ones.
 double getAssumedRate(int serverID, int jobClassID)
           
 IDsQueue<java.lang.Integer> getAvailableServersQueue()
           
 boolean getcancelFlag()
           
 JobClassesTable getClassesTable()
           
 EndOfFailureAnnouncer getEndOfFailureAnnouncer()
           
 Logger getErrorsLogger()
           
 MapperSideExecuter getExecuter()
           
 double getFailurePeriodsMean()
           
 Logger getFailuresLogger()
           
 JobClass getJobClass(int i)
           
 long getjobID()
           
 JobsTable getJobsTable()
           
 java.lang.String getMapperHostName()
           
 MappingScheme getMappingScheme()
           
 double getRealRate(int serverID, int jobClassID)
           
 Server getServer(int i)
           
 int[] getserverIDs()
           
 ServersTable getServersTable()
           
 java.util.GregorianCalendar getStartTime()
           
 java.util.GregorianCalendar getStopTime()
           
 double getTimeElapsedInTimeUnits()
           
 TimeOutAnnouncer getTimeOutAnnouncer()
           
 double getTimeOutFactor()
           
 int getTimeResolution()
           
 double getTimeUnitInMinutes()
           
 double getUpTimePeriodsMean()
           
 void initProcessingRates()
           
 boolean isArtificialFailuresActive()
           
 boolean isTimeOutActive()
           
 void print()
           
 void printAvailabilityQueue()
           
 void printClasses()
           
 void printServers()
           
 void readMapperAsObjects(java.lang.String fileName)
          Loads the definition of a mapper.
 void resetcancelFlag()
           
 void resubmitJob(Job job)
          This method is used to resubmit timed out job
 void saveMapperAsObjects(java.lang.String fileName)
          This method saves the definitions on a file.
 void setArtificialFailuresActive(boolean artificialFailuresActive)
           
 void setAssumedRate(int serverID, int jobClassID, double rate)
           
 void setAvailableServersQueue(IDsQueue<java.lang.Integer> availableServersQueue)
           
 void setcancelFlag(boolean CancelFlag, int[] serverids, long jobid)
           
 void setClassesTable(JobClassesTable classesTable)
           
 void setEndOfFailureAnnouncer(EndOfFailureAnnouncer endOfFailureAnnouncer)
           
 void setErrorsLogger(Logger errorsLogger)
           
 void setExecuter(MapperSideExecuter executer)
           
 void setFailurePeriodsMean(double failurePeriodsMean)
           
 void setFailuresLogger(Logger failuresLogger)
           
 void setJobsTable(JobsTable jobsTable)
           
 void setMappingScheme(MappingScheme mappingScheme)
           
 void setRealRate(int serverID, int jobClassID, double rate)
           
 void setServersTable(ServersTable serverstable)
           
 void setTimeOutActive(boolean timeOutActive)
           
 void setTimeOutAnnouncer(TimeOutAnnouncer timeOutAnnouncer)
           
 void setTimeOutFactor(double timeOutFactor)
           
 void setTimeResolution(int timeResolution)
           
 void setTimeUnitInMinutes(double timeUnitInMinutes)
           
 void setUpTimePeriodsMean(double upTimePeriodsMean)
           
 void startMapper()
          Starts the test and the mapping operation.
 void stopMapper()
          Stops the test and the mapping operation.
 void submitJob(Job job)
          This method is used by other modules to request jobs
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

JOB_FAILED

public static final long JOB_FAILED
This final long is used by the Mapping schemes when sending a job fails.

See Also:
Constant Field Values

JOB_FAILED_DUE_ACTUAL_ERROR

public static final long JOB_FAILED_DUE_ACTUAL_ERROR
This final long is used by the Mapping schemes when sending a job fails due to actual error like communication error.

See Also:
Constant Field Values

JOB_SECONDARY_ID_NOT_KNOWN

public static final long JOB_SECONDARY_ID_NOT_KNOWN
This final long is used by the Mapping schemes when the secondary id is not known.

See Also:
Constant Field Values
Constructor Detail

Mapper

public Mapper()
Default constructor

Method Detail

getMapperHostName

public java.lang.String getMapperHostName()
Returns:
A string of the canonical host name of the Mapper machine

getcancelFlag

public boolean getcancelFlag()

getserverIDs

public int[] getserverIDs()

getjobID

public long getjobID()

setcancelFlag

public void setcancelFlag(boolean CancelFlag,
                          int[] serverids,
                          long jobid)

resetcancelFlag

public void resetcancelFlag()

getExecuter

public MapperSideExecuter getExecuter()

setExecuter

public void setExecuter(MapperSideExecuter executer)

getServersTable

public ServersTable getServersTable()

setServersTable

public void setServersTable(ServersTable serverstable)

getClassesTable

public JobClassesTable getClassesTable()

setClassesTable

public void setClassesTable(JobClassesTable classesTable)

getJobsTable

public JobsTable getJobsTable()

setJobsTable

public void setJobsTable(JobsTable jobsTable)

getMappingScheme

public MappingScheme getMappingScheme()

setMappingScheme

public void setMappingScheme(MappingScheme mappingScheme)

getTimeUnitInMinutes

public double getTimeUnitInMinutes()

setTimeUnitInMinutes

public void setTimeUnitInMinutes(double timeUnitInMinutes)

getErrorsLogger

public Logger getErrorsLogger()

setErrorsLogger

public void setErrorsLogger(Logger errorsLogger)

getFailuresLogger

public Logger getFailuresLogger()

setFailuresLogger

public void setFailuresLogger(Logger failuresLogger)

getEndOfFailureAnnouncer

public EndOfFailureAnnouncer getEndOfFailureAnnouncer()

setEndOfFailureAnnouncer

public void setEndOfFailureAnnouncer(EndOfFailureAnnouncer endOfFailureAnnouncer)

isArtificialFailuresActive

public boolean isArtificialFailuresActive()

setArtificialFailuresActive

public void setArtificialFailuresActive(boolean artificialFailuresActive)

getTimeOutAnnouncer

public TimeOutAnnouncer getTimeOutAnnouncer()

setTimeOutAnnouncer

public void setTimeOutAnnouncer(TimeOutAnnouncer timeOutAnnouncer)

isTimeOutActive

public boolean isTimeOutActive()

setTimeOutActive

public void setTimeOutActive(boolean timeOutActive)

getTimeOutFactor

public double getTimeOutFactor()

setTimeOutFactor

public void setTimeOutFactor(double timeOutFactor)

getTimeResolution

public int getTimeResolution()

setTimeResolution

public void setTimeResolution(int timeResolution)

getAvailableServersQueue

public IDsQueue<java.lang.Integer> getAvailableServersQueue()

setAvailableServersQueue

public void setAvailableServersQueue(IDsQueue<java.lang.Integer> availableServersQueue)

getFailurePeriodsMean

public double getFailurePeriodsMean()

setFailurePeriodsMean

public void setFailurePeriodsMean(double failurePeriodsMean)

getUpTimePeriodsMean

public double getUpTimePeriodsMean()

setUpTimePeriodsMean

public void setUpTimePeriodsMean(double upTimePeriodsMean)

getStartTime

public java.util.GregorianCalendar getStartTime()

getStopTime

public java.util.GregorianCalendar getStopTime()

printServers

public void printServers()

printClasses

public void printClasses()

submitJob

public void submitJob(Job job)
This method is used by other modules to request jobs

Parameters:
job - Job requested

resubmitJob

public void resubmitJob(Job job)
This method is used to resubmit timed out job

Parameters:
job - Job requested

cancelJob

public long cancelJob(long jobID_received,
                      int serverID)

toString

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

print

public void print()

printAvailabilityQueue

public void printAvailabilityQueue()

getServer

public Server getServer(int i)
Parameters:
i -
Returns:
the i th server in the servers table.

getAssumedRate

public double getAssumedRate(int serverID,
                             int jobClassID)

getRealRate

public double getRealRate(int serverID,
                          int jobClassID)

setAssumedRate

public void setAssumedRate(int serverID,
                           int jobClassID,
                           double rate)

setRealRate

public void setRealRate(int serverID,
                        int jobClassID,
                        double rate)

getJobClass

public JobClass getJobClass(int i)

initProcessingRates

public void initProcessingRates()

startMapper

public void startMapper()
Starts the test and the mapping operation.


stopMapper

public void stopMapper()
Stops the test and the mapping operation.


getTimeElapsedInTimeUnits

public double getTimeElapsedInTimeUnits()
Returns:
tThe time elapsed since startTime.

fillProcessingRates

public void fillProcessingRates()
This method calculate the actual rates for all servers and set the assumed rates the same as the actual ones.


fillActualProcessingRates

public void fillActualProcessingRates()
This method calculate the actual rates for all servers but does not modify the assumed rates.


saveMapperAsObjects

public void saveMapperAsObjects(java.lang.String fileName)
This method saves the definitions on a file. The file can be restores using the readMapperAsObjects.

Parameters:
fileName - The name of the file to be saved.

readMapperAsObjects

public void readMapperAsObjects(java.lang.String fileName)
Loads the definition of a mapper. Please see Appendix B from the thesis document.

Parameters:
fileName -

fillAllFailureTraces

public void fillAllFailureTraces(double failurePeriodsMean,
                                 double upTimeMean)
This method generates new FailureTrace objects for the servers

Parameters:
failurePeriodsMean - The mean of all the failure periods.
upTimeMean - The mean of all the up-time periods.

fillAllFailureTraces

public void fillAllFailureTraces()
This method generates new FailureTrace objects for the servers.


constructMueMatrix

public double[][] constructMueMatrix()
This method returns the mue matrix as a double array.

Returns:
the mue matrix as a double array.

constructActualMueMatrix

public double[][] constructActualMueMatrix()
Returns:
the actual mue matrix (actual processing rates).