diff options
author | jtc <jtc@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2006-06-13 15:27:44 +0000 |
---|---|---|
committer | jtc <jtc@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2006-06-13 15:27:44 +0000 |
commit | 40849cdb2fa6ef51f565c111d137818d5a080f53 (patch) | |
tree | 15ca803f35fc3bc950f70f279f885212aec306cf | |
parent | da32d63c15f008a0c1d48a9b7ea73bf577833161 (diff) | |
download | ATCD-40849cdb2fa6ef51f565c111d137818d5a080f53.tar.gz |
ChangeLogTag: Tue Jun 13 15:24:52 UTC 2006 J.T. Conklin <jtc@acorntoolworks.com>
-rw-r--r-- | TAO/ChangeLog | 41 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Log/Hash_LogRecordStore.cpp | 47 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Log/Hash_LogRecordStore.h | 9 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Log/Hash_LogStore.cpp | 15 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Log/Hash_LogStore.h | 6 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Log/Hash_Persistence_Strategy.cpp | 5 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Log/Hash_Persistence_Strategy.h | 2 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Log/LogMgr_i.cpp | 20 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Log/LogMgr_i.h | 6 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Log/Log_Persistence_Strategy.h | 2 |
10 files changed, 127 insertions, 26 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index 456ee7b8a6c..f5adee4ae60 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,44 @@ +Tue Jun 13 15:24:52 UTC 2006 J.T. Conklin <jtc@acorntoolworks.com> + + * orbsvcs/orbsvcs/Log/Hash_LogRecordStore.cpp + * orbsvcs/orbsvcs/Log/Hash_LogRecordStore.h + + Removed orb, added LogMgr argument to constructor. + + Changed constructor to create a new log-channel specific poa + for iterators. Activate iterators in the new poa. + + Changed destructor to destroy the new poa, which ensures any + interators that may exist will be destroyed at the same time + as the log channel. This fixes bugzilla bug #2551. + + * orbsvcs/orbsvcs/Log/Hash_LogStore.cpp + * orbsvcs/orbsvcs/Log/Hash_LogStore.h + + Removed orb argument from constructor. + Changed to pass LogMgr to Hash_LogRecordStore constructor. + + * orbsvcs/orbsvcs/Log/Hash_Persistence_Strategy.cpp: + + Changed to pass only LogMgr to Hash_LogStore constructor. + + * orbsvcs/orbsvcs/Log/Hash_Persistence_Strategy.cpp: + * orbsvcs/orbsvcs/Log/Hash_Persistence_Strategy.h: + * orbsvcs/orbsvcs/Log/Log_Persistence_Strategy.h: + + Removed orb argument from create_log_store(). + + * orbsvcs/orbsvcs/Log/LogMgr_i.cpp + * orbsvcs/orbsvcs/Log/LogMgr_i.h + + Added orb(), factory_poa(), and log_poa() methods. We're + changing most objects to have a reference to the LogMgr, so we + don't have pass orbs and poas around, especially for the cases + where we're already passing the LogMgr. + + Changed to pass only "this" to strategy's create_log_store() + method. + Tue Jun 13 14:56:01 UTC 2006 J.T. Conklin <jtc@acorntoolworks.com> * orbsvcs/orbsvcs/Log/Log_i.cpp: diff --git a/TAO/orbsvcs/orbsvcs/Log/Hash_LogRecordStore.cpp b/TAO/orbsvcs/orbsvcs/Log/Hash_LogRecordStore.cpp index aeee88a88df..10447ce0199 100644 --- a/TAO/orbsvcs/orbsvcs/Log/Hash_LogRecordStore.cpp +++ b/TAO/orbsvcs/orbsvcs/Log/Hash_LogRecordStore.cpp @@ -1,8 +1,10 @@ +#include "orbsvcs/Log/LogMgr_i.h" #include "orbsvcs/Log/Hash_LogRecordStore.h" #include "orbsvcs/Log/Hash_Iterator_i.h" #include "orbsvcs/Log/Log_Constraint_Interpreter.h" #include "orbsvcs/Log/Log_Constraint_Visitors.h" #include "orbsvcs/Time_Utilities.h" +#include "tao/Utils/PolicyList_Destroyer.h" #include "tao/AnyTypeCode/Any_Unknown_IDL_Type.h" #include "tao/ORB_Core.h" #include "tao/debug.h" @@ -15,12 +17,13 @@ ACE_RCSID (Log, TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_Hash_LogRecordStore::TAO_Hash_LogRecordStore ( - CORBA::ORB_ptr orb, + TAO_LogMgr_i* logmgr_i, DsLogAdmin::LogId logid, DsLogAdmin::LogFullActionType log_full_action, CORBA::ULongLong max_size, const DsLogAdmin::CapacityAlarmThresholdList* thresholds) - : maxid_ (0), + : logmgr_i_ (logmgr_i), + maxid_ (0), max_size_ (max_size), id_ (logid), current_size_ (0), @@ -31,7 +34,7 @@ TAO_Hash_LogRecordStore::TAO_Hash_LogRecordStore ( forward_state_ (DsLogAdmin::on), log_full_action_ (log_full_action), max_record_life_ (0), - reactor_ (orb->orb_core ()->reactor ()) + reactor_ (logmgr_i_->orb()->orb_core ()->reactor ()) { interval_.start = 0; interval_.stop = 0; @@ -48,11 +51,36 @@ TAO_Hash_LogRecordStore::TAO_Hash_LogRecordStore ( this->log_qos_.length(1); this->log_qos_[0] = DsLogAdmin::QoSNone; + + PortableServer::POA_ptr log_poa = + logmgr_i_->log_poa(); + + // Create POA for iterators + TAO::Utils::PolicyList_Destroyer policies (3); + policies.length (3); + + policies[0] = + log_poa->create_lifespan_policy (PortableServer::TRANSIENT); + policies[1] = + log_poa->create_id_assignment_policy (PortableServer::SYSTEM_ID); + policies[2] = + log_poa->create_servant_retention_policy (PortableServer::RETAIN); + + char buf[32]; + ACE_OS::snprintf (buf, sizeof (buf), "Log%d", (int) id_); + + PortableServer::POAManager_var poa_manager = + log_poa->the_POAManager (); + + this->iterator_poa_ = + log_poa->create_POA(buf, PortableServer::POAManager::_nil(), policies); } TAO_Hash_LogRecordStore::~TAO_Hash_LogRecordStore (void) { - // No-Op. + ACE_DEBUG((LM_DEBUG, "TAO_Hash_LogRecordStore::~TAO_Hash_LogRecordStore ()\n")); + this->iterator_poa_->destroy (1, 0); + ACE_DEBUG((LM_DEBUG, "TAO_Hash_LogRecordStore::~TAO_Hash_LogRecordStore ()\n")); } int @@ -417,7 +445,7 @@ TAO_Hash_LogRecordStore::query_i (const char *constraint, TAO_Hash_Iterator_i *iter_query = 0; ACE_NEW_THROW_EX (iter_query, TAO_Hash_Iterator_i (this->reactor_, - this, + this, iter, iter_end, count, @@ -430,8 +458,13 @@ TAO_Hash_LogRecordStore::query_i (const char *constraint, PortableServer::ServantBase_var safe_iter_query = iter_query; // Activate it. - iter_out = iter_query->_this (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (rec_list); + PortableServer::ObjectId_var oid = + this->iterator_poa_->activate_object (iter_query); + CORBA::Object_var obj = + this->iterator_poa_->id_to_reference (oid); + + // Narrow it + iter_out = DsLogAdmin::Iterator::_narrow (obj.in ()); } return rec_list; diff --git a/TAO/orbsvcs/orbsvcs/Log/Hash_LogRecordStore.h b/TAO/orbsvcs/orbsvcs/Log/Hash_LogRecordStore.h index 41ac94a11f9..d4518fd3825 100644 --- a/TAO/orbsvcs/orbsvcs/Log/Hash_LogRecordStore.h +++ b/TAO/orbsvcs/orbsvcs/Log/Hash_LogRecordStore.h @@ -29,12 +29,15 @@ #include "ace/Null_Mutex.h" #include "ace/RW_Thread_Mutex.h" #include "ace/Reactor.h" +#include "tao/PortableServer/PortableServer.h" #include "orbsvcs/Log/log_serv_export.h" #define LOG_DEFAULT_MAX_REC_LIST_LEN 100 TAO_BEGIN_VERSIONED_NAMESPACE_DECL +class TAO_LogMgr_i; + /** * @class TAO_Hash_LogRecordStore * @@ -63,7 +66,7 @@ class TAO_Log_Serv_Export TAO_Hash_LogRecordStore // = Initialization and termination methods /// Constructor. - TAO_Hash_LogRecordStore (CORBA::ORB_ptr orb, + TAO_Hash_LogRecordStore (TAO_LogMgr_i* logmgr, DsLogAdmin::LogId id, DsLogAdmin::LogFullActionType log_full_action, CORBA::ULongLong max_size, @@ -328,6 +331,8 @@ protected: /// The size of a LogRecord size_t log_record_size(const DsLogAdmin::LogRecord &rec); + TAO_LogMgr_i* logmgr_i_; + /// Assigned to a new RecordId and then incremented /// @@ Should I have a list of reclaimed id's for when records are /// deleted? @@ -383,6 +388,8 @@ protected: ACE_Reactor* reactor_; + PortableServer::POA_var iterator_poa_; + mutable ACE_SYNCH_RW_MUTEX lock_; }; diff --git a/TAO/orbsvcs/orbsvcs/Log/Hash_LogStore.cpp b/TAO/orbsvcs/orbsvcs/Log/Hash_LogStore.cpp index 3d4ab499e89..458cfca4155 100644 --- a/TAO/orbsvcs/orbsvcs/Log/Hash_LogStore.cpp +++ b/TAO/orbsvcs/orbsvcs/Log/Hash_LogStore.cpp @@ -9,10 +9,9 @@ ACE_RCSID (Log, TAO_BEGIN_VERSIONED_NAMESPACE_DECL -TAO_Hash_LogStore::TAO_Hash_LogStore(CORBA::ORB_ptr orb, TAO_LogMgr_i* mgr) +TAO_Hash_LogStore::TAO_Hash_LogStore(TAO_LogMgr_i* logmgr_i) : next_id_ (0), - orb_ (CORBA::ORB::_duplicate (orb)), - mgr_ (mgr) + logmgr_i_ (logmgr_i) { } @@ -57,8 +56,8 @@ TAO_Hash_LogStore::list_logs (ACE_ENV_SINGLE_ARG_DECL) { iter.next (hash_entry); iter.advance (); - (*list)[i] = mgr_->create_log_reference (static_cast<DsLogAdmin::LogId> (hash_entry->ext_id_) - ACE_ENV_ARG_PARAMETER); + (*list)[i] = logmgr_i_->create_log_reference (static_cast<DsLogAdmin::LogId> (hash_entry->ext_id_) + ACE_ENV_ARG_PARAMETER); } return list; @@ -125,7 +124,7 @@ TAO_Hash_LogStore::find_log (DsLogAdmin::LogId id } else { - return mgr_->create_log_reference (id ACE_ENV_ARG_PARAMETER); + return logmgr_i_->create_log_reference (id ACE_ENV_ARG_PARAMETER); } } @@ -187,7 +186,7 @@ TAO_Hash_LogStore::create(DsLogAdmin::LogFullActionType full_action, TAO_Hash_LogRecordStore* impl = 0; ACE_NEW_THROW_EX (impl, - TAO_Hash_LogRecordStore (this->orb_.in (), + TAO_Hash_LogRecordStore (this->logmgr_i_, id, full_action, max_size, @@ -227,7 +226,7 @@ TAO_Hash_LogStore::create_with_id (DsLogAdmin::LogId id, TAO_Hash_LogRecordStore* impl = 0; ACE_NEW_THROW_EX (impl, - TAO_Hash_LogRecordStore (this->orb_.in (), + TAO_Hash_LogRecordStore (this->logmgr_i_, id, full_action, max_size, diff --git a/TAO/orbsvcs/orbsvcs/Log/Hash_LogStore.h b/TAO/orbsvcs/orbsvcs/Log/Hash_LogStore.h index e56fd676a30..7c43c34a8a7 100644 --- a/TAO/orbsvcs/orbsvcs/Log/Hash_LogStore.h +++ b/TAO/orbsvcs/orbsvcs/Log/Hash_LogStore.h @@ -45,7 +45,7 @@ public: // = Initialization and Termination Methods /// Constructor. - TAO_Hash_LogStore (CORBA::ORB_ptr orb, TAO_LogMgr_i* mgr); + TAO_Hash_LogStore (TAO_LogMgr_i* mgr); /// Destructor. virtual ~TAO_Hash_LogStore (); @@ -120,9 +120,7 @@ private: /// taken by create_with_id(). DsLogAdmin::LogId next_id_; - CORBA::ORB_var orb_; - - TAO_LogMgr_i* mgr_; + TAO_LogMgr_i* logmgr_i_; }; TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Log/Hash_Persistence_Strategy.cpp b/TAO/orbsvcs/orbsvcs/Log/Hash_Persistence_Strategy.cpp index 91f7c455423..3d8882352c6 100644 --- a/TAO/orbsvcs/orbsvcs/Log/Hash_Persistence_Strategy.cpp +++ b/TAO/orbsvcs/orbsvcs/Log/Hash_Persistence_Strategy.cpp @@ -17,10 +17,9 @@ TAO_Hash_Persistence_Strategy::~TAO_Hash_Persistence_Strategy() } TAO_LogStore * -TAO_Hash_Persistence_Strategy::create_log_store(CORBA::ORB_ptr orb, - TAO_LogMgr_i *mgr) +TAO_Hash_Persistence_Strategy::create_log_store(TAO_LogMgr_i *logmgr_i) { - return new TAO_Hash_LogStore (orb, mgr); + return new TAO_Hash_LogStore (logmgr_i); } TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Log/Hash_Persistence_Strategy.h b/TAO/orbsvcs/orbsvcs/Log/Hash_Persistence_Strategy.h index 3c55c9a730f..43f5e4a6ae5 100644 --- a/TAO/orbsvcs/orbsvcs/Log/Hash_Persistence_Strategy.h +++ b/TAO/orbsvcs/orbsvcs/Log/Hash_Persistence_Strategy.h @@ -47,7 +47,7 @@ public: /// @brief Log Store Factory virtual TAO_LogStore* - create_log_store (CORBA::ORB_ptr orb, TAO_LogMgr_i* mgr); + create_log_store (TAO_LogMgr_i* mgr); private: }; diff --git a/TAO/orbsvcs/orbsvcs/Log/LogMgr_i.cpp b/TAO/orbsvcs/orbsvcs/Log/LogMgr_i.cpp index 1137822914f..23bb04d2ea1 100644 --- a/TAO/orbsvcs/orbsvcs/Log/LogMgr_i.cpp +++ b/TAO/orbsvcs/orbsvcs/Log/LogMgr_i.cpp @@ -112,7 +112,7 @@ TAO_LogMgr_i::init (CORBA::ORB_ptr orb, strategy_ = new TAO_Hash_Persistence_Strategy; } - logstore_ = strategy_->create_log_store (orb, this); + logstore_ = strategy_->create_log_store (this); } PortableServer::ObjectId* @@ -275,4 +275,22 @@ TAO_LogMgr_i::create_with_id_i (DsLogAdmin::LogId id, ACE_CHECK; } +CORBA::ORB_ptr +TAO_LogMgr_i::orb () +{ + return this->orb_.in (); +} + +PortableServer::POA_ptr +TAO_LogMgr_i::factory_poa () +{ + return this->factory_poa_.in (); +} + +PortableServer::POA_ptr +TAO_LogMgr_i::log_poa () +{ + return this->log_poa_.in (); +} + TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Log/LogMgr_i.h b/TAO/orbsvcs/orbsvcs/Log/LogMgr_i.h index 8ce52e13977..a75417898c8 100644 --- a/TAO/orbsvcs/orbsvcs/Log/LogMgr_i.h +++ b/TAO/orbsvcs/orbsvcs/Log/LogMgr_i.h @@ -145,6 +145,12 @@ public: get_log_record_store (DsLogAdmin::LogId id ACE_ENV_ARG_DECL); + CORBA::ORB_ptr orb(); + + PortableServer::POA_ptr factory_poa(); + + PortableServer::POA_ptr log_poa(); + protected: /// @brief Initialize /// diff --git a/TAO/orbsvcs/orbsvcs/Log/Log_Persistence_Strategy.h b/TAO/orbsvcs/orbsvcs/Log/Log_Persistence_Strategy.h index 3e16a89a70d..5e8832c5dee 100644 --- a/TAO/orbsvcs/orbsvcs/Log/Log_Persistence_Strategy.h +++ b/TAO/orbsvcs/orbsvcs/Log/Log_Persistence_Strategy.h @@ -49,7 +49,7 @@ class TAO_Log_Serv_Export TAO_Log_Persistence_Strategy public: /// @brief Log Store Factory virtual TAO_LogStore* - create_log_store (CORBA::ORB_ptr orb, TAO_LogMgr_i* mgr) = 0; + create_log_store (TAO_LogMgr_i* logmgr_i) = 0; private: }; |