TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, > Class Template Reference

TAO_ESF_Delayed_Operations. More...

#include <ESF_Delayed_Changes.h>

Inheritance diagram for TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, >:

Inheritance graph
[legend]
Collaboration diagram for TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, >:

Collaboration graph
[legend]
List of all members.

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_

Detailed Description

template<class PROXY, class COLLECTION, class ITERATOR, ACE_SYNCH_DECL>
class TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, >

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.


Member Typedef Documentation

template<class PROXY, class COLLECTION, class ITERATOR, ACE_SYNCH_DECL >
typedef TAO_ESF_Busy_Lock_Adapter<TAO_ESF_Delayed_Changes<PROXY,COLLECTION,ITERATOR,ACE_SYNCH_USE> > TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, >::Busy_Lock [private]
 

Definition at line 118 of file ESF_Delayed_Changes.h.

template<class PROXY, class COLLECTION, class ITERATOR, ACE_SYNCH_DECL >
typedef TAO_ESF_Connected_Command<TAO_ESF_Delayed_Changes<PROXY,COLLECTION,ITERATOR,ACE_SYNCH_USE>,PROXY> TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, >::Connected_Command
 

Definition at line 103 of file ESF_Delayed_Changes.h.

Referenced by TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, >::connected().

template<class PROXY, class COLLECTION, class ITERATOR, ACE_SYNCH_DECL >
typedef TAO_ESF_Disconnected_Command<TAO_ESF_Delayed_Changes<PROXY,COLLECTION,ITERATOR,ACE_SYNCH_USE>,PROXY> TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, >::Disconnected_Command
 

Definition at line 105 of file ESF_Delayed_Changes.h.

Referenced by TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, >::disconnected().

template<class PROXY, class COLLECTION, class ITERATOR, ACE_SYNCH_DECL >
typedef TAO_ESF_Reconnected_Command<TAO_ESF_Delayed_Changes<PROXY,COLLECTION,ITERATOR,ACE_SYNCH_USE>,PROXY> TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, >::Reconnected_Command
 

Definition at line 104 of file ESF_Delayed_Changes.h.

Referenced by TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, >::reconnected().

template<class PROXY, class COLLECTION, class ITERATOR, ACE_SYNCH_DECL >
typedef TAO_ESF_Shutdown_Command<TAO_ESF_Delayed_Changes<PROXY,COLLECTION,ITERATOR,ACE_SYNCH_USE> > TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, >::Shutdown_Command
 

Definition at line 106 of file ESF_Delayed_Changes.h.

Referenced by TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, >::shutdown().


Constructor & Destructor Documentation

template<class PROXY, class COLLECTION, class ITERATOR, ACE_SYNCH_DECL >
TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, >::TAO_ESF_Delayed_Changes void   ) 
 

template<class PROXY, class COLLECTION, class ITERATOR, ACE_SYNCH_DECL >
TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, >::TAO_ESF_Delayed_Changes const COLLECTION &  collection  ) 
 


Member Function Documentation

template<class PROXY, class COLLECTION, class ITERATOR, ACE_SYNCH_DECL >
int TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, >::busy void   ) 
 

template<class PROXY, class C, class I, ACE_SYNCH_DECL >
void TAO_ESF_Delayed_Changes< PROXY, C, I, >::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 110 of file ESF_Delayed_Changes.cpp.

References ACE_GUARD_THROW_EX, ACE_NEW, ACE_SYNCH_MUTEX_T, TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, >::busy_count_, TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, >::command_queue_, TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, >::Connected_Command, TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, >::connected_i(), ACE_Unbounded_Queue< ACE_Command_Base * >::enqueue_tail(), and TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, >::write_delay_count_.

00111 {
00112   ACE_GUARD_THROW_EX (ACE_SYNCH_MUTEX_T, ace_mon, this->busy_lock_,
00113       CORBA::INTERNAL ());
00114 
00115   proxy->_incr_refcnt ();
00116   if (this->busy_count_ == 0)
00117     {
00118       // We can add the object immediately
00119       this->connected_i (proxy);
00120     }
00121   else
00122     {
00123       ACE_Command_Base* command = 0;
00124       ACE_NEW (command,
00125                Connected_Command (this,
00126                                   proxy));
00127       this->command_queue_.enqueue_tail (command);
00128       this->write_delay_count_++;
00129     }
00130 }

