diff options
author | Phil Mesnier <mesnier_p@ociweb.com> | 2014-06-12 23:22:31 +0000 |
---|---|---|
committer | Phil Mesnier <mesnier_p@ociweb.com> | 2014-06-12 23:22:31 +0000 |
commit | 0794ea53a958bcda1beca139758d5739836b6b26 (patch) | |
tree | 70fd233cff87dd4258ada26eaff00cc86f40f1a5 | |
parent | c300dad17fc9b8c4fff16f3c587358cc71a27fb9 (diff) | |
download | ATCD-0794ea53a958bcda1beca139758d5739836b6b26.tar.gz |
Thu Jun 12 23:16:02 UTC 2014 Phil Mesnier <mesnier_p@ociweb.com>
* orbsvcs/orbsvcs/Naming/Storable_Naming_Context.cpp:
Reintroduce synchronization in the new_context operation, since
updates a shared object ID counter.
-rw-r--r-- | TAO/ChangeLog | 6 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Naming/Storable_Naming_Context.cpp | 74 |
2 files changed, 49 insertions, 31 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index 75a8b72fbc0..4e7c14fa96c 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,9 @@ +Thu Jun 12 23:16:02 UTC 2014 Phil Mesnier <mesnier_p@ociweb.com> + + * orbsvcs/orbsvcs/Naming/Storable_Naming_Context.cpp: + Reintroduce synchronization in the new_context operation, since + updates a shared object ID counter. + Thu Jun 12 17:41:06 UTC 2014 Phil Mesnier <mesnier_p@ociweb.com> * orbsvcs/ImplRepo_Service/AsyncAccessManager.cpp: diff --git a/TAO/orbsvcs/orbsvcs/Naming/Storable_Naming_Context.cpp b/TAO/orbsvcs/orbsvcs/Naming/Storable_Naming_Context.cpp index f7fae341591..a56d9a03418 100644 --- a/TAO/orbsvcs/orbsvcs/Naming/Storable_Naming_Context.cpp +++ b/TAO/orbsvcs/orbsvcs/Naming/Storable_Naming_Context.cpp @@ -544,42 +544,54 @@ TAO_Storable_Naming_Context::make_new_context ( CosNaming::NamingContext_ptr TAO_Storable_Naming_Context::new_context (void) { - ACE_TRACE("new_context"); + ACE_TRACE ("new_context"); - TAO_NS_Persistence_Global global; - TAO_Storable_Naming_Context_ReaderWriter rw(*gfl_.get()); - - if(redundant_) + char object_id[BUFSIZ]; { - // acquire a lock on the file that holds our counter - if (gfl_->open() != 0) + ACE_WRITE_GUARD_THROW_EX (ACE_SYNCH_RW_MUTEX, ace_mon, + this->lock_, + CORBA::INTERNAL ()); + + File_Open_Lock_and_Check flck (this, SFG::MUTATOR); + if (this->destroyed_) + throw CORBA::OBJECT_NOT_EXIST (); + + TAO_NS_Persistence_Global global; + TAO_Storable_Naming_Context_ReaderWriter rw (*gfl_.get ()); + + if (redundant_) { - delete gfl_.release(); - throw CORBA::PERSIST_STORE(); + // acquire a lock on the file that holds our counter + if (gfl_->open () != 0) + { + delete gfl_.release (); + throw CORBA::PERSIST_STORE (); + } + if (gfl_->flock (0, 0, 0) != 0) + { + throw CORBA::INTERNAL (); + } + // get the counter from disk + rw.read_global (global); + gcounter_ = global.counter (); + // use it to generate a new name } - if (gfl_ -> flock(0, 0, 0) != 0) - throw CORBA::INTERNAL(); - // get the counter from disk - rw.read_global(global); - gcounter_ = global.counter(); - // use it to generate a new name - } - // Generate an Object id for the new context. - char object_id[BUFSIZ]; - ACE_OS::sprintf (object_id, - "%s_%d", - root_name_, - gcounter_++); - // then save it back on disk - global.counter (gcounter_); - rw.write_global (global); - if (redundant_) - { - // and release our lock - if (gfl_ -> flock(0, 0, 0) != 0) - throw CORBA::INTERNAL(); - gfl_->close(); + // Generate an Object id for the new context. + ACE_OS::sprintf (object_id, + "%s_%d", + root_name_, + gcounter_++); + // then save it back on disk + global.counter (gcounter_); + rw.write_global (global); + if (redundant_) + { + // and release our lock + if (gfl_->funlock(0, 0, 0) != 0) + throw CORBA::INTERNAL(); + gfl_->close(); + } } // Create a new context. |