AdminProperties.h

Go to the documentation of this file.
00001 /* -*- C++ -*- */
00002 /**
00003  *  @file AdminProperties.h
00004  *
00005  *  AdminProperties.h,v 1.12 2006/03/14 06:14:34 jtc Exp
00006  *
00007  *  @author Pradeep Gore <pradeep@oomworks.com>
00008  *
00009  *
00010  */
00011 
00012 #ifndef TAO_Notify_ADMINPROPERTIES_H
00013 #define TAO_Notify_ADMINPROPERTIES_H
00014 
00015 #include /**/ "ace/pre.h"
00016 
00017 #include "orbsvcs/Notify/notify_serv_export.h"
00018 
00019 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00020 # pragma once
00021 #endif /* ACE_LACKS_PRAGMA_ONCE */
00022 
00023 #include "orbsvcs/Notify/PropertySeq.h"
00024 #include "orbsvcs/Notify/Property_T.h"
00025 #include "orbsvcs/Notify/Property.h"
00026 #include "orbsvcs/Notify/Property_Boolean.h"
00027 
00028 #include "tao/orbconf.h"
00029 
00030 #include "ace/Atomic_Op.h"
00031 #include "ace/Bound_Ptr.h"
00032 #include "ace/Condition_Thread_Mutex.h"
00033 
00034 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00035 
00036 /**
00037  * @class TAO_Notify_AdminProperties
00038  *
00039  * @brief The AdminProperties per EventChannel.
00040  *
00041  */
00042 class TAO_Notify_Serv_Export TAO_Notify_AdminProperties
00043   : public TAO_Notify_PropertySeq
00044 {
00045 public:
00046   typedef ACE_Strong_Bound_Ptr<TAO_Notify_AdminProperties, TAO_SYNCH_MUTEX> Ptr;
00047   /// Constuctor
00048   TAO_Notify_AdminProperties (void);
00049 
00050   /// Destructor
00051   virtual ~TAO_Notify_AdminProperties ();
00052 
00053   // Init
00054   int init (const CosNotification::PropertySeq& prop_seq);
00055 
00056   // finish initialization after values are set by topology load
00057   void init ();
00058 
00059   // = Const Accessors
00060   const TAO_Notify_Property_Long& max_global_queue_length (void) const;
00061   const TAO_Notify_Property_Long& max_consumers (void) const;
00062   const TAO_Notify_Property_Long& max_suppliers (void) const;
00063   const TAO_Notify_Property_Boolean& reject_new_events (void) const;
00064 
00065   // = Non-const accessors
00066   TAO_Notify_Property_Long & max_global_queue_length (void);
00067   TAO_Notify_Property_Long & max_consumers (void);
00068   TAO_Notify_Property_Long & max_suppliers (void);
00069   TAO_Notify_Property_Boolean & reject_new_events (void);
00070 
00071   CORBA::Long& global_queue_length (void);
00072   TAO_SYNCH_MUTEX& global_queue_lock (void);
00073   TAO_SYNCH_CONDITION& global_queue_not_full (void);
00074 
00075   TAO_Notify_Atomic_Property_Long& consumers (void);
00076   TAO_Notify_Atomic_Property_Long& suppliers (void);
00077 
00078   // = Helper method
00079   /// Returns true if Queue is full
00080   CORBA::Boolean queue_full (void);
00081 
00082 protected:
00083   // @@ Pradeep can you explain why there is any maximum for these
00084   // values? Should they be configurable by the user so the resource
00085   // requirements can be bounded?
00086 
00087   // = Admin. properties
00088   // for all these properties the default O implies no limit
00089   /**
00090    * The maximum number of events that will be queued by the channel before
00091    * the channel begins discarding events or rejecting new events upon
00092    * receipt of each new event.
00093    */
00094   TAO_Notify_Property_Long max_global_queue_length_;
00095 
00096   /// The maximum number of consumers that can be connected to the channel at
00097   /// any given time.
00098   TAO_Notify_Property_Long max_consumers_;
00099 
00100   /// The maximum number of suppliers that can be connected to the channel at
00101   /// any given time.
00102   TAO_Notify_Property_Long max_suppliers_;
00103 
00104   /// Reject any new event.
00105   TAO_Notify_Property_Boolean reject_new_events_;
00106 
00107   //= Variables
00108   /// This is used to count the queue length across all buffers in the Notify Service
00109   /// to enforce the "MaxQueueLength" property.
00110   CORBA::Long global_queue_length_;
00111 
00112   /// Global queue lock used to serialize access to all queues.
00113   TAO_SYNCH_MUTEX global_queue_lock_;
00114 
00115   /// The condition that the queue_length_ is not at max.
00116   TAO_SYNCH_CONDITION global_queue_not_full_;
00117 
00118   /// These are used to count the number of consumers and suppliers connected to
00119   /// the system.
00120   TAO_Notify_Atomic_Property_Long consumers_;
00121   TAO_Notify_Atomic_Property_Long suppliers_;
00122 };
00123 
00124 
00125 TAO_END_VERSIONED_NAMESPACE_DECL
00126 
00127 #if defined (__ACE_INLINE__)
00128 #include "orbsvcs/Notify/AdminProperties.inl"
00129 #endif /* __ACE_INLINE__ */
00130 
00131 
00132 #include /**/ "ace/post.h"
00133 #endif /* TAO_Notify_ADMINPROPERTIES_H */

Generated on Thu Nov 9 13:24:08 2006 for TAO_CosNotification by doxygen 1.3.6