void TAO_MonitorConsumerAdmin::register_stats_controls ( TAO_MonitorEventChannel* mec, const ACE_CString& base) { // Set up the statistic name, create it and register it this->stat_name_ = base + "/"; this->queue_size_stat_name_ = stat_name_ + NotifyMonitoringExt::EventChannelQueueSize; ACE_NEW_THROW_EX (this->queue_size_, Monitor_Base (this->queue_size_stat_name_.c_str (), Monitor_Control_Types::MC_NUMBER), CORBA::NO_MEMORY ()); if (!mec->register_statistic (this->queue_size_stat_name_, this->queue_size_)) { // The constructor sets the refcount to 1 so this call will // delete the pointer. this->queue_size_->remove_ref (); this->queue_size_ = 0; throw NotifyMonitoringExt::NameAlreadyUsed (); } this->overflow_stat_name_ = stat_name_ + NotifyMonitoringExt::EventChannelQueueOverflows; ACE_NEW_THROW_EX (this->overflows_, Monitor_Base (this->overflow_stat_name_.c_str (), Monitor_Control_Types::MC_COUNTER), CORBA::NO_MEMORY ()); if (!mec->register_statistic (this->overflow_stat_name_, this->overflows_)) { delete this->overflows_; this->overflows_ = 0; throw NotifyMonitoringExt::NameAlreadyUsed (); } this->control_name_ = base; ConsumerAdminControl* control = 0; ACE_NEW_THROW_EX (control, ConsumerAdminControl (mec, this->control_name_.c_str (), this->id ()), CORBA::NO_MEMORY ()); TAO_Control_Registry* cinstance = TAO_Control_Registry::instance (); if (!cinstance->add (control)) { delete control; ORBSVCS_ERROR ((LM_ERROR, "Unable to add control: %s\n", this->control_name_.c_str ())); } }
TAO_MonitorSupplierAdmin::~TAO_MonitorSupplierAdmin (void) { // First, make sure we can get down to the real ec type TAO_MonitorEventChannel* ec = dynamic_cast<TAO_MonitorEventChannel*> (this->ec_.get ()); if (ec != 0) { ec->remove_supplieradmin (this->id ()); TAO_Control_Registry* cinstance = TAO_Control_Registry::instance (); cinstance->remove (this->control_name_); } }
void TAO_MonitorConsumerAdmin::remove (void) { // First, make sure we can get down to the real ec type TAO_MonitorEventChannel* ec = dynamic_cast<TAO_MonitorEventChannel*> (this->ec_.get ()); if (ec != 0) { ec->unregister_statistic (this->queue_size_stat_name_); ec->unregister_statistic (this->overflow_stat_name_); ec->unregister_statistic (this->stat_name_); ec->remove_consumeradmin (this->id ()); TAO_Control_Registry* cinstance = TAO_Control_Registry::instance (); cinstance->remove (this->control_name_); } // We don't own queue_size_, so we must not delete it }
void TAO_MonitorSupplierAdmin::register_stats_controls ( TAO_MonitorEventChannel* mec, const ACE_CString& base) { this->control_name_ = base; SupplierAdminControl* control = 0; ACE_NEW_THROW_EX (control, SupplierAdminControl (mec, this->control_name_.c_str (), this->id ()), CORBA::NO_MEMORY ()); TAO_Control_Registry* cinstance = TAO_Control_Registry::instance (); if (!cinstance->add (control)) { delete control; ORBSVCS_ERROR ((LM_ERROR, "Unable to add control: %s\n", this->control_name_.c_str ())); } }
void NotificationServiceMonitor_i::send_control_command (const char* name, const char* cmd) { TAO_Control_Registry* instance = TAO_Control_Registry::instance (); TAO_NS_Control* control = instance->get (name); // If we didn't find a control object with the given name, or the // execution of the control object failed, we must throw an exception. // The control object execution should only return false when the // command given does not correspond to one that is supported by the // control object. if (control == 0 || !control->execute (cmd)) { Monitor::NameList invalid (1); invalid.length (1); invalid[0] = name; throw CosNotification::NotificationServiceMonitorControl::InvalidName (invalid); } }