RSB
0.15.1
|
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, bool parallelHandlerCalls=false) | |
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 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 , |
bool | parallelHandlerCalls = false |
||
) |
Definition at line 51 of file ParallelEventReceivingStrategy.cpp.
References pool.
|
virtual |
Definition at line 62 of file ParallelEventReceivingStrategy.cpp.
References pool.
|
virtual |
Implements rsb::eventprocessing::EventReceivingStrategy.
Definition at line 203 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 191 of file ParallelEventReceivingStrategy.cpp.
References pool.
|
static |
Definition at line 46 of file ParallelEventReceivingStrategy.cpp.
Referenced by rsb::eventprocessing::registerDefaultEventProcessingStrategies().
|
private |
Definition at line 154 of file ParallelEventReceivingStrategy.cpp.
References handleDispatchError(), and logger.
|
private |
Definition at line 82 of file ParallelEventReceivingStrategy.cpp.
References filters, filtersMutex, handleDispatchError(), and logger.
string rsb::eventprocessing::ParallelEventReceivingStrategy::getClassName | ( | ) | const |
Definition at line 66 of file ParallelEventReceivingStrategy.cpp.
|
virtual |
Dispatches the event to the listener.
event | the event to dispatch |
Implements rsb::eventprocessing::EventReceivingStrategy.
Definition at line 186 of file ParallelEventReceivingStrategy.cpp.
References pool.
|
private |
Definition at line 129 of file ParallelEventReceivingStrategy.cpp.
References rsb::ParticipantConfig::ERROR_STRATEGY_EXIT, rsb::ParticipantConfig::ERROR_STRATEGY_LOG, rsb::ParticipantConfig::ERROR_STRATEGY_PRINT, errorStrategy, errorStrategyMutex, and logger.
Referenced by deliver(), and filter().
void rsb::eventprocessing::ParallelEventReceivingStrategy::printContents | ( | std::ostream & | stream | ) | const |
Definition at line 70 of file ParallelEventReceivingStrategy.cpp.
References errorStrategy, errorStrategyMutex, filters, and filtersMutex.
|
virtual |
Implements rsb::eventprocessing::EventReceivingStrategy.
Definition at line 208 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 197 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 76 of file ParallelEventReceivingStrategy.cpp.
References errorStrategy, and errorStrategyMutex.
|
private |
Definition at line 101 of file ParallelEventReceivingStrategy.h.
Referenced by handleDispatchError(), printContents(), and setHandlerErrorStrategy().
|
mutableprivate |
Definition at line 100 of file ParallelEventReceivingStrategy.h.
Referenced by handleDispatchError(), printContents(), and setHandlerErrorStrategy().
|
private |
Definition at line 98 of file ParallelEventReceivingStrategy.h.
Referenced by addFilter(), filter(), printContents(), and removeFilter().
|
mutableprivate |
Definition at line 97 of file ParallelEventReceivingStrategy.h.
Referenced by addFilter(), filter(), printContents(), and removeFilter().
|
private |
Definition at line 94 of file ParallelEventReceivingStrategy.h.
Referenced by deliver(), filter(), and handleDispatchError().
|
private |
Definition at line 95 of file ParallelEventReceivingStrategy.h.
Referenced by addHandler(), handle(), ParallelEventReceivingStrategy(), removeHandler(), and ~ParallelEventReceivingStrategy().