this class is used to notify a subscriber with adjustable priority (always lower, than usual). Each property has a priority level. If that level is lower than the priority's of the server thread, notifications from that property are executed in a NotificationThread. The different NotificationThreads are kept in a Threadpool inside the NotificationThreadFactory. The Notifications of one NotificationThread are stored inside a queue. When the "startConsumption" conditional variable is triggered, the queue will be processed. More...
#include <NotificationThread.h>
Classes | |
class | NotificationQueueElement |
this class stores the triple context, request type, and subcycle. More... | |
Public Member Functions | |
NotificationThread (const std::string &className, const std::string ¬ificationThreadKey) | |
constructor notificationThreadKey string | |
virtual | ~NotificationThread () |
destructor | |
void | addNotificationEvent (MultiplexingContext &muxContext, RequestType &reqType, std::vector< std::string > &validCS, SubscriptionFilter *subFilter) |
this method adds a new notification event to the queue | |
bool | removeNotificationEvent (SubscriptionFilter *subFilter) |
On an "unsubscribe" the queue has to be cleaned from all instances of the subscriber, before the subscriber can be removed from the subscription tree. | |
Mutex & | getMutex () |
Returns the mutex associated to this NotificationThread instance. | |
Private Member Functions | |
void | run () |
As soon, as the Thread is started, it will wait for the ConditionVariable to trigger. As soon as a trigger is recieved, the class will empty the queue and notify all NotificationDevices on it. | |
Private Attributes | |
std::deque< boost::shared_ptr < NotificationQueueElement > > | queue_ |
queue used to store the "Notification Events" | |
SubscriptionFilter * | inUseSubFilter_ |
Mutex | mutexQueue_ |
mutex protecting the access to the queue (The stl-message queue is not thread-save!!) | |
Mutex | mutexBackThread_ |
mutex dedicated to this specific instance of notification and used to protect rdaListener notified from a notificationThread | |
ConditionalVariable | startConsumption_ |
The startConsumption is triggered as soon as all Notifications are put into the queue. |
this class is used to notify a subscriber with adjustable priority (always lower, than usual). Each property has a priority level. If that level is lower than the priority's of the server thread, notifications from that property are executed in a NotificationThread. The different NotificationThreads are kept in a Threadpool inside the NotificationThreadFactory. The Notifications of one NotificationThread are stored inside a queue. When the "startConsumption" conditional variable is triggered, the queue will be processed.
Definition at line 28 of file NotificationThread.h.
fesa::NotificationThread::NotificationThread | ( | const std::string & | className, | |
const std::string & | notificationThreadKey | |||
) |
constructor notificationThreadKey string
Definition at line 27 of file NotificationThread.cpp.
References fesa::DiagnosticUtils::framework, fesa::AbstractEquipment::getDeviceDataFileName(), fesa::AbstractEquipment::getDiagnostics(), fesa::AbstractEquipment::getInstance(), fesa::FesaException::getMessage(), fesa::Thread::getPriority(), fesa::AbstractEquipment::getProcessConfiguration(), fesa::DiagnosticUtils::DiagnosticMessage::msg, fesa::DiagnosticUtils::server, fesa::Thread::setPriority(), fesa::DiagnosticUtils::DiagnosticMessage::side, fesa::DiagnosticUtils::DiagnosticMessage::source, and fesa::Thread::start().
fesa::NotificationThread::~NotificationThread | ( | ) | [virtual] |
destructor
Definition at line 60 of file NotificationThread.cpp.
void fesa::NotificationThread::addNotificationEvent | ( | MultiplexingContext & | muxContext, | |
RequestType & | reqType, | |||
std::vector< std::string > & | validCS, | |||
SubscriptionFilter * | subFilter | |||
) |
this method adds a new notification event to the queue
muxContext | the corresponding Multiplexing Context | |
reqType | indicates whether the notification is due to a get, set or immediate update | |
subscriber | the Subscriber that is notified |
Definition at line 64 of file NotificationThread.cpp.
References mutexQueue_, queue_, fesa::ConditionalVariable::signal(), and startConsumption_.
Referenced by fesa::SubscriptionFilter::notify().
Mutex & fesa::NotificationThread::getMutex | ( | ) | [inline] |
Returns the mutex associated to this NotificationThread instance.
Definition at line 138 of file NotificationThread.h.
References mutexBackThread_.
Referenced by fesa::SubscriptionFilter::addSubscriber(), fesa::SubscriptionFilter::doUpdate(), fesa::SubscriptionFilter::notify(), and fesa::SubscriptionFilter::removeSubscriber().
bool fesa::NotificationThread::removeNotificationEvent | ( | SubscriptionFilter * | subFilter | ) |
On an "unsubscribe" the queue has to be cleaned from all instances of the subscriber, before the subscriber can be removed from the subscription tree.
subscriber | the Subscriber that is removed |
Definition at line 76 of file NotificationThread.cpp.
References inUseSubFilter_, mutexQueue_, and queue_.
Referenced by fesa::SubscriptionFilter::removeSubscriber().
void fesa::NotificationThread::run | ( | ) | [private, virtual] |
As soon, as the Thread is started, it will wait for the ConditionVariable to trigger. As soon as a trigger is recieved, the class will empty the queue and notify all NotificationDevices on it.
Implements fesa::Thread.
Definition at line 98 of file NotificationThread.cpp.
References fesa::SubscriptionFilter::doUpdate(), fesa::Thread::hasFinished_, inUseSubFilter_, fesa::Thread::isRunning_, mutexQueue_, queue_, startConsumption_, and fesa::ConditionalVariable::wait().
Definition at line 119 of file NotificationThread.h.
Referenced by removeNotificationEvent(), and run().
mutex dedicated to this specific instance of notification and used to protect rdaListener notified from a notificationThread
Definition at line 130 of file NotificationThread.h.
Referenced by getMutex().
Mutex fesa::NotificationThread::mutexQueue_ [private] |
mutex protecting the access to the queue (The stl-message queue is not thread-save!!)
Definition at line 124 of file NotificationThread.h.
Referenced by addNotificationEvent(), removeNotificationEvent(), and run().
std::deque<boost::shared_ptr<NotificationQueueElement> > fesa::NotificationThread::queue_ [private] |
queue used to store the "Notification Events"
Definition at line 117 of file NotificationThread.h.
Referenced by addNotificationEvent(), removeNotificationEvent(), and run().
The startConsumption is triggered as soon as all Notifications are put into the queue.
Definition at line 135 of file NotificationThread.h.
Referenced by addNotificationEvent(), and run().