uk.ac.ic.doc.automed.p2p.directory
Class HelloTimeHelper

java.lang.Object
  extended by uk.ac.ic.doc.automed.p2p.directory.HelloTimeHelper
All Implemented Interfaces:
JobHandler, Threadable

public class HelloTimeHelper
extends java.lang.Object
implements Threadable, JobHandler


Field Summary
private  HoldTimeHelper _hotHelper
           
private  boolean _isRunning
           
private  Queue _msgQueue
           
private  TimedThread _process
           
private  P2PDirectory _theDirectory
           
 
Constructor Summary
HelloTimeHelper(Queue msgQueue, P2PDirectory directoryObj)
          Creates a new instance of HoldTimeHelper
 
Method Summary
 boolean getReadyState()
           
 void handleAction()
          Implements Theadable interface.
 void handleJob(Job job)
          Implement JobHandler interface.
This method is invoked by every job thread to handle job
 boolean isRunning()
           
 void reset()
          Reset the hold-time process when necessary
 void runAction()
          Implements Theadable interface This method acts as the background process at the server to update peer
status.
private  void setHoldTimer()
          If HoldTimeHelper thread is not created, create it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_msgQueue

private Queue _msgQueue

_theDirectory

private P2PDirectory _theDirectory

_hotHelper

private HoldTimeHelper _hotHelper

_process

private TimedThread _process

_isRunning

private boolean _isRunning
Constructor Detail

HelloTimeHelper

public HelloTimeHelper(Queue msgQueue,
                       P2PDirectory directoryObj)
                throws AutoMedException
Creates a new instance of HoldTimeHelper

Throws:
AutoMedException
Method Detail

isRunning

public boolean isRunning()

getReadyState

public boolean getReadyState()
Specified by:
getReadyState in interface Threadable

runAction

public void runAction()
               throws AutoMedException
Implements Theadable interface This method acts as the background process at the server to update peer
status. It is invoked at every hold_down and flush interval to check and
update peer's status appropriately.

Specified by:
runAction in interface Threadable
Throws:
AutoMedException

setHoldTimer

private void setHoldTimer()
                   throws AutoMedException
If HoldTimeHelper thread is not created, create it. Otherwise check
if it has already been started. If not, start it!

Throws:
AutoMedException

reset

public void reset()
Reset the hold-time process when necessary


handleAction

public void handleAction()
Implements Theadable interface. This method handles exceptions when running as a thread.

Specified by:
handleAction in interface Threadable
Throws:
AutoMedException

handleJob

public void handleJob(Job job)
               throws AutoMedException
Implement JobHandler interface.
This method is invoked by every job thread to handle job

Specified by:
handleJob in interface JobHandler
Throws:
AutoMedException