RSB
0.7.0
|
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>
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. | |
virtual void | addHandler (rsb::HandlerPtr handler, const bool &wait) |
Adds a new handler that will be notified about new events. | |
virtual void | removeHandler (rsb::HandlerPtr handler, const bool &wait) |
Removes a handler that will will then not be notified anymore. | |
virtual void | addFilter (filter::FilterPtr filter) |
virtual void | removeFilter (filter::FilterPtr filter) |
void | handle (EventPtr e) |
Dispatches the event to the listener. |
Static Public Member Functions | |
static EventReceivingStrategy * | create (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::FilterPtr > | filters |
boost::recursive_mutex | errorStrategyMutex |
ParticipantConfig::ErrorStrategy | errorStrategy |
This push-style event receiving strategy uses one or more threads to filter rsb::Event s and dispatch matching events to rsb::Handler s.
Definition at line 62 of file ParallelEventReceivingStrategy.h.
rsb::eventprocessing::ParallelEventReceivingStrategy::ParallelEventReceivingStrategy | ( | unsigned int | numThreads = 5 | ) |
Definition at line 52 of file ParallelEventReceivingStrategy.cpp.
References pool.
|
virtual |
Definition at line 61 of file ParallelEventReceivingStrategy.cpp.
References pool.
|
virtual |
Implements rsb::eventprocessing::EventReceivingStrategy.
Definition at line 202 of file ParallelEventReceivingStrategy.cpp.
References filters, and filtersMutex.
|
virtual |
Adds a new handler that will be notified about new events.
handler | handler to add |
wait | if 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.
|
static |
Definition at line 48 of file ParallelEventReceivingStrategy.cpp.
Referenced by rsb::eventprocessing::registerDefaultEventProcessingStrategies().
|
private |
Definition at line 153 of file ParallelEventReceivingStrategy.cpp.
References handleDispatchError(), and logger.
|
private |
Definition at line 81 of file ParallelEventReceivingStrategy.cpp.
References filters, filtersMutex, handleDispatchError(), and logger.
string rsb::eventprocessing::ParallelEventReceivingStrategy::getClassName | ( | ) | const |
Definition at line 65 of file ParallelEventReceivingStrategy.cpp.
|
virtual |
Dispatches the event to the listener.
event | the event to dispatch |
Implements rsb::eventprocessing::EventReceivingStrategy.
Definition at line 185 of file ParallelEventReceivingStrategy.cpp.
References pool.
|
private |
Definition at line 128 of file ParallelEventReceivingStrategy.cpp.
References errorStrategy, errorStrategyMutex, rsb::ParticipantConfig::EXIT, rsb::ParticipantConfig::LOG, logger, and rsb::ParticipantConfig::PRINT.
Referenced by deliver(), and filter().
void rsb::eventprocessing::ParallelEventReceivingStrategy::printContents | ( | std::ostream & | stream | ) | const |
Definition at line 69 of file ParallelEventReceivingStrategy.cpp.
References errorStrategy, errorStrategyMutex, filters, and filtersMutex.
|
virtual |
Implements rsb::eventprocessing::EventReceivingStrategy.
Definition at line 207 of file ParallelEventReceivingStrategy.cpp.
References filters, and filtersMutex.
|
virtual |
Removes a handler that will will then not be notified anymore.
handler | handler to remove |
wait | if 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.
|
virtual |
Defines the strategy to use for handling dispatching errors to the client handler.
strategy | the new strategy to use |
Implements rsb::eventprocessing::PushEventReceivingStrategy.
Definition at line 75 of file ParallelEventReceivingStrategy.cpp.
References errorStrategy, and errorStrategyMutex.
|
private |
Definition at line 100 of file ParallelEventReceivingStrategy.h.
Referenced by handleDispatchError(), printContents(), and setHandlerErrorStrategy().
|
mutableprivate |
Definition at line 99 of file ParallelEventReceivingStrategy.h.
Referenced by handleDispatchError(), printContents(), and setHandlerErrorStrategy().
|
private |
Definition at line 97 of file ParallelEventReceivingStrategy.h.
Referenced by addFilter(), filter(), printContents(), and removeFilter().
|
mutableprivate |
Definition at line 96 of file ParallelEventReceivingStrategy.h.
Referenced by addFilter(), filter(), printContents(), and removeFilter().
|
private |
Definition at line 93 of file ParallelEventReceivingStrategy.h.
Referenced by deliver(), filter(), and handleDispatchError().
|
private |
Definition at line 94 of file ParallelEventReceivingStrategy.h.
Referenced by addHandler(), handle(), ParallelEventReceivingStrategy(), removeHandler(), and ~ParallelEventReceivingStrategy().