00001
00002
00003 #include "orbsvcs/Notify/AdminProperties.h"
00004
00005 #if ! defined (__ACE_INLINE__)
00006 #include "orbsvcs/Notify/AdminProperties.inl"
00007 #endif
00008
00009 ACE_RCSID (Notify,
00010 TAO_Notify_AdminProperties,
00011 "AdminProperties.cpp,v 1.13 2006/03/14 06:14:34 jtc Exp")
00012
00013 #include "orbsvcs/CosNotificationC.h"
00014
00015 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00016
00017 TAO_Notify_AdminProperties::TAO_Notify_AdminProperties (void)
00018 : max_global_queue_length_ (CosNotification::MaxQueueLength, 0)
00019 , max_consumers_ (CosNotification::MaxConsumers, 0)
00020 , max_suppliers_ (CosNotification::MaxSuppliers, 0)
00021 , reject_new_events_ (CosNotification::RejectNewEvents, 0)
00022 , global_queue_length_ (0)
00023 , global_queue_not_full_ (global_queue_lock_)
00024 {
00025 }
00026
00027 TAO_Notify_AdminProperties::~TAO_Notify_AdminProperties ()
00028 {
00029 }
00030
00031 int
00032 TAO_Notify_AdminProperties::init (const CosNotification::PropertySeq& prop_seq)
00033 {
00034 if (TAO_Notify_PropertySeq::init (prop_seq) != 0)
00035 return -1;
00036
00037 this->max_global_queue_length_.set (*this);
00038 this->max_consumers_.set (*this);
00039 this->max_suppliers_.set (*this);
00040 this->reject_new_events_.set (*this);
00041
00042
00043
00044
00045 return 0;
00046 }
00047
00048 void
00049 TAO_Notify_AdminProperties::init ()
00050 {
00051
00052 ACE_ASSERT(this->size() == 0);
00053
00054 if (this->max_global_queue_length_.is_valid())
00055 {
00056 CORBA::Any a;
00057 a <<= this->max_global_queue_length_.value();
00058 this->add(this->max_global_queue_length_.name(), a);
00059 }
00060 if (this->max_consumers_.is_valid())
00061 {
00062 CORBA::Any a;
00063 a <<= this->max_consumers_.value();
00064 this->add(this->max_consumers_.name(), a);
00065 }
00066 if (this->max_suppliers_.is_valid())
00067 {
00068 CORBA::Any a;
00069 a <<= this->max_suppliers_.value();
00070 this->add(this->max_suppliers_.name(), a);
00071 }
00072 if (this->reject_new_events_.is_valid())
00073 {
00074 CORBA::Any a;
00075 a <<= CORBA::Any::from_boolean(this->reject_new_events_.value());
00076 this->add(this->reject_new_events_.name(), a);
00077 }
00078 }
00079
00080 CORBA::Boolean
00081 TAO_Notify_AdminProperties::queue_full (void)
00082 {
00083 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->global_queue_lock_, 1);
00084
00085 if (this->max_global_queue_length () == 0)
00086 return 0;
00087 else
00088 if (this->global_queue_length_ >= this->max_global_queue_length ().value ())
00089 return 1;
00090
00091 return 0;
00092 }
00093
00094 TAO_END_VERSIONED_NAMESPACE_DECL