template<class PROXY, class C, class I, ACE_SYNCH_DECL >
TAO_BEGIN_VERSIONED_NAMESPACE_DECL void TAO_ESF_Delayed_Changes< PROXY, C, I, >::connected_i PROXY *  proxy  ) 
 

Definition at line 9 of file ESF_Delayed_Changes.inl.

Referenced by TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, >::connected().

00010 {
00011   this->collection_.connected (proxy);
00012 }

template<class PROXY, class C, class I, ACE_SYNCH_DECL >
void TAO_ESF_Delayed_Changes< PROXY, C, I, >::disconnected PROXY *  proxy  )  [virtual]
 

Remove an element from the collection.

Implements TAO_ESF_Proxy_Collection< PROXY >.

Definition at line 158 of file ESF_Delayed_Changes.cpp.

References ACE_GUARD_THROW_EX, ACE_NEW, ACE_SYNCH_MUTEX_T, TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, >::busy_count_, TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, >::command_queue_, TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, >::Disconnected_Command, TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, >::disconnected_i(), ACE_Unbounded_Queue< ACE_Command_Base * >::enqueue_tail(), and TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, >::write_delay_count_.

00159 {
00160   ACE_GUARD_THROW_EX (ACE_SYNCH_MUTEX_T, ace_mon, this->busy_lock_,
00161       CORBA::INTERNAL ());
00162 
00163   if (this->busy_count_ == 0)
00164     {
00165       // We can remove the object immediately
00166       this->disconnected_i (proxy);
00167     }
00168   else
00169     {
00170       ACE_Command_Base* command;
00171       ACE_NEW (command,
00172                Disconnected_Command (this,
00173                                      proxy));
00174       this->command_queue_.enqueue_tail (command);
00175       this->write_delay_count_++;
00176     }
00177 }

template<class PROXY, class C, class I, ACE_SYNCH_DECL >
void TAO_ESF_Delayed_Changes< PROXY, C, I, >::disconnected_i PROXY *  proxy  ) 
 

Definition at line 23 of file ESF_Delayed_Changes.inl.

Referenced by TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, >::disconnected().

00024 {
00025   this->collection_.disconnected (proxy);
00026 }

template<class PROXY, class COLLECTION, class ITERATOR, ACE_SYNCH_DECL >
int TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, >::execute_delayed_operations void   ) 
 

Referenced by TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, ACE_SYNCH_USE >::idle().

template<class PROXY, class COLLECTION, class ITERATOR, ACE_SYNCH_DECL >
virtual void TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, >::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 >.

template<class PROXY, class COLLECTION, class ITERATOR, ACE_SYNCH_DECL >
int TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, >::idle void   ) 
 

template<class PROXY, class C, class I, ACE_SYNCH_DECL >
void TAO_ESF_Delayed_Changes< PROXY, C, I, >::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 134 of file ESF_Delayed_Changes.cpp.

References ACE_GUARD_THROW_EX, ACE_NEW, ACE_SYNCH_MUTEX_T, TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, >::busy_count_, TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, >::command_queue_, ACE_Unbounded_Queue< ACE_Command_Base * >::enqueue_tail(), TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, >::Reconnected_Command, TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, >::reconnected_i(), and TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, >::write_delay_count_.

00135 {
00136   ACE_GUARD_THROW_EX (ACE_SYNCH_MUTEX_T, ace_mon, this->busy_lock_,
00137       CORBA::INTERNAL ());
00138 
00139   proxy->_incr_refcnt ();
00140   if (this->busy_count_ == 0)
00141     {
00142       // We can reconnect the object immediately
00143       this->reconnected_i (proxy);
00144     }
00145   else
00146     {
00147       ACE_Command_Base* command;
00148       ACE_NEW (command,
00149                Reconnected_Command (this,
00150                                     proxy));
00151       this->command_queue_.enqueue_tail (command);
00152       this->write_delay_count_++;
00153     }
00154 }

template<class PROXY, class C, class I, ACE_SYNCH_DECL >
void TAO_ESF_Delayed_Changes< PROXY, C, I, >::reconnected_i PROXY *  proxy  ) 
 

Definition at line 16 of file ESF_Delayed_Changes.inl.

Referenced by TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, >::reconnected().

00017 {
00018   this->collection_.reconnected (proxy);
00019 }

template<class PROXY, class C, class I, ACE_SYNCH_DECL >
void TAO_ESF_Delayed_Changes< PROXY, C, I, >::shutdown void   )  [virtual]
 

The EC is shutting down, must release all the elements.

Implements TAO_ESF_Proxy_Collection< PROXY >.

Definition at line 180 of file ESF_Delayed_Changes.cpp.

References ACE_GUARD_THROW_EX, ACE_NEW, ACE_SYNCH_MUTEX_T, TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, >::busy_count_, TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, >::command_queue_, ACE_Unbounded_Queue< ACE_Command_Base * >::enqueue_tail(), TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, >::Shutdown_Command, TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, >::shutdown_i(), and TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, >::write_delay_count_.

00181 {
00182   ACE_GUARD_THROW_EX (ACE_SYNCH_MUTEX_T, ace_mon, this->busy_lock_,
00183       CORBA::INTERNAL ());
00184 
00185   if (this->busy_count_ == 0)
00186     {
00187       // We can shutdown the object immediately
00188       this->shutdown_i ();
00189     }
00190   else
00191     {
00192       ACE_Command_Base* command;
00193       ACE_NEW (command,
00194                Shutdown_Command (this));
00195       this->command_queue_.enqueue_tail (command);
00196       this->write_delay_count_++;
00197     }
00198 }

template<class PROXY, class C, class I, ACE_SYNCH_DECL >
void TAO_ESF_Delayed_Changes< PROXY, C, I, >::shutdown_i void   ) 
 

Definition at line 30 of file ESF_Delayed_Changes.inl.

Referenced by TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, >::shutdown().

00031 {
00032   this->collection_.shutdown ();
00033 }


Member Data Documentation

template<class PROXY, class COLLECTION, class ITERATOR, ACE_SYNCH_DECL >
ACE_SYNCH_CONDITION_T TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, >::busy_cond_ [private]
 

Definition at line 124 of file ESF_Delayed_Changes.h.

template<class PROXY, class COLLECTION, class ITERATOR, ACE_SYNCH_DECL >
CORBA::ULong TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, >::busy_count_ [private]
 

Definition at line 126 of file ESF_Delayed_Changes.h.

Referenced by TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, >::connected(), TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, >::disconnected(), TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, >::reconnected(), and TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, >::shutdown().

template<class PROXY, class COLLECTION, class ITERATOR, ACE_SYNCH_DECL >
CORBA::ULong TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, >::busy_hwm_ [private]
 

Control variables for the concurrency policies.

Definition at line 131 of file ESF_Delayed_Changes.h.

template<class PROXY, class COLLECTION, class ITERATOR, ACE_SYNCH_DECL >
ACE_SYNCH_MUTEX_T TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, >::busy_lock_ [private]
 

Definition at line 122 of file ESF_Delayed_Changes.h.

template<class PROXY, class COLLECTION, class ITERATOR, ACE_SYNCH_DECL >
COLLECTION TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, >::collection_ [private]
 

Definition at line 116 of file ESF_Delayed_Changes.h.

template<class PROXY, class COLLECTION, class ITERATOR, ACE_SYNCH_DECL >
ACE_Unbounded_Queue<ACE_Command_Base*> TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, >::command_queue_ [private]
 

Definition at line 134 of file ESF_Delayed_Changes.h.

Referenced by TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, >::connected(), TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, >::disconnected(), TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, >::reconnected(), and TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, >::shutdown().

template<class PROXY, class COLLECTION, class ITERATOR, ACE_SYNCH_DECL >
Busy_Lock TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, >::lock_ [private]
 

Definition at line 120 of file ESF_Delayed_Changes.h.

template<class PROXY, class COLLECTION, class ITERATOR, ACE_SYNCH_DECL >
CORBA::ULong TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, >::max_write_delay_ [private]
 

Definition at line 132 of file ESF_Delayed_Changes.h.

template<class PROXY, class COLLECTION, class ITERATOR, ACE_SYNCH_DECL >
CORBA::ULong TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, >::write_delay_count_ [private]
 

Definition at line 128 of file ESF_Delayed_Changes.h.

Referenced by TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, >::connected(), TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, >::disconnected(), TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, >::reconnected(), and TAO_ESF_Delayed_Changes< PROXY, COLLECTION, ITERATOR, >::shutdown().


The documentation for this class was generated from the following files:
Generated on Sun Jan 27 13:38:50 2008 for TAO_ESF by doxygen 1.3.6