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
Class TimeOutAnnouncer

    java.lang.Object
      mapping.TimeOutAnnouncer

All Implemented Interfaces:
  java.lang.Runnable

    public class TimeOutAnnouncer

extends java.lang.Object
implements java.lang.Runnable

Author:
  Majd Kokaly This thread is responsible for announcing time out events of jobs. It keeps track of sent jobs.It wakes up at the time the earliest job should be done and checks it is done. If it is not done it declares that job as timed-out. This class is Thread-safe.

Nested Class Summary
`static class` | `TimeOutAnnouncer.TimeNode` This class stores the time when a job should be completed.

Constructor Summary
`TimeOutAnnouncer(Mapper mapper)` A default constructor.

Method Summary
`void` | `add(double AfterInTU, long jobID)` This method is used to add nodes.
`long` | `getCurrentSleepTime()`
`Mapper` | `getMapper()`
`Logger` | `getTimeOutLogger()`
`boolean` | `isAlive()`
`void` | `print()`
`void` | `run()` This thread has a list of nodes.
`void` | `setAlive(boolean alive)`
`void` | `setCurrentSleepTime(long currentSleepTime)`
`void` | `setMapper(Mapper mapper)`
`void` | `setTimeOutLogger(Logger timeOutLogger)`
`void` | `startThread()` This method starts this thread.
`void` | `stopThread()` This method stops this thread.
`void` | `upDateCurrentSleepTime()` This method is used to calculate the time for this thread to sleep.

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

Constructor Detail

### TimeOutAnnouncer

    public TimeOutAnnouncer(Mapper mapper)

  A default constructor.

  Parameters:
    `mapper` - To set the mapper field.

Method Detail

### getCurrentSleepTime

    public long getCurrentSleepTime()

### setCurrentSleepTime

    public void setCurrentSleepTime(long currentSleepTime)

### isAlive

    public boolean isAlive()

### setAlive

    public void setAlive(boolean alive)

### getMapper

    public Mapper getMapper()

### setMapper

    public void setMapper(Mapper mapper)

### getTimeOutLogger

    public Logger getTimeOutLogger()

### setTimeOutLogger

    public void setTimeOutLogger(Logger timeOutLogger)

### add

    public void add(double AfterInTU,
                    long jobID)

  This method is used to add nodes. Each node stores the maximum time by when it should be completed and of course the ID of that job.

  Parameters:
    `AfterInTU` - After how many units the job should be completed.
    `jobID` - The ID of the job in subject.

### startThread

    public void startThread()

  This method starts this thread.

### stopThread

    public void stopThread()

  This method stops this thread.

### print

    public void print()

### run

    public void run()

  This thread has a list of nodes. Every node stores the time when a a job should be completed. The nodes in the linked list are sorted by the time. The first node is the node with the nearest time. This thread sleeps until it is the time to declare the job as timed out if it is not completed. If new nodes are inserted the list is modified and the sleep times of the thread are modified as well.

  Specified by:
    `run` in interface `java.lang.Runnable`

### upDateCurrentSleepTime

    public void upDateCurrentSleepTime()

  This method is used to calculate the time for this thread to sleep.

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