diff options
author | bala <balanatarajan@users.noreply.github.com> | 2002-05-09 17:00:35 +0000 |
---|---|---|
committer | bala <balanatarajan@users.noreply.github.com> | 2002-05-09 17:00:35 +0000 |
commit | ecaeb3eb745cebf4de6e5afa35faeb7a7b9485f9 (patch) | |
tree | 4f61a537faefba63db6f012c6dd3aa591c51bb62 /TAO/tao/Thread_Lane_Resources.cpp | |
parent | 9b3710221c7e1bb24c2a3d4d65a25fd4dd31c005 (diff) | |
download | ATCD-ecaeb3eb745cebf4de6e5afa35faeb7a7b9485f9.tar.gz |
ChangeLogTag: Thu May 9 11:38:16 2002 Balachandran Natarajan <bala@cs.wustl.edu>
Diffstat (limited to 'TAO/tao/Thread_Lane_Resources.cpp')
-rw-r--r-- | TAO/tao/Thread_Lane_Resources.cpp | 62 |
1 files changed, 61 insertions, 1 deletions
diff --git a/TAO/tao/Thread_Lane_Resources.cpp b/TAO/tao/Thread_Lane_Resources.cpp index 100b355798b..71baf804d7e 100644 --- a/TAO/tao/Thread_Lane_Resources.cpp +++ b/TAO/tao/Thread_Lane_Resources.cpp @@ -8,8 +8,10 @@ ACE_RCSID(tao, Thread_Lane_Resources, "$Id$") #include "tao/Acceptor_Registry.h" #include "tao/Transport_Cache_Manager.h" #include "tao/Leader_Follower.h" +#include "Connector_Registry.h" #include "ace/Reactor.h" + #if !defined (__ACE_INLINE__) # include "tao/Thread_Lane_Resources.i" #endif /* ! __ACE_INLINE__ */ @@ -18,6 +20,7 @@ TAO_Thread_Lane_Resources::TAO_Thread_Lane_Resources (TAO_ORB_Core &orb_core, TAO_New_Leader_Generator *new_leader_generator) : orb_core_ (orb_core), acceptor_registry_ (0), + connector_registry_ (0), transport_cache_ (0), leader_follower_ (0), new_leader_generator_ (new_leader_generator) @@ -30,6 +33,7 @@ TAO_Thread_Lane_Resources::TAO_Thread_Lane_Resources (TAO_ORB_Core &orb_core, TAO_Thread_Lane_Resources::~TAO_Thread_Lane_Resources (void) { + } TAO_Transport_Cache_Manager & @@ -59,9 +63,15 @@ TAO_Thread_Lane_Resources::acceptor_registry (void) // Double check. if (this->acceptor_registry_ == 0) { - ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->lock_, *this->acceptor_registry_); + // @@todo: Wouldnt this crash big time if you happen to + // dereference a null-pointer? Needs fixing. + ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, + ace_mon, + this->lock_, + *this->acceptor_registry_); if (this->acceptor_registry_ == 0) { + // @@ Not exception safe code // Get the resource factory. TAO_Resource_Factory &resource_factory = *this->orb_core_.resource_factory (); @@ -75,6 +85,46 @@ TAO_Thread_Lane_Resources::acceptor_registry (void) return *this->acceptor_registry_; } +TAO_Connector_Registry * +TAO_Thread_Lane_Resources::connector_registry (ACE_ENV_SINGLE_ARG_DECL) +{ + // Double check. + if (this->connector_registry_ == 0) + { + ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, + ace_mon, + this->lock_, + 0); + + if (this->connector_registry_ == 0) + { + // Ask it to create a new acceptor registry. + this->connector_registry_ = + this->orb_core_.resource_factory ()->get_connector_registry (); + + if (this->connector_registry_ == 0) + ACE_THROW_RETURN (CORBA::INITIALIZE ( + CORBA::SystemException::_tao_minor_code ( + TAO_CONNECTOR_REGISTRY_INIT_LOCATION_CODE, + 0), + CORBA::COMPLETED_NO), + 0); + } + + if (this->connector_registry_->open (&this->orb_core_) != 0) + ACE_THROW_RETURN (CORBA::INITIALIZE ( + CORBA::SystemException::_tao_minor_code ( + TAO_CONNECTOR_REGISTRY_INIT_LOCATION_CODE, + 0), + CORBA::COMPLETED_NO), + 0); + + } + + return this->connector_registry_; +} + + TAO_Leader_Follower & TAO_Thread_Lane_Resources::leader_follower (void) { @@ -95,6 +145,8 @@ TAO_Thread_Lane_Resources::leader_follower (void) return *this->leader_follower_; } + + int TAO_Thread_Lane_Resources::open_acceptor_registry (int ignore_address ACE_ENV_ARG_DECL) @@ -117,6 +169,14 @@ TAO_Thread_Lane_Resources::open_acceptor_registry (int ignore_address void TAO_Thread_Lane_Resources::finalize (void) { + // Close connectors before acceptors! + // Ask the registry to close all registered connectors. + if (this->connector_registry_ != 0) + { + this->connector_registry_->close_all (); + delete this->connector_registry_; + } + // Ask the registry to close all registered acceptors. if (this->acceptor_registry_ != 0) { |