summaryrefslogtreecommitdiff
path: root/TAO/tao
diff options
context:
space:
mode:
authorJohnny Willemsen <jwillemsen@remedy.nl>2004-05-10 09:56:36 +0000
committerJohnny Willemsen <jwillemsen@remedy.nl>2004-05-10 09:56:36 +0000
commit6d322b748c6cf80c9e53792a1760ea1666a6ab82 (patch)
tree7591586583f4f7b0723541cec3998d25090edf55 /TAO/tao
parentc66a0514e6994c2e24c108abcee14baa0ca11cea (diff)
downloadATCD-6d322b748c6cf80c9e53792a1760ea1666a6ab82.tar.gz
ChangeLogTag: Mon May 10 09:55:21 UTC 2004 Johnny Willemsen <jwillemsen@remedy.nl>
Diffstat (limited to 'TAO/tao')
-rw-r--r--TAO/tao/Resource_Factory.cpp12
-rw-r--r--TAO/tao/Resource_Factory.h8
-rw-r--r--TAO/tao/Strategies/advanced_resource.cpp82
-rw-r--r--TAO/tao/Strategies/advanced_resource.h15
-rw-r--r--TAO/tao/Thread_Lane_Resources.cpp86
-rw-r--r--TAO/tao/Thread_Lane_Resources.h24
-rw-r--r--TAO/tao/Thread_Lane_Resources.i1
-rw-r--r--TAO/tao/default_resource.cpp20
-rw-r--r--TAO/tao/default_resource.h6
9 files changed, 222 insertions, 32 deletions
diff --git a/TAO/tao/Resource_Factory.cpp b/TAO/tao/Resource_Factory.cpp
index 47da02fff31..23e714452b3 100644
--- a/TAO/tao/Resource_Factory.cpp
+++ b/TAO/tao/Resource_Factory.cpp
@@ -138,6 +138,18 @@ TAO_Resource_Factory::output_cdr_msgblock_allocator (void)
return 0;
}
+ACE_Allocator *
+TAO_Resource_Factory::amh_response_handler_allocator (void)
+{
+ return 0;
+}
+
+ACE_Allocator *
+TAO_Resource_Factory::ami_response_handler_allocator (void)
+{
+ return 0;
+}
+
TAO_ProtocolFactorySet *
TAO_Resource_Factory::get_protocol_factories (void)
{
diff --git a/TAO/tao/Resource_Factory.h b/TAO/tao/Resource_Factory.h
index cc3ae564655..5d36035a520 100644
--- a/TAO/tao/Resource_Factory.h
+++ b/TAO/tao/Resource_Factory.h
@@ -141,7 +141,7 @@ public:
/// Return a reference to the acceptor registry.
virtual TAO_Acceptor_Registry *get_acceptor_registry (void);
- /// Return an Connector to be utilized.
+ /// Return a connector to be utilized.
virtual TAO_Connector_Registry *get_connector_registry (void);
/// @name Access the input CDR allocators.
@@ -161,6 +161,12 @@ public:
virtual ACE_Allocator* output_cdr_msgblock_allocator (void);
//@}
+ /// Access the AMH response handler allocator
+ virtual ACE_Allocator* amh_response_handler_allocator (void);
+
+ /// Access the AMI response handler allocator
+ virtual ACE_Allocator* ami_response_handler_allocator (void);
+
/**
* The protocol factory list is implemented in this class since
* a) it will be a global resource and
diff --git a/TAO/tao/Strategies/advanced_resource.cpp b/TAO/tao/Strategies/advanced_resource.cpp
index 6df7159194b..a568a151bf4 100644
--- a/TAO/tao/Strategies/advanced_resource.cpp
+++ b/TAO/tao/Strategies/advanced_resource.cpp
@@ -67,7 +67,9 @@ TAO_Resource_Factory_Changer::TAO_Resource_Factory_Changer (void)
TAO_Advanced_Resource_Factory::TAO_Advanced_Resource_Factory (void)
: reactor_type_ (TAO_REACTOR_TP),
threadqueue_type_ (TAO_THREAD_QUEUE_NOT_SET),
- cdr_allocator_type_ (TAO_ALLOCATOR_THREAD_LOCK)
+ cdr_allocator_type_ (TAO_ALLOCATOR_THREAD_LOCK),
+ amh_response_handler_allocator_lock_type_ (TAO_ALLOCATOR_THREAD_LOCK),
+ ami_response_handler_allocator_lock_type_ (TAO_ALLOCATOR_THREAD_LOCK)
{
// Constructor
}
@@ -210,6 +212,46 @@ TAO_Advanced_Resource_Factory::init (int argc, ACE_TCHAR** argv)
arg_shifter.consume_arg ();
}
else if ((current_arg = arg_shifter.get_the_parameter
+ (ACE_LIB_TEXT("-ORBAMHResponseHandlerAllocator"))))
+ {
+ if (ACE_OS::strcasecmp (current_arg,
+ ACE_LIB_TEXT("null")) == 0)
+ {
+ this->amh_response_handler_allocator_lock_type_ = TAO_ALLOCATOR_NULL_LOCK;
+ }
+ else if (ACE_OS::strcasecmp (current_arg,
+ ACE_LIB_TEXT("thread")) == 0)
+ {
+ this->amh_response_handler_allocator_lock_type_ = TAO_ALLOCATOR_THREAD_LOCK;
+ }
+ else
+ {
+ this->report_option_value_error (ACE_LIB_TEXT("-ORBAMHResponseHandlerAllocator"), current_arg);
+ }
+
+ arg_shifter.consume_arg ();
+ }
+ else if ((current_arg = arg_shifter.get_the_parameter
+ (ACE_LIB_TEXT("-ORBAMIResponseHandlerAllocator"))))
+ {
+ if (ACE_OS::strcasecmp (current_arg,
+ ACE_LIB_TEXT("null")) == 0)
+ {
+ this->ami_response_handler_allocator_lock_type_ = TAO_ALLOCATOR_NULL_LOCK;
+ }
+ else if (ACE_OS::strcasecmp (current_arg,
+ ACE_LIB_TEXT("thread")) == 0)
+ {
+ this->ami_response_handler_allocator_lock_type_ = TAO_ALLOCATOR_THREAD_LOCK;
+ }
+ else
+ {
+ this->report_option_value_error (ACE_LIB_TEXT("-ORBAMIResponseHandlerAllocator"), current_arg);
+ }
+
+ arg_shifter.consume_arg ();
+ }
+ else if ((current_arg = arg_shifter.get_the_parameter
(ACE_LIB_TEXT("-ORBReactorThreadQueue"))))
{
if (ACE_OS::strcasecmp (current_arg,
@@ -716,6 +758,44 @@ TAO_Advanced_Resource_Factory::input_cdr_msgblock_allocator (void)
return allocator;
}
+ACE_Allocator *
+TAO_Advanced_Resource_Factory::amh_response_handler_allocator (void)
+{
+ ACE_Allocator *allocator = 0;
+ switch (this->amh_response_handler_allocator_lock_type_)
+ {
+ case TAO_ALLOCATOR_NULL_LOCK:
+ ACE_NEW_RETURN (allocator,
+ NULL_LOCK_ALLOCATOR,
+ 0);
+ break;
+ default:
+ return
+ this->TAO_Default_Resource_Factory::amh_response_handler_allocator();
+ }
+
+ return allocator;
+}
+
+ACE_Allocator *
+TAO_Advanced_Resource_Factory::ami_response_handler_allocator (void)
+{
+ ACE_Allocator *allocator = 0;
+ switch (this->ami_response_handler_allocator_lock_type_)
+ {
+ case TAO_ALLOCATOR_NULL_LOCK:
+ ACE_NEW_RETURN (allocator,
+ NULL_LOCK_ALLOCATOR,
+ 0);
+ break;
+ default:
+ return
+ this->TAO_Default_Resource_Factory::ami_response_handler_allocator();
+ }
+
+ return allocator;
+}
+
int
TAO_Advanced_Resource_Factory::input_cdr_allocator_type_locked (void)
{
diff --git a/TAO/tao/Strategies/advanced_resource.h b/TAO/tao/Strategies/advanced_resource.h
index 06bff49f1d8..656b1d84816 100644
--- a/TAO/tao/Strategies/advanced_resource.h
+++ b/TAO/tao/Strategies/advanced_resource.h
@@ -46,8 +46,8 @@ public:
/// Dynamic linking hook
virtual int init (int argc, ACE_TCHAR* argv[]);
- // = Member Accessors
- enum
+ /// Type of lock used for the allocators
+ enum Allocator_Lock_Type
{
TAO_ALLOCATOR_NULL_LOCK,
TAO_ALLOCATOR_THREAD_LOCK
@@ -83,13 +83,14 @@ public:
/**
* @name Resource Retrieval
- *
*/
//@{
virtual int init_protocol_factories (void);
virtual ACE_Allocator* input_cdr_dblock_allocator (void);
virtual ACE_Allocator* input_cdr_buffer_allocator (void);
virtual ACE_Allocator* input_cdr_msgblock_allocator (void);
+ virtual ACE_Allocator* amh_response_handler_allocator (void);
+ virtual ACE_Allocator* ami_response_handler_allocator (void);
virtual int input_cdr_allocator_type_locked (void);
virtual TAO_ProtocolFactorySet *get_protocol_factories (void);
//@}
@@ -121,7 +122,13 @@ protected:
int threadqueue_type_;
/// The type of CDR allocators.
- int cdr_allocator_type_;
+ Allocator_Lock_Type cdr_allocator_type_;
+
+ /// Type of lock used by AMH response handler allocator.
+ Allocator_Lock_Type amh_response_handler_allocator_lock_type_;
+
+ /// Type of lock used by AMI response handler allocator.
+ Allocator_Lock_Type ami_response_handler_allocator_lock_type_;
virtual int load_default_protocols (void);
diff --git a/TAO/tao/Thread_Lane_Resources.cpp b/TAO/tao/Thread_Lane_Resources.cpp
index af2f70f0fd3..ed85271751c 100644
--- a/TAO/tao/Thread_Lane_Resources.cpp
+++ b/TAO/tao/Thread_Lane_Resources.cpp
@@ -15,10 +15,6 @@ ACE_RCSID (tao,
#include "ace/Reactor.h"
-#if !defined (__ACE_INLINE__)
-# include "tao/Thread_Lane_Resources.i"
-#endif /* ! __ACE_INLINE__ */
-
TAO_Thread_Lane_Resources::TAO_Thread_Lane_Resources (
TAO_ORB_Core &orb_core,
TAO_New_Leader_Generator *new_leader_generator
@@ -35,7 +31,9 @@ TAO_Thread_Lane_Resources::TAO_Thread_Lane_Resources (
transport_message_buffer_allocator_ (0),
output_cdr_dblock_allocator_ (0),
output_cdr_buffer_allocator_ (0),
- output_cdr_msgblock_allocator_ (0)
+ output_cdr_msgblock_allocator_ (0),
+ amh_response_handler_allocator_ (0),
+ ami_response_handler_allocator_ (0)
{
// Create the transport cache.
ACE_NEW (this->transport_cache_,
@@ -312,6 +310,42 @@ TAO_Thread_Lane_Resources::output_cdr_msgblock_allocator (void)
return this->output_cdr_msgblock_allocator_;
}
+ACE_Allocator*
+TAO_Thread_Lane_Resources::amh_response_handler_allocator (void)
+{
+ if (this->amh_response_handler_allocator_ == 0)
+ {
+ // Double checked locking
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->lock_, 0);
+
+ if (this->amh_response_handler_allocator_ == 0)
+ {
+ this->amh_response_handler_allocator_ =
+ this->resource_factory ()->amh_response_handler_allocator ();
+ }
+ }
+
+ return this->amh_response_handler_allocator_;
+}
+
+ACE_Allocator*
+TAO_Thread_Lane_Resources::ami_response_handler_allocator (void)
+{
+ if (this->ami_response_handler_allocator_ == 0)
+ {
+ // Double checked locking
+ ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->lock_, 0);
+
+ if (this->ami_response_handler_allocator_ == 0)
+ {
+ this->ami_response_handler_allocator_ =
+ this->resource_factory ()->ami_response_handler_allocator ();
+ }
+ }
+
+ return this->ami_response_handler_allocator_;
+}
+
int
TAO_Thread_Lane_Resources::open_acceptor_registry (int ignore_address
ACE_ENV_ARG_DECL)
@@ -382,56 +416,70 @@ TAO_Thread_Lane_Resources::finalize (void)
delete this->leader_follower_;
// Delete all the allocators here.. They shouldnt be done earlier,
- // lest some of the contents in the abve, say reactor or acceptor
+ // lest some of the contents in the above, say reactor or acceptor
// may use memory from the pool..
if (this->input_cdr_dblock_allocator_ != 0)
{
this->input_cdr_dblock_allocator_->remove ();
+ delete this->input_cdr_dblock_allocator_;
+ this->input_cdr_dblock_allocator_ = 0;
}
- delete this->input_cdr_dblock_allocator_;
-
if (this->input_cdr_buffer_allocator_ != 0)
{
this->input_cdr_buffer_allocator_->remove ();
+ delete this->input_cdr_buffer_allocator_;
+ this->input_cdr_buffer_allocator_ = 0;
}
- delete this->input_cdr_buffer_allocator_;
-
if (this->input_cdr_msgblock_allocator_ != 0)
{
this->input_cdr_msgblock_allocator_->remove ();
+ delete this->input_cdr_msgblock_allocator_;
+ this->input_cdr_msgblock_allocator_ = 0;
}
- delete this->input_cdr_msgblock_allocator_;
-
if (this->transport_message_buffer_allocator_ != 0)
{
this->transport_message_buffer_allocator_->remove ();
+ delete this->transport_message_buffer_allocator_;
+ this->transport_message_buffer_allocator_ = 0;
}
- delete this->transport_message_buffer_allocator_;
-
if (this->output_cdr_dblock_allocator_ != 0)
{
this->output_cdr_dblock_allocator_->remove ();
+ delete this->output_cdr_dblock_allocator_;
+ this->output_cdr_dblock_allocator_ = 0;
}
- delete this->output_cdr_dblock_allocator_;
-
if (this->output_cdr_buffer_allocator_ != 0)
{
this->output_cdr_buffer_allocator_->remove ();
+ delete this->output_cdr_buffer_allocator_;
+ this->output_cdr_buffer_allocator_ = 0;
}
- delete this->output_cdr_buffer_allocator_;
-
if (this->output_cdr_msgblock_allocator_ != 0)
{
this->output_cdr_msgblock_allocator_->remove ();
+ delete this->output_cdr_msgblock_allocator_;
+ this->output_cdr_msgblock_allocator_ = 0;
}
- delete this->output_cdr_msgblock_allocator_;
+ if (this->amh_response_handler_allocator_ != 0)
+ {
+ this->amh_response_handler_allocator_->remove ();
+ delete this->amh_response_handler_allocator_;
+ this->amh_response_handler_allocator_ = 0;
+ }
+
+ if (this->ami_response_handler_allocator_ != 0)
+ {
+ this->ami_response_handler_allocator_->remove ();
+ delete this->ami_response_handler_allocator_;
+ this->ami_response_handler_allocator_ = 0;
+ }
}
void
diff --git a/TAO/tao/Thread_Lane_Resources.h b/TAO/tao/Thread_Lane_Resources.h
index 46fa496d5a2..d3a92da8d45 100644
--- a/TAO/tao/Thread_Lane_Resources.h
+++ b/TAO/tao/Thread_Lane_Resources.h
@@ -122,6 +122,16 @@ public:
* locks.
*/
ACE_Allocator *output_cdr_msgblock_allocator (void);
+
+ /* Allocator is intended for allocating the AMH response handlers
+ * This allocator is global.
+ */
+ ACE_Allocator *amh_response_handler_allocator (void);
+
+ /* Allocator is intended for allocating the AMI response handlers
+ * This allocator is global.
+ */
+ ACE_Allocator *ami_response_handler_allocator (void);
//@}
private:
@@ -174,11 +184,17 @@ private:
ACE_Allocator *output_cdr_buffer_allocator_;
ACE_Allocator *output_cdr_msgblock_allocator_;
//@}
-};
-#if defined (__ACE_INLINE__)
-# include "tao/Thread_Lane_Resources.i"
-#endif /* __ACE_INLINE__ */
+ /// @name The allocators for AMH.
+ //@{
+ ACE_Allocator *amh_response_handler_allocator_;
+ //@}
+
+ /// @name The allocators for AMI.
+ //@{
+ ACE_Allocator *ami_response_handler_allocator_;
+ //@}
+};
#include /**/ "ace/post.h"
diff --git a/TAO/tao/Thread_Lane_Resources.i b/TAO/tao/Thread_Lane_Resources.i
deleted file mode 100644
index cfa1da318d3..00000000000
--- a/TAO/tao/Thread_Lane_Resources.i
+++ /dev/null
@@ -1 +0,0 @@
-// $Id$
diff --git a/TAO/tao/default_resource.cpp b/TAO/tao/default_resource.cpp
index 4066d4608eb..5c29d9a679e 100644
--- a/TAO/tao/default_resource.cpp
+++ b/TAO/tao/default_resource.cpp
@@ -853,6 +853,26 @@ TAO_Default_Resource_Factory::output_cdr_msgblock_allocator (void)
return allocator;
}
+ACE_Allocator*
+TAO_Default_Resource_Factory::amh_response_handler_allocator (void)
+{
+ ACE_Allocator *allocator = 0;
+ ACE_NEW_RETURN (allocator,
+ LOCKED_ALLOCATOR,
+ 0);
+ return allocator;
+}
+
+ACE_Allocator*
+TAO_Default_Resource_Factory::ami_response_handler_allocator (void)
+{
+ ACE_Allocator *allocator = 0;
+ ACE_NEW_RETURN (allocator,
+ LOCKED_ALLOCATOR,
+ 0);
+ return allocator;
+}
+
int
TAO_Default_Resource_Factory::cache_maximum (void) const
{
diff --git a/TAO/tao/default_resource.h b/TAO/tao/default_resource.h
index 0737e45f8b3..2e7cdeb7950 100644
--- a/TAO/tao/default_resource.h
+++ b/TAO/tao/default_resource.h
@@ -92,7 +92,7 @@ public:
TAO_ALLOCATOR_THREAD_LOCK
};
- // Translator type
+ /// Translator type
enum TRANSLATOR_TYPE
{
CHAR_TRANSLATOR,
@@ -115,6 +115,8 @@ public:
virtual ACE_Allocator* output_cdr_dblock_allocator (void);
virtual ACE_Allocator* output_cdr_buffer_allocator (void);
virtual ACE_Allocator* output_cdr_msgblock_allocator (void);
+ virtual ACE_Allocator* amh_response_handler_allocator (void);
+ virtual ACE_Allocator* ami_response_handler_allocator (void);
virtual TAO_ProtocolFactorySet *get_protocol_factories (void);
virtual TAO_Codeset_Manager *get_codeset_manager ();
@@ -233,7 +235,7 @@ private:
};
/// Type of flushing strategy configured
- int flushing_strategy_type_;
+ Flushing_Strategy_Type flushing_strategy_type_;
TAO_Codeset_Manager *codeset_manager_;