From b8a07ae38aa6d5dae8b642ce863a17f94f7d7c17 Mon Sep 17 00:00:00 2001 From: bala Date: Sun, 5 Nov 2000 13:43:43 +0000 Subject: *** empty log message *** --- TAO/tao/Client_Strategy_Factory.cpp | 6 --- TAO/tao/Client_Strategy_Factory.h | 3 -- TAO/tao/Connection_Cache_Manager.cpp | 27 +++++++++++-- TAO/tao/Connection_Cache_Manager.h | 14 ++++--- TAO/tao/Connection_Cache_Manager.inl | 1 + TAO/tao/Connection_Handler.cpp | 12 ------ TAO/tao/Connection_Handler.h | 15 +------ TAO/tao/ORB_Core.cpp | 5 +++ TAO/tao/Resource_Factory.cpp | 8 +++- TAO/tao/Resource_Factory.h | 3 ++ TAO/tao/SHMIOP_Connect.cpp | 19 +++++++++ TAO/tao/SHMIOP_Endpoint.cpp | 12 ++++++ TAO/tao/SHMIOP_Endpoint.h | 5 +++ TAO/tao/TAO_Internal.cpp | 4 +- TAO/tao/UIOP_Connect.cpp | 77 +++++++++++++++++++++++++++--------- TAO/tao/UIOP_Transport.cpp | 33 ++++------------ TAO/tao/UIOP_Transport.h | 1 - TAO/tao/default_client.cpp | 35 +--------------- TAO/tao/default_client.h | 4 -- TAO/tao/default_resource.cpp | 36 ++++++++++++++++- TAO/tao/default_resource.h | 11 ++++++ 21 files changed, 202 insertions(+), 129 deletions(-) diff --git a/TAO/tao/Client_Strategy_Factory.cpp b/TAO/tao/Client_Strategy_Factory.cpp index 0d954abd9a6..032cfcaca8e 100644 --- a/TAO/tao/Client_Strategy_Factory.cpp +++ b/TAO/tao/Client_Strategy_Factory.cpp @@ -30,12 +30,6 @@ TAO_Client_Strategy_Factory::create_wait_strategy (TAO_Transport *) return 0; } -ACE_Lock * -TAO_Client_Strategy_Factory::create_cached_connector_lock (void) -{ - return 0; -} - ACE_Lock * TAO_Client_Strategy_Factory::create_ft_service_retention_id_lock (void) { diff --git a/TAO/tao/Client_Strategy_Factory.h b/TAO/tao/Client_Strategy_Factory.h index 9e00b4b9507..48760e2920a 100644 --- a/TAO/tao/Client_Strategy_Factory.h +++ b/TAO/tao/Client_Strategy_Factory.h @@ -56,9 +56,6 @@ public: virtual TAO_Wait_Strategy *create_wait_strategy (TAO_Transport *transport); // Create the correct client strategy. - virtual ACE_Lock *create_cached_connector_lock (void); - // Create the lock to be used by the cached connector. - virtual ACE_Lock *create_ft_service_retention_id_lock (void); // Create a lock to be used by the TAO_Fault_Tolerant_Service class // to generate unique retention ids diff --git a/TAO/tao/Connection_Cache_Manager.cpp b/TAO/tao/Connection_Cache_Manager.cpp index e7a22468a5a..5b1034fe61d 100644 --- a/TAO/tao/Connection_Cache_Manager.cpp +++ b/TAO/tao/Connection_Cache_Manager.cpp @@ -1,7 +1,8 @@ #include "tao/Connection_Cache_Manager.h" #include "tao/Connection_Handler.h" #include "tao/debug.h" - +#include "tao/ORB_core.h" +#include "tao/Resource_Factory.h" #if !defined (__ACE_INLINE__) # include "tao/Connection_Cache_Manager.inl" @@ -13,10 +14,10 @@ ACE_RCSID(tao, Connection_Cache_Hash_Manager, "$Id$") TAO_Connection_Cache_Manager:: TAO_Connection_Cache_Manager (void) - : cache_map_ () + : cache_map_ (), + cache_lock_ (0) { - ACE_NEW (this->cache_lock_, - ACE_Lock_Adapter); + } TAO_Connection_Cache_Manager::~TAO_Connection_Cache_Manager (void) @@ -25,7 +26,25 @@ TAO_Connection_Cache_Manager::~TAO_Connection_Cache_Manager (void) delete this->cache_lock_; } +int +TAO_Connection_Cache_Manager::open (TAO_ORB_Core *orb_core, + size_t size) +{ + // Create the cache_lock + this->cache_lock_ = + orb_core->resource_factory ()->create_cached_connection_lock (); + + if (this->cache_lock_ == 0) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("TAO (%P|%t) ERROR TAO_Connection_Cache_Manager::open "), + ACE_TEXT ("Lock creation error \n")), + -1); + } + // Now open the cache map + return this->cache_map_.open (size); +} int TAO_Connection_Cache_Manager::bind_i (TAO_Cache_ExtId &ext_id, diff --git a/TAO/tao/Connection_Cache_Manager.h b/TAO/tao/Connection_Cache_Manager.h index fb023d084a6..0158211697f 100644 --- a/TAO/tao/Connection_Cache_Manager.h +++ b/TAO/tao/Connection_Cache_Manager.h @@ -34,8 +34,7 @@ #pragma warning(disable:4250) #endif /* _MSC_VER */ -class TAO_Cache_ExtId; -class TAO_Cache_IntId; +class TAO_ORB_Core; class TAO_Export TAO_Connection_Cache_Manager { @@ -49,6 +48,11 @@ class TAO_Export TAO_Connection_Cache_Manager // connections. This class protects the entries with a lock. The // map can be updated only by holding the lock. + // General Note: This class at present has an interface that may + // not be needed. But, the interface has just been copied from + // the ACE Hash Map Manager classes. The interface wold be + // pruned once I get the purging stuff also in. Till then let + // the interface be there as it is. public: // Some useful typedef's @@ -85,9 +89,9 @@ public: // Check the Connection Cache to check whether the connection exists // in the Cache and return the connection - int open (size_t size = ACE_DEFAULT_MAP_SIZE, - ACE_Allocator *alloc = 0); - // Initialize a with elements. + int open (TAO_ORB_Core *orb_core, + size_t size = ACE_DEFAULT_MAP_SIZE); + // Initialize the lock and the with elements. int bind (TAO_Cache_ExtId &ext_id, TAO_Cache_IntId &int_id); diff --git a/TAO/tao/Connection_Cache_Manager.inl b/TAO/tao/Connection_Cache_Manager.inl index 6a3f7c518f3..0eb245b2531 100644 --- a/TAO/tao/Connection_Cache_Manager.inl +++ b/TAO/tao/Connection_Cache_Manager.inl @@ -35,6 +35,7 @@ TAO_Connection_Cache_Manager:: return retval; } + ACE_INLINE int TAO_Connection_Cache_Manager::bind (TAO_Cache_ExtId &ext_id, TAO_Cache_IntId &int_id) diff --git a/TAO/tao/Connection_Handler.cpp b/TAO/tao/Connection_Handler.cpp index 0239471ef6e..a32c953509d 100644 --- a/TAO/tao/Connection_Handler.cpp +++ b/TAO/tao/Connection_Handler.cpp @@ -116,15 +116,3 @@ TAO_Connection_Handler::svc_i (void) return result; } - -ACE_Time_Value * -TAO_Connection_Handler::handle_timeout_i (const ACE_Time_Value &, - const void *) -{ - // - // This method is called when buffering timer expires. - // - - - return 0; -} diff --git a/TAO/tao/Connection_Handler.h b/TAO/tao/Connection_Handler.h index 38568891fd3..7a37242b07f 100644 --- a/TAO/tao/Connection_Handler.h +++ b/TAO/tao/Connection_Handler.h @@ -58,8 +58,7 @@ class TAO_Connection_Handler // details. It is just to be safe so that, we can reuse this // class for any messaging protocol underneath. This way we need // not touch the Cache setup even when using other protocols (I - // mean messaging). BUT, I doubt whether this abstraction will - // satisfy the needs of other messaging protocols. (will not?). + // mean messaging). public: @@ -114,17 +113,7 @@ protected: virtual int handle_input_i (ACE_HANDLE = ACE_INVALID_HANDLE, ACE_Time_Value *max_wait_time = 0) = 0; - // Need to be implemented by the underlying protocol - - ACE_Time_Value *handle_timeout_i (const ACE_Time_Value &, - const void *); - // Implementation of the method handle_timout () which would be - // called when the buffering timer expires. - - int handle_cleanup_i (ACE_Reactor *reactor, - ACE_Event_Handler *handler); - // Implementation of the call handle_cleanup () in - // Service_Handler. + // Need to be implemented by the underlying protocol objects private: diff --git a/TAO/tao/ORB_Core.cpp b/TAO/tao/ORB_Core.cpp index ff18f7d78b0..c4209486b50 100644 --- a/TAO/tao/ORB_Core.cpp +++ b/TAO/tao/ORB_Core.cpp @@ -1178,6 +1178,11 @@ TAO_ORB_Core::init (int &argc, char *argv[], CORBA::Environment &ACE_TRY_ENV) this, this->orb_params ()->preconnects ()); + // Open the Connection Cache + // @@ This seems to be a nice place to configure the connection + // cache for the number of allowed entries + this->connection_cache_.open (this); + // As a last step perform initializations of the service callbacks this->services_callbacks_init (); diff --git a/TAO/tao/Resource_Factory.cpp b/TAO/tao/Resource_Factory.cpp index aa38fa299e5..63a1e7dd4db 100644 --- a/TAO/tao/Resource_Factory.cpp +++ b/TAO/tao/Resource_Factory.cpp @@ -13,7 +13,7 @@ ACE_RCSID(tao, Resource_Factory, "$Id$") TAO_Cached_Connector_Lock::TAO_Cached_Connector_Lock (TAO_ORB_Core *orb_core) { - this->lock_ = orb_core->client_factory ()->create_cached_connector_lock (); + //this->lock_ = orb_core->client_factory ()->create_cached_connector_lock (); } TAO_Cached_Connector_Lock::~TAO_Cached_Connector_Lock (void) @@ -169,6 +169,12 @@ TAO_Resource_Factory::get_parser_names (char **&, return 0; } +ACE_Lock * +TAO_Resource_Factory::create_cached_connection_lock (void) +{ + return 0; +} + #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class ACE_Dynamic_Service; diff --git a/TAO/tao/Resource_Factory.h b/TAO/tao/Resource_Factory.h index 1e638bde3ce..47bc256d8a5 100644 --- a/TAO/tao/Resource_Factory.h +++ b/TAO/tao/Resource_Factory.h @@ -188,6 +188,9 @@ public: virtual int get_parser_names (char **&names, int &number_of_names); + + virtual ACE_Lock *create_cached_connection_lock (void); + // Creates the lock for the lock needed in the Cache Map }; #include "ace/post.h" diff --git a/TAO/tao/SHMIOP_Connect.cpp b/TAO/tao/SHMIOP_Connect.cpp index baeb11e05d3..442171a1a1f 100644 --- a/TAO/tao/SHMIOP_Connect.cpp +++ b/TAO/tao/SHMIOP_Connect.cpp @@ -13,6 +13,7 @@ #include "tao/GIOP_Message_Acceptors.h" #include "tao/GIOP_Message_Lite.h" #include "tao/Server_Strategy_Factory.h" +#include "tao/SHMIOP_Endpoint.h" #if !defined (__ACE_INLINE__) # include "tao/SHMIOP_Connect.i" @@ -133,6 +134,24 @@ TAO_SHMIOP_Server_Connection_Handler::open (void*) if (this->peer ().get_remote_addr (addr) == -1) return -1; + // Construct an SHMIOP_Endpoint object + TAO_SHMIOP_Endpoint endpoint (addr, + 0); + + // Construct a property object + TAO_Base_Connection_Property prop (&endpoint); + + // Add the handler to Cache + if (this->orb_core ()->connection_cache ().cache_handler (&prop, + this) == -1) + { + if (TAO_debug_level > 4) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("TAO (%P|%t) unable to cache the handle \n"))); + } + } + if (TAO_debug_level > 0) { char client[MAXHOSTNAMELEN + 16]; diff --git a/TAO/tao/SHMIOP_Endpoint.cpp b/TAO/tao/SHMIOP_Endpoint.cpp index d638f9c1a84..6eae512485a 100644 --- a/TAO/tao/SHMIOP_Endpoint.cpp +++ b/TAO/tao/SHMIOP_Endpoint.cpp @@ -27,6 +27,18 @@ TAO_SHMIOP_Endpoint::TAO_SHMIOP_Endpoint (const ACE_MEM_Addr &addr, this->set (addr.get_remote_addr (), use_dotted_decimal_addresses); } +TAO_SHMIOP_Endpoint::TAO_SHMIOP_Endpoint (const ACE_INET_Addr &addr, + int use_dotted_decimal_addresses) + : TAO_Endpoint (TAO_TAG_SHMEM_PROFILE), + host_ (), + port_ (0), + object_addr_ (addr), + hint_ (0), + next_ (0) +{ + this->set (addr, use_dotted_decimal_addresses); +} + TAO_SHMIOP_Endpoint::TAO_SHMIOP_Endpoint (const char *host, CORBA::UShort port, const ACE_INET_Addr &addr) diff --git a/TAO/tao/SHMIOP_Endpoint.h b/TAO/tao/SHMIOP_Endpoint.h index 9f8b6681e5c..48c54128258 100644 --- a/TAO/tao/SHMIOP_Endpoint.h +++ b/TAO/tao/SHMIOP_Endpoint.h @@ -64,6 +64,11 @@ public: int use_dotted_decimal_addresses); // Constructor. + TAO_SHMIOP_Endpoint (const ACE_INET_Addr &addr, + int use_dotted_decimal_addresses); + // Constructor. -- More of a extension of the previous one. One of + // them need to go. We will decide about that as time goes by. + TAO_SHMIOP_Endpoint (const char *host, CORBA::UShort port, CORBA::Short priority); diff --git a/TAO/tao/TAO_Internal.cpp b/TAO/tao/TAO_Internal.cpp index 749c336ebe6..82f7d7d056f 100644 --- a/TAO/tao/TAO_Internal.cpp +++ b/TAO/tao/TAO_Internal.cpp @@ -79,8 +79,8 @@ TAO_Internal::open_services (int &argc, insert (&ace_svc_desc_TAO_UIOP_Protocol_Factory); #endif /* TAO_HAS_UIOP == 1 */ #if TAO_HAS_SHMIOP == 1 - /*ACE_Service_Config::static_svcs ()-> - insert (&ace_svc_desc_TAO_SHMIOP_Protocol_Factory);*/ + ACE_Service_Config::static_svcs ()-> + insert (&ace_svc_desc_TAO_SHMIOP_Protocol_Factory); #endif /* TAO_HAS_UIOP == 1 */ // add descriptor to list of static objects. ACE_Service_Config::static_svcs ()-> diff --git a/TAO/tao/UIOP_Connect.cpp b/TAO/tao/UIOP_Connect.cpp index afbed219ac1..7b2ae81f9d0 100644 --- a/TAO/tao/UIOP_Connect.cpp +++ b/TAO/tao/UIOP_Connect.cpp @@ -128,6 +128,24 @@ TAO_UIOP_Server_Connection_Handler::open (void*) if (this->peer ().get_remote_addr (addr) == -1) return -1; + // Construct an UIOP_Endpoint object + TAO_UIOP_Endpoint endpoint (addr, + 0); + + // Construct a property object + TAO_Base_Connection_Property prop (&endpoint); + + // Add the handler to Cache + if (this->orb_core ()->connection_cache ().cache_handler (&prop, + this) == -1) + { + if (TAO_debug_level > 4) + { + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("TAO (%P|%t) unable to cache the handle \n"))); + } + } + if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("TAO (%P|%t) UIOP connection from client ") @@ -183,16 +201,15 @@ TAO_UIOP_Server_Connection_Handler::handle_close (ACE_HANDLE handle, --this->refcount_; if (this->refcount_ == 0) { - // Remove the handle from the ORB Core's handle set so that it - // isn't included in the set that is passed to the reactor upon - // ORB destruction. - TAO_Server_Strategy_Factory *f = - this->orb_core ()->server_factory (); + // Set the flag to indicate that it is no longer registered with + // the reactor, so that it isn't included in the set that is + // passed to the reactor on ORB destruction. + this->is_registered (0); - /*if (f->activate_server_connections () == 0) - (void) this->orb_core ()->remove_handle (handle);*/ + // Decrement the reference count + this->decr_ref_count (); - return TAO_UIOP_SVC_HANDLER::handle_close (handle, rm); + //return TAO_UIOP_SVC_HANDLER::handle_close (handle, rm); } return 0; @@ -238,7 +255,8 @@ TAO_UIOP_Server_Connection_Handler::handle_input_i (ACE_HANDLE, { --this->refcount_; if (this->refcount_ == 0) - this->TAO_UIOP_SVC_HANDLER::handle_close (); + this->decr_ref_count (); + // this->TAO_UIOP_SVC_HANDLER::handle_close (); return result; } @@ -276,7 +294,8 @@ TAO_UIOP_Server_Connection_Handler::handle_input_i (ACE_HANDLE, --this->refcount_; if (this->refcount_ == 0) - this->TAO_UIOP_SVC_HANDLER::handle_close (); + this->decr_ref_count (); + // this->TAO_UIOP_SVC_HANDLER::handle_close (); return result; } @@ -286,6 +305,8 @@ TAO_UIOP_Server_Connection_Handler::fetch_handle (void) { return this->get_handle (); } + + // **************************************************************** TAO_UIOP_Client_Connection_Handler:: @@ -314,7 +335,17 @@ TAO_UIOP_Client_Connection_Handler (ACE_Thread_Manager *t, TAO_UIOP_Client_Connection_Handler::~TAO_UIOP_Client_Connection_Handler (void) { - //no-op + // If the socket has not already been closed. + if (this->transport_.handle () != ACE_INVALID_HANDLE) + { + // Cannot deal with errors, and therefore they are ignored. + this->transport_.send_buffered_messages (); + } + else + { + // Dequeue messages and delete message blocks. + this->transport_.dequeue_all (); + } } // @@ Should I do something here to enable non-blocking?? (Alex). @@ -384,9 +415,9 @@ TAO_UIOP_Client_Connection_Handler::handle_timeout (const ACE_Time_Value &, TAO_Stub *stub = 0; int has_timeout; - this->orb_core_->call_timeout_hook (stub, - has_timeout, - *max_wait_time); + this->orb_core ()->call_timeout_hook (stub, + has_timeout, + *max_wait_time); // Cannot deal with errors, and therefore they are ignored. this->transport ()->send_buffered_messages (max_wait_time); @@ -442,11 +473,17 @@ TAO_UIOP_Client_Connection_Handler::handle_close_i (ACE_HANDLE handle, int TAO_UIOP_Client_Connection_Handler::handle_cleanup (void) { - // Call the implementation. - /*this->handle_cleanup_i (this->reactor (), - this);*/ + // Call the implementation. + if (this->reactor ()) + { + // Make sure there are no timers. + this->reactor ()->cancel_timer (this); + } + this->peer ().close (); + // Now do the decerment of the ref count + this->decr_ref_count (); return 0; } @@ -461,8 +498,12 @@ TAO_UIOP_Client_Connection_Handler::fetch_handle (void) #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) +template class ACE_Svc_Handler; + #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +#pragma instantiate ACE_Svc_Handler + #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ -#endif /* TAO_HAS_UIOP == 1 */ +#endif /*TAO_HAS_UIOP == 1*/ diff --git a/TAO/tao/UIOP_Transport.cpp b/TAO/tao/UIOP_Transport.cpp index bfa301bad8b..caf5b1cd21a 100644 --- a/TAO/tao/UIOP_Transport.cpp +++ b/TAO/tao/UIOP_Transport.cpp @@ -66,17 +66,6 @@ TAO_UIOP_Transport::TAO_UIOP_Transport (TAO_ORB_Core *orb_core) TAO_UIOP_Transport::~TAO_UIOP_Transport (void) { - // If the socket has not already been closed. - if (this->handle () != ACE_INVALID_HANDLE) - { - // Cannot deal with errors, and therefore they are ignored. - this->send_buffered_messages (); - } - else - { - // Dequeue messages and delete message blocks. - this->dequeue_all (); - } } void @@ -158,11 +147,6 @@ TAO_UIOP_Client_Transport::start_request (TAO_ORB_Core * /*orb_core*/, { TAO_FUNCTION_PP_TIMEPROBE (TAO_UIOP_CLIENT_TRANSPORT_START_REQUEST_START); - /*const TAO_UIOP_Profile* profile = - ACE_dynamic_cast(const TAO_UIOP_Profile*, pfile);*/ - - // @@ This should be implemented in the transport object, which - // would query the profile to obtain the version... if (this->client_mesg_factory_->write_protocol_header (TAO_PLUGGABLE_MESSAGE_REQUEST, output) == 0) @@ -177,14 +161,6 @@ TAO_UIOP_Client_Transport::start_locate (TAO_ORB_Core * /*orb_core*/, CORBA::Environment &ACE_TRY_ENV) ACE_THROW_SPEC ((CORBA::SystemException)) { - //const TAO_UIOP_Profile* profile = - // ACE_dynamic_cast(const TAO_UIOP_Profile*, pfile); - - // Obtain object key. - //const TAO_ObjectKey& key = profile->object_key (); - - // @@ This should be implemented in the transport object, which - // would query the profile to obtain the version... if (this->client_mesg_factory_->write_protocol_header (TAO_PLUGGABLE_MESSAGE_LOCATEREQUEST, output) == 0) @@ -318,7 +294,14 @@ TAO_UIOP_Client_Transport::register_handler (void) if (r == this->service_handler ()->reactor ()) return 0; - return r->register_handler (this->service_handler (), + // About to be registered with the reactor, so bump the ref + // count + this->handler_->incr_ref_count (); + + // Set the flag in the Connection Handler + this->handler_->is_registered (1); + + return r->register_handler (this->handler_, ACE_Event_Handler::READ_MASK); } diff --git a/TAO/tao/UIOP_Transport.h b/TAO/tao/UIOP_Transport.h index 44c28928f27..75aa26a9a11 100644 --- a/TAO/tao/UIOP_Transport.h +++ b/TAO/tao/UIOP_Transport.h @@ -99,7 +99,6 @@ public: virtual TAO_UIOP_SVC_HANDLER *service_handler (void) = 0; // Acces the underlying connection handler -protected: }; class TAO_Export TAO_UIOP_Client_Transport : public TAO_UIOP_Transport diff --git a/TAO/tao/default_client.cpp b/TAO/tao/default_client.cpp index f8dd5e95385..c7ac53c60de 100644 --- a/TAO/tao/default_client.cpp +++ b/TAO/tao/default_client.cpp @@ -15,8 +15,7 @@ ACE_RCSID(tao, default_client, "$Id$") TAO_Default_Client_Strategy_Factory::TAO_Default_Client_Strategy_Factory (void) - : profile_lock_type_ (TAO_THREAD_LOCK), - cached_connector_lock_type_ (TAO_THREAD_LOCK) + : profile_lock_type_ (TAO_THREAD_LOCK) { // Use single thread client connection handler #if defined (TAO_USE_ST_CLIENT_CONNECTION_HANDLER) @@ -125,22 +124,7 @@ TAO_Default_Client_Strategy_Factory::parse_args (int argc, char ** argv) } } - else if (ACE_OS::strcasecmp (argv[curarg], - "-ORBConnectorLock") == 0) - { - curarg++; - if (curarg < argc) - { - char *name = argv[curarg]; - if (ACE_OS::strcasecmp (name, - "thread") == 0) - this->cached_connector_lock_type_ = TAO_THREAD_LOCK; - else if (ACE_OS::strcasecmp (name, - "null") == 0) - this->cached_connector_lock_type_ = TAO_NULL_LOCK; - } - } } return 0; } @@ -211,23 +195,6 @@ TAO_Default_Client_Strategy_Factory::create_wait_strategy (TAO_Transport *transp return ws; } -ACE_Lock * -TAO_Default_Client_Strategy_Factory::create_cached_connector_lock (void) -{ - ACE_Lock *the_lock = 0; - - if (this->cached_connector_lock_type_ == TAO_NULL_LOCK) - ACE_NEW_RETURN (the_lock, - ACE_Lock_Adapter, - 0); - else - ACE_NEW_RETURN (the_lock, - ACE_Lock_Adapter, - 0); - - return the_lock; -} - ACE_Lock * TAO_Default_Client_Strategy_Factory::create_ft_service_retention_id_lock (void) { diff --git a/TAO/tao/default_client.h b/TAO/tao/default_client.h index 8a59120c6c3..ea664af440b 100644 --- a/TAO/tao/default_client.h +++ b/TAO/tao/default_client.h @@ -53,7 +53,6 @@ public: ACE_Lock* create_profile_lock (void); TAO_Transport_Mux_Strategy *create_transport_mux_strategy (TAO_Transport *transport); TAO_Wait_Strategy *create_wait_strategy (TAO_Transport *transport); - virtual ACE_Lock *create_cached_connector_lock (void); virtual ACE_Lock *create_ft_service_retention_id_lock (void); private: @@ -84,9 +83,6 @@ private: Wait_Strategy wait_strategy_; // The wait-for-reply strategy. - - Lock_Type cached_connector_lock_type_; - // Type of lock used by the cached connector. }; #if defined (__ACE_INLINE__) diff --git a/TAO/tao/default_resource.cpp b/TAO/tao/default_resource.cpp index 5defc3a9dcc..317c23957d0 100644 --- a/TAO/tao/default_resource.cpp +++ b/TAO/tao/default_resource.cpp @@ -46,7 +46,8 @@ TAO_Default_Resource_Factory::TAO_Default_Resource_Factory (void) reactor_mask_signals_ (1), sched_policy_ (ACE_SCHED_OTHER), priority_mapping_type_ (TAO_PRIORITY_MAPPING_DIRECT), - dynamically_allocated_reactor_ (0) + dynamically_allocated_reactor_ (0), + cached_connection_lock_type_ (TAO_THREAD_LOCK) { } @@ -370,6 +371,22 @@ TAO_Default_Resource_Factory::init (int argc, char **argv) this->add_to_ior_parser_names (argv[curarg]); } } + else if (ACE_OS::strcasecmp (argv[curarg], + "-ORBConnectionLock") == 0) + { + curarg++; + if (curarg < argc) + { + char *name = argv[curarg]; + + if (ACE_OS::strcasecmp (name, + "thread") == 0) + this->cached_connection_lock_type_ = TAO_THREAD_LOCK; + else if (ACE_OS::strcasecmp (name, + "null") == 0) + this->cached_connection_lock_type_ = TAO_NULL_LOCK; + } + } return 0; } @@ -1005,6 +1022,23 @@ TAO_Default_Resource_Factory::purge_percentage (void) const return this->purge_percentage_; } +ACE_Lock * +TAO_Default_Resource_Factory::create_cached_connection_lock (void) +{ + ACE_Lock *the_lock = 0; + + if (this->cached_connection_lock_type_ == TAO_NULL_LOCK) + ACE_NEW_RETURN (the_lock, + ACE_Lock_Adapter, + 0); + else + ACE_NEW_RETURN (the_lock, + ACE_Lock_Adapter, + 0); + + return the_lock; +} + TAO_Priority_Mapping * TAO_Default_Resource_Factory::get_priority_mapping (void) { diff --git a/TAO/tao/default_resource.h b/TAO/tao/default_resource.h index 33dd502aa3d..baa81ad9e81 100644 --- a/TAO/tao/default_resource.h +++ b/TAO/tao/default_resource.h @@ -112,6 +112,7 @@ public: virtual TAO_Resource_Factory::Caching_Strategy connection_caching_strategy_type (void) const; virtual double purge_percentage (void) const; virtual TAO_Priority_Mapping *get_priority_mapping (void); + virtual ACE_Lock *create_cached_connection_lock (void); protected: virtual ACE_Reactor_Impl *allocate_reactor_impl (void) const; @@ -177,6 +178,16 @@ protected: // situation can occur when a resource factory derived from the // default one overrides the get_reactor() method but does not // override the reclaim_reactor() method. + +private: + enum Lock_Type + { + TAO_NULL_LOCK, + TAO_THREAD_LOCK + }; + + Lock_Type cached_connection_lock_type_; + // Type of lock used by the cached connector. }; #if defined (__ACE_INLINE__) -- cgit v1.2.1