CarobNS::ControllerWatcher Class Reference

Main class for controller ping monitoring. More...

#include <ControllerWatcher.hpp>

List of all members.

Public Member Functions

 ControllerWatcher (const std::vector< ControllerInfo > &controllerList, ControllerStateChangedCallback *callbackPtr, int pingDelayInMs, int controllerTimeout) throw (ConnectionException, UnexpectedException)
 Creates a controller watcher with the given controllers to watch.
void run ()
 Starts watching controllers.
void stop ()
 Stops the execution.
void forceControllerDown (const ControllerInfo &c)
 Forces a given controller to be considered as not responding.

Protected Member Functions

WatchedControllersgetControllersPtr ()
 Gets the watched controllers to delete.
pthread_t getPingerThread ()
 Gets the pinger thread to stop him.
ControllerPingSendergetControllerPingSenderPtr ()
 Gets the ControllerPingSender to delete.
int getSocketFd ()
 Gets the socket file descriptor to close.

Friends

void * ControllerWatcherThread (void *)
 Function to be passed to pthread_create.


Detailed Description

Main class for controller ping monitoring.


Launches a controller pinger thread and creates a list of controllers with their states. Reads controllers responses (pongs) and updates state accordingly


Constructor & Destructor Documentation

CarobNS::ControllerWatcher::ControllerWatcher ( const std::vector< ControllerInfo > &  controllerList,
ControllerStateChangedCallback callbackPtr,
int  pingDelayInMs,
int  controllerTimeout 
) throw (ConnectionException, UnexpectedException)

Creates a controller watcher with the given controllers to watch.


Pings will be sent to all given controllers

Parameters:
controllerList controllers to ping
callbackPtr Callback implementation to call when a controller state changes
pingDelayInMs time to wait between two successive pings
controllerTimeout delay after which a controller will be considered as failing if it did not respond to pings


Member Function Documentation

void CarobNS::ControllerWatcher::forceControllerDown ( const ControllerInfo c  ) 

Forces a given controller to be considered as not responding.

Parameters:
c controller that is suspected of failure
See also:
WatchedControllers::setControllerDown(ControllerInfo&)

void CarobNS::ControllerWatcher::run (  ) 

Starts watching controllers.


Reads ping responses from controllers and updates corresponding controller data in the ControllerList.


Friends And Related Function Documentation

void* ControllerWatcherThread ( void *   )  [friend]

Function to be passed to pthread_create.

Launches run on given ControllerWatcher instance


The documentation for this class was generated from the following file:
Generated on Fri Mar 9 17:40:20 2007 for Carob by  doxygen 1.4.7