Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | File Members

Scheduler Class Reference

#include <Scheduler.h>

Inherited by PriorityScheduler, and PseudoScheduler.

List of all members.


Detailed Description

A scheduler in charge of running boxes in a catalog.

An AuroraNode has an associated scheduler responsible for managing box invocation.

AuroraNode::start() calls Scheduler::start(), which should create one or more threads to run boxes. AuroraNode::shutdown() calls Scheduler::shutdown(), which should signal for those threads to stop and wait for their termination (i.e., join them).

AuroraNode may call scheduleExclusiveTask() to request that some code be run exclusively of all boxes. This is useful when AuroraNode must make some change to the topology of the network (currently limited to adding/removing subscriptions to streams).


Public Types

typedef Registry< SchedulerRegistry

Public Member Functions

virtual ~Scheduler ()
AuroraNodenode ()
 Returns the node associated with this scheduler.
virtual void start ()=0
 Called when a node is started.
virtual void shutdown ()=0
 Called when a node is stopped.
virtual void scheduleExclusiveTask (ptr< SchedulerTask >)=0
 Schedules a task to be run as soon as possible, at some point when no boxes are running.
virtual void topologyChanged ()
 Invoked when the network topology changes, i.e., one or more boxes or streams were added or removed.
bool hasDynamicSupport ()
 Returns true iff the scheduler supports dynamic networks (née MMH2).
virtual void drain ()
 Drains the network: waits until there are no more tuples at all in the network and then shuts the network.
bool hasDrain ()
 Returns true iff the scheduler support draining.
virtual void invalidateBoxes (vector< string > boxNames)
virtual void updateListeners (vector< string > boxNames, bool add)
virtual void chokeSubNetwork (vector< string > boxNames)
virtual void suspendSubNetwork (vector< string > boxNames)
virtual void resumeSubNetwork (vector< string > boxNames)
virtual void drainSubNetwork (vector< string > boxNames)
virtual void removeFromSchedule (QBox *box)
virtual string to_string ()
virtual void init_sched_stats (int windowSize, int historySize)

Static Public Member Functions

unsigned long ticks ()
double secondsPerTick ()
unsigned long ticksPerSecond ()

Public Attributes

SchedulerStats _sched_stats

Protected Member Functions

void setBoxData (QBox &box, ptr< BoxData > data)
BoxDatagetBoxData (const QBox &box) const
 Scheduler (bool dynamic_support=false, bool drain_support=false)
 Constructor.

Protected Attributes

unsigned int _init_time


Member Typedef Documentation

typedef Registry<Scheduler> Scheduler::Registry
 


Constructor & Destructor Documentation

Scheduler::~Scheduler  )  [virtual]
 

Scheduler::Scheduler bool  dynamic_support = false,
bool  drain_support = false
[protected]
 

Constructor.

Parameters:
dynamic_support indicates whether the scheduler implementation supports dynamic networks.
drain_support indicates whether the scheduler implementation supports draining.


Member Function Documentation

void Scheduler::chokeSubNetwork vector< string >  boxNames  )  [virtual]
 

virtual void Scheduler::drain  )  [virtual]
 

Drains the network: waits until there are no more tuples at all in the network and then shuts the network.

Blocks until this is complete, at which point the only valid operation is shutdown(). May be invoked only if the scheduler supports draining.

Reimplemented in PriorityScheduler, and PseudoScheduler.

void Scheduler::drainSubNetwork vector< string >  boxNames  )  [virtual]
 

Scheduler::BoxData * Scheduler::getBoxData const QBox box  )  const [protected]
 

bool Scheduler::hasDrain  ) 
 

Returns true iff the scheduler support draining.

bool Scheduler::hasDynamicSupport  ) 
 

Returns true iff the scheduler supports dynamic networks (née MMH2).

void Scheduler::init_sched_stats int  windowSize,
int  historySize
[virtual]
 

void Scheduler::invalidateBoxes vector< string >  boxNames  )  [virtual]
 

AuroraNode& Scheduler::node  ) 
 

Returns the node associated with this scheduler.

Scheduler code may invoke this to gain access to the node's catalog.

virtual void Scheduler::removeFromSchedule QBox box  )  [virtual]
 

Reimplemented in PseudoScheduler.

void Scheduler::resumeSubNetwork vector< string >  boxNames  )  [virtual]
 

virtual void Scheduler::scheduleExclusiveTask ptr< SchedulerTask  )  [pure virtual]
 

Schedules a task to be run as soon as possible, at some point when no boxes are running.

For example, the scheduler may maintain a thread-safe vector of ptr<SchedulerTask>s. Whenever this vector becomes non-empty, it can signal box-running threads to pause; wait for all pending run() calls to complete; and then run the tasks in one of the box-running threads.

Implemented in PriorityScheduler, and PseudoScheduler.

double Scheduler::secondsPerTick  )  [static]
 

void Scheduler::setBoxData QBox box,
ptr< BoxData data
[protected]
 

virtual void Scheduler::shutdown  )  [pure virtual]
 

Called when a node is stopped.

The implementation of this method must stop any threads that are running boxes and wait for their termination (i.e., join them).

Implemented in PriorityScheduler, and PseudoScheduler.

virtual void Scheduler::start  )  [pure virtual]
 

Called when a node is started.

The implementation of this method should create one or more threads to run boxes.

Implemented in PriorityScheduler, and PseudoScheduler.

void Scheduler::suspendSubNetwork vector< string >  boxNames  )  [virtual]
 

unsigned long Scheduler::ticks  )  [static]
 

unsigned long Scheduler::ticksPerSecond  )  [static]
 

string Scheduler::to_string  )  [virtual]
 

virtual void Scheduler::topologyChanged  )  [virtual]
 

Invoked when the network topology changes, i.e., one or more boxes or streams were added or removed.

This method may only be invoked from within an exclusive task (since the network topology may only change within an exclusive task), and only if the scheduler supports dynamic networks.

Reimplemented in PriorityScheduler, and PseudoScheduler.

void Scheduler::updateListeners vector< string >  boxNames,
bool  add
[virtual]
 


Member Data Documentation

unsigned int Scheduler::_init_time [protected]
 

SchedulerStats Scheduler::_sched_stats
 


The documentation for this class was generated from the following files:
Generated on Fri Nov 12 15:15:24 2004 for Borealis by doxygen 1.3.8