RSB  0.9.6
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
rsb::eventprocessing::ParallelEventReceivingStrategy Class Reference

This push-style event receiving strategy uses one or more threads to filter rsb::Event s and dispatch matching events to rsb::Handler s. More...

#include <ParallelEventReceivingStrategy.h>

Inheritance diagram for rsb::eventprocessing::ParallelEventReceivingStrategy:
Inheritance graph
Collaboration diagram for rsb::eventprocessing::ParallelEventReceivingStrategy:
Collaboration graph

Public Member Functions

 ParallelEventReceivingStrategy (unsigned int numThreads=5)
 
virtual ~ParallelEventReceivingStrategy ()
 
std::string getClassName () const
 
void printContents (std::ostream &stream) const
 
void setHandlerErrorStrategy (const ParticipantConfig::ErrorStrategy &strategy)
 Defines the strategy to use for handling dispatching errors to the client handler. More...
 
virtual void addHandler (rsb::HandlerPtr handler, const bool &wait)
 Adds a new handler that will be notified about new events. More...
 
virtual void removeHandler (rsb::HandlerPtr handler, const bool &wait)
 Removes a handler that will will then not be notified anymore. More...
 
virtual void addFilter (filter::FilterPtr filter)
 
virtual void removeFilter (filter::FilterPtr filter)
 
void handle (EventPtr e)
 Dispatches the event to the listener. More...
 
- Public Member Functions inherited from rsb::eventprocessing::EventReceivingStrategy
virtual ~EventReceivingStrategy ()
 
- Public Member Functions inherited from rsb::eventprocessing::Handler
virtual ~Handler ()
 

Static Public Member Functions

static EventReceivingStrategycreate (const rsc::runtime::Properties &props)
 

Private Member Functions

bool filter (rsb::HandlerPtr handler, EventPtr event)
 
void deliver (rsb::HandlerPtr handler, EventPtr event)
 
void handleDispatchError (const std::string &message)
 

Private Attributes

rsc::logging::LoggerPtr logger
 
rsc::threading::OrderedQueueDispatcherPool
< EventPtr, rsb::Handler
pool
 
boost::shared_mutex filtersMutex
 
std::set< filter::FilterPtrfilters
 
boost::recursive_mutex errorStrategyMutex
 
ParticipantConfig::ErrorStrategy errorStrategy
 

Detailed Description

This push-style event receiving strategy uses one or more threads to filter rsb::Event s and dispatch matching events to rsb::Handler s.

Author
swrede

Definition at line 62 of file ParallelEventReceivingStrategy.h.

Constructor & Destructor Documentation

rsb::eventprocessing::ParallelEventReceivingStrategy::ParallelEventReceivingStrategy ( unsigned int  numThreads = 5)

Definition at line 52 of file ParallelEventReceivingStrategy.cpp.

References pool.

rsb::eventprocessing::ParallelEventReceivingStrategy::~ParallelEventReceivingStrategy ( )
virtual

Definition at line 61 of file ParallelEventReceivingStrategy.cpp.

References pool.

Member Function Documentation

void rsb::eventprocessing::ParallelEventReceivingStrategy::addFilter ( filter::FilterPtr  filter)
virtual
void rsb::eventprocessing::ParallelEventReceivingStrategy::addHandler ( rsb::HandlerPtr  handler,
const bool &  wait 
)
virtual

Adds a new handler that will be notified about new events.

Parameters
handlerhandler to add
waitif set to true, this method must only return after the handler has been install completely so that the next event will be delivered to it

Implements rsb::eventprocessing::PushEventReceivingStrategy.

Definition at line 190 of file ParallelEventReceivingStrategy.cpp.

References pool.

EventReceivingStrategy * rsb::eventprocessing::ParallelEventReceivingStrategy::create ( const rsc::runtime::Properties &  props)
static

Definition at line 48 of file ParallelEventReceivingStrategy.cpp.

Referenced by rsb::eventprocessing::registerDefaultEventProcessingStrategies().

Here is the caller graph for this function:

void rsb::eventprocessing::ParallelEventReceivingStrategy::deliver ( rsb::HandlerPtr  handler,
EventPtr  event 
)
private

Definition at line 153 of file ParallelEventReceivingStrategy.cpp.

References handleDispatchError(), and logger.

Here is the call graph for this function:

bool rsb::eventprocessing::ParallelEventReceivingStrategy::filter ( rsb::HandlerPtr  handler,
EventPtr  event 
)
private

Definition at line 81 of file ParallelEventReceivingStrategy.cpp.

References filters, filtersMutex, handleDispatchError(), and logger.

Here is the call graph for this function:

string rsb::eventprocessing::ParallelEventReceivingStrategy::getClassName ( ) const

Definition at line 65 of file ParallelEventReceivingStrategy.cpp.

void rsb::eventprocessing::ParallelEventReceivingStrategy::handle ( EventPtr  event)
virtual

Dispatches the event to the listener.

Parameters
eventthe event to dispatch

Implements rsb::eventprocessing::EventReceivingStrategy.

Definition at line 185 of file ParallelEventReceivingStrategy.cpp.

References pool.

void rsb::eventprocessing::ParallelEventReceivingStrategy::handleDispatchError ( const std::string &  message)
private
void rsb::eventprocessing::ParallelEventReceivingStrategy::printContents ( std::ostream &  stream) const
void rsb::eventprocessing::ParallelEventReceivingStrategy::removeFilter ( filter::FilterPtr  filter)
virtual
void rsb::eventprocessing::ParallelEventReceivingStrategy::removeHandler ( rsb::HandlerPtr  handler,
const bool &  wait 
)
virtual

Removes a handler that will will then not be notified anymore.

Parameters
handlerhandler to remove
waitif set to true, this method must only return after the handler has been removed completely and will not receive any more notifications

Implements rsb::eventprocessing::PushEventReceivingStrategy.

Definition at line 196 of file ParallelEventReceivingStrategy.cpp.

References pool.

void rsb::eventprocessing::ParallelEventReceivingStrategy::setHandlerErrorStrategy ( const ParticipantConfig::ErrorStrategy strategy)
virtual

Defines the strategy to use for handling dispatching errors to the client handler.

Parameters
strategythe new strategy to use

Implements rsb::eventprocessing::PushEventReceivingStrategy.

Definition at line 75 of file ParallelEventReceivingStrategy.cpp.

References errorStrategy, and errorStrategyMutex.

Member Data Documentation

ParticipantConfig::ErrorStrategy rsb::eventprocessing::ParallelEventReceivingStrategy::errorStrategy
private
boost::recursive_mutex rsb::eventprocessing::ParallelEventReceivingStrategy::errorStrategyMutex
mutableprivate
std::set<filter::FilterPtr> rsb::eventprocessing::ParallelEventReceivingStrategy::filters
private

Definition at line 97 of file ParallelEventReceivingStrategy.h.

Referenced by addFilter(), filter(), printContents(), and removeFilter().

boost::shared_mutex rsb::eventprocessing::ParallelEventReceivingStrategy::filtersMutex
mutableprivate

Definition at line 96 of file ParallelEventReceivingStrategy.h.

Referenced by addFilter(), filter(), printContents(), and removeFilter().

rsc::logging::LoggerPtr rsb::eventprocessing::ParallelEventReceivingStrategy::logger
private

Definition at line 93 of file ParallelEventReceivingStrategy.h.

Referenced by deliver(), filter(), and handleDispatchError().

rsc::threading::OrderedQueueDispatcherPool<EventPtr, rsb::Handler> rsb::eventprocessing::ParallelEventReceivingStrategy::pool
private

The documentation for this class was generated from the following files: