TAO_ESF_Delayed_Operations. More...
#include <ESF_Delayed_Changes.h>
Public Types | |
typedef TAO_ESF_Connected_Command < TAO_ESF_Delayed_Changes < PROXY, COLLECTION, ITERATOR, ACE_SYNCH_USE >, PROXY > | Connected_Command |
typedef TAO_ESF_Reconnected_Command < TAO_ESF_Delayed_Changes < PROXY, COLLECTION, ITERATOR, ACE_SYNCH_USE >, PROXY > | Reconnected_Command |
typedef TAO_ESF_Disconnected_Command < TAO_ESF_Delayed_Changes < PROXY, COLLECTION, ITERATOR, ACE_SYNCH_USE >, PROXY > | Disconnected_Command |
typedef TAO_ESF_Shutdown_Command < TAO_ESF_Delayed_Changes < PROXY, COLLECTION, ITERATOR, ACE_SYNCH_USE > > | Shutdown_Command |
Public Member Functions | |
TAO_ESF_Delayed_Changes (void) | |
TAO_ESF_Delayed_Changes (const COLLECTION &collection) | |
int | busy (void) |
int | idle (void) |
int | execute_delayed_operations (void) |
void | connected_i (PROXY *proxy) |
void | reconnected_i (PROXY *proxy) |
void | disconnected_i (PROXY *proxy) |
void | shutdown_i (void) |
virtual void | for_each (TAO_ESF_Worker< PROXY > *worker) |
virtual void | connected (PROXY *proxy) |
virtual void | reconnected (PROXY *proxy) |
virtual void | disconnected (PROXY *proxy) |
Remove an element from the collection. | |
virtual void | shutdown (void) |
The EC is shutting down, must release all the elements. | |
Private Types | |
typedef TAO_ESF_Busy_Lock_Adapter < TAO_ESF_Delayed_Changes < PROXY, COLLECTION, ITERATOR, ACE_SYNCH_USE > > | Busy_Lock |
Private Attributes | |
COLLECTION | collection_ |
Busy_Lock | lock_ |
ACE_SYNCH_MUTEX_T | busy_lock_ |
ACE_SYNCH_CONDITION_T | busy_cond_ |
CORBA::ULong | busy_count_ |
CORBA::ULong | write_delay_count_ |
CORBA::ULong | busy_hwm_ |
Control variables for the concurrency policies. | |
CORBA::ULong | max_write_delay_ |
ACE_Unbounded_Queue < ACE_Command_Base * > | command_queue_ |
TAO_ESF_Delayed_Operations.
This class implements the Delayed Operations protocol to solve the concurrency challenges outlined in the documentation of TAO_ESF_Proxy_Collection. In short the class delays changes by putting them on an "operation queue", the operations are stored as command objects in this queue and executed once the system is quiescent (i.e. no threads are iterating over the collection). The algorithm implemented so far is:
Definition at line 88 of file ESF_Delayed_Changes.h.
typedef TAO_ESF_Busy_Lock_Adapter<TAO_ESF_Delayed_Changes<PROXY,COLLECTION,ITERATOR,ACE_SYNCH_USE> > TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, ACE_SYNCH_DECL >::Busy_Lock [private] |
Definition at line 118 of file ESF_Delayed_Changes.h.
typedef TAO_ESF_Connected_Command<TAO_ESF_Delayed_Changes<PROXY,COLLECTION,ITERATOR,ACE_SYNCH_USE>,PROXY> TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, ACE_SYNCH_DECL >::Connected_Command |
Definition at line 103 of file ESF_Delayed_Changes.h.
typedef TAO_ESF_Disconnected_Command<TAO_ESF_Delayed_Changes<PROXY,COLLECTION,ITERATOR,ACE_SYNCH_USE>,PROXY> TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, ACE_SYNCH_DECL >::Disconnected_Command |
Definition at line 105 of file ESF_Delayed_Changes.h.
typedef TAO_ESF_Reconnected_Command<TAO_ESF_Delayed_Changes<PROXY,COLLECTION,ITERATOR,ACE_SYNCH_USE>,PROXY> TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, ACE_SYNCH_DECL >::Reconnected_Command |
Definition at line 104 of file ESF_Delayed_Changes.h.
typedef TAO_ESF_Shutdown_Command<TAO_ESF_Delayed_Changes<PROXY,COLLECTION,ITERATOR,ACE_SYNCH_USE> > TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, ACE_SYNCH_DECL >::Shutdown_Command |
Definition at line 106 of file ESF_Delayed_Changes.h.
TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, ACE_SYNCH_DECL >::TAO_ESF_Delayed_Changes | ( | void | ) |
TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, ACE_SYNCH_DECL >::TAO_ESF_Delayed_Changes | ( | const COLLECTION & | collection | ) |
int TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, ACE_SYNCH_DECL >::busy | ( | void | ) |
void TAO_ESF_Delayed_Changes< PROXY, C, I, ACE_SYNCH_DECL >::connected | ( | PROXY * | proxy | ) | [virtual] |
Insert a new element into the collection. The collection assumes ownership of the element.
Implements TAO_ESF_Proxy_Collection< PROXY >.
Definition at line 112 of file ESF_Delayed_Changes.cpp.
{ ACE_GUARD_THROW_EX (ACE_SYNCH_MUTEX_T, ace_mon, this->busy_lock_, CORBA::INTERNAL ()); proxy->_incr_refcnt (); if (this->busy_count_ == 0) { // We can add the object immediately this->connected_i (proxy); } else { ACE_Command_Base* command = 0; ACE_NEW (command, Connected_Command (this, proxy)); this->command_queue_.enqueue_tail (command); this->write_delay_count_++; } }
void TAO_ESF_Delayed_Changes< PROXY, C, I, ACE_SYNCH_DECL >::connected_i | ( | PROXY * | proxy | ) |
Definition at line 9 of file ESF_Delayed_Changes.inl.
{ this->collection_.connected (proxy); }
void TAO_ESF_Delayed_Changes< PROXY, C, I, ACE_SYNCH_DECL >::disconnected | ( | PROXY * | proxy | ) | [virtual] |
Remove an element from the collection.
Implements TAO_ESF_Proxy_Collection< PROXY >.
Definition at line 160 of file ESF_Delayed_Changes.cpp.
{ ACE_GUARD_THROW_EX (ACE_SYNCH_MUTEX_T, ace_mon, this->busy_lock_, CORBA::INTERNAL ()); if (this->busy_count_ == 0) { // We can remove the object immediately this->disconnected_i (proxy); } else { ACE_Command_Base* command; ACE_NEW (command, Disconnected_Command (this, proxy)); this->command_queue_.enqueue_tail (command); this->write_delay_count_++; } }
void TAO_ESF_Delayed_Changes< PROXY, C, I, ACE_SYNCH_DECL >::disconnected_i | ( | PROXY * | proxy | ) |
Definition at line 23 of file ESF_Delayed_Changes.inl.
{ this->collection_.disconnected (proxy); }
int TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, ACE_SYNCH_DECL >::execute_delayed_operations | ( | void | ) |
virtual void TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, ACE_SYNCH_DECL >::for_each | ( | TAO_ESF_Worker< PROXY > * | worker | ) | [virtual] |
Iterate over the collection and invoke worker->work() for each member of the collection. This encapsulates
Implements TAO_ESF_Proxy_Collection< PROXY >.
int TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, ACE_SYNCH_DECL >::idle | ( | void | ) |
void TAO_ESF_Delayed_Changes< PROXY, C, I, ACE_SYNCH_DECL >::reconnected | ( | PROXY * | proxy | ) | [virtual] |
Insert an element into the collection. No errors can be raised if the element is already present. The collection assumes ownership, i.e. must invoke <proxy->_decr_refcnt()> if the element is already present in the collection.
Implements TAO_ESF_Proxy_Collection< PROXY >.
Definition at line 136 of file ESF_Delayed_Changes.cpp.
{ ACE_GUARD_THROW_EX (ACE_SYNCH_MUTEX_T, ace_mon, this->busy_lock_, CORBA::INTERNAL ()); proxy->_incr_refcnt (); if (this->busy_count_ == 0) { // We can reconnect the object immediately this->reconnected_i (proxy); } else { ACE_Command_Base* command; ACE_NEW (command, Reconnected_Command (this, proxy)); this->command_queue_.enqueue_tail (command); this->write_delay_count_++; } }
void TAO_ESF_Delayed_Changes< PROXY, C, I, ACE_SYNCH_DECL >::reconnected_i | ( | PROXY * | proxy | ) |
Definition at line 16 of file ESF_Delayed_Changes.inl.
{ this->collection_.reconnected (proxy); }
void TAO_ESF_Delayed_Changes< PROXY, C, I, ACE_SYNCH_DECL >::shutdown | ( | void | ) | [virtual] |
The EC is shutting down, must release all the elements.
Implements TAO_ESF_Proxy_Collection< PROXY >.
Definition at line 182 of file ESF_Delayed_Changes.cpp.
{ ACE_GUARD_THROW_EX (ACE_SYNCH_MUTEX_T, ace_mon, this->busy_lock_, CORBA::INTERNAL ()); if (this->busy_count_ == 0) { // We can shutdown the object immediately this->shutdown_i (); } else { ACE_Command_Base* command; ACE_NEW (command, Shutdown_Command (this)); this->command_queue_.enqueue_tail (command); this->write_delay_count_++; } }
void TAO_ESF_Delayed_Changes< PROXY, C, I, ACE_SYNCH_DECL >::shutdown_i | ( | void | ) |
Definition at line 30 of file ESF_Delayed_Changes.inl.
{ this->collection_.shutdown (); }
ACE_SYNCH_CONDITION_T TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, ACE_SYNCH_DECL >::busy_cond_ [private] |
Definition at line 124 of file ESF_Delayed_Changes.h.
CORBA::ULong TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, ACE_SYNCH_DECL >::busy_count_ [private] |
Definition at line 126 of file ESF_Delayed_Changes.h.
CORBA::ULong TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, ACE_SYNCH_DECL >::busy_hwm_ [private] |
Control variables for the concurrency policies.
Definition at line 131 of file ESF_Delayed_Changes.h.
ACE_SYNCH_MUTEX_T TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, ACE_SYNCH_DECL >::busy_lock_ [private] |
Definition at line 122 of file ESF_Delayed_Changes.h.
COLLECTION TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, ACE_SYNCH_DECL >::collection_ [private] |
Definition at line 116 of file ESF_Delayed_Changes.h.
ACE_Unbounded_Queue<ACE_Command_Base*> TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, ACE_SYNCH_DECL >::command_queue_ [private] |
Definition at line 134 of file ESF_Delayed_Changes.h.
Busy_Lock TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, ACE_SYNCH_DECL >::lock_ [private] |
Definition at line 120 of file ESF_Delayed_Changes.h.
CORBA::ULong TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, ACE_SYNCH_DECL >::max_write_delay_ [private] |
Definition at line 132 of file ESF_Delayed_Changes.h.
CORBA::ULong TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, ACE_SYNCH_DECL >::write_delay_count_ [private] |
Definition at line 128 of file ESF_Delayed_Changes.h.