summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-09-30 06:29:08 +0000
committercoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-09-30 06:29:08 +0000
commit3e14ff8ac10b468d0db9e3aeb911194d994a4f26 (patch)
tree43c81594fa0d782562c89d2e4f1a7f1bb492948c
parenta77cd81afe23a24e83f82adfa5c47e42217d9116 (diff)
downloadATCD-3e14ff8ac10b468d0db9e3aeb911194d994a4f26.tar.gz
ChangeLogTag:Wed Sep 30 00:26:44 1998 Carlos O'Ryan <coryan@cs.wustl.edu>
-rw-r--r--TAO/ChangeLog-98c24
-rw-r--r--TAO/orbsvcs/tests/EC_Custom_Marshal/svc.conf2
-rw-r--r--TAO/orbsvcs/tests/EC_Mcast/svc.conf2
-rw-r--r--TAO/tao/CDR.cpp48
-rw-r--r--TAO/tao/CDR.h20
-rw-r--r--TAO/tao/Connect.cpp12
-rw-r--r--TAO/tao/Invocation.cpp4
-rw-r--r--TAO/tao/Invocation.i6
-rw-r--r--TAO/tao/ORB_Core.cpp157
-rw-r--r--TAO/tao/ORB_Core.h45
-rw-r--r--TAO/tao/ORB_Core.i59
-rw-r--r--TAO/tao/default_client.h2
12 files changed, 307 insertions, 74 deletions
diff --git a/TAO/ChangeLog-98c b/TAO/ChangeLog-98c
index f54f6ebe381..2e41726dcfa 100644
--- a/TAO/ChangeLog-98c
+++ b/TAO/ChangeLog-98c
@@ -1,3 +1,27 @@
+Wed Sep 30 00:26:44 1998 Carlos O'Ryan <coryan@cs.wustl.edu>
+
+ * tao/ORB_Core.h:
+ * tao/ORB_Core.i:
+ * tao/ORB_Core.cpp:
+ * tao/CDR.h:
+ * tao/CDR.cpp:
+ * tao/Connect.cpp:
+ * tao/Invocation.i:
+ * tao/Invocation.cpp:
+ The resource factory can create either TSS or global allocators
+ for the InputCDR stream, thus applications that don't need the
+ CDR stream buffer to survive after the upcall, or release it in
+ another thread (most CORBA compliant apps fall in this category)
+ can benefit from this feature that reduces locks and
+ fragmentation in the global heap.
+
+ * tao/default_client.h:
+ Fixed minor syntax error (comma at the end of an enum).
+
+ * orbsvcs/tests/EC_Custom_Marshal/svc.conf:
+ * orbsvcs/tests/EC_Custom_Marshal/svc.conf:
+ Use a global allocator for the CDR stream.
+
Tue Sep 29 21:57:02 1998 Irfan Pyarali <irfan@cs.wustl.edu>
* examples/TAO_Examples.dsw: Removed incorrect dependency.
diff --git a/TAO/orbsvcs/tests/EC_Custom_Marshal/svc.conf b/TAO/orbsvcs/tests/EC_Custom_Marshal/svc.conf
index 272f088b3dd..f3362851751 100644
--- a/TAO/orbsvcs/tests/EC_Custom_Marshal/svc.conf
+++ b/TAO/orbsvcs/tests/EC_Custom_Marshal/svc.conf
@@ -2,6 +2,6 @@
#
# The options are described in $TAO_ROOT/docs/Options.html
#
-dynamic Resource_Factory Service_Object * TAO:_make_TAO_Resource_Factory() "-ORBresources global -ORBpoa global -ORBcoltable global"
+dynamic Resource_Factory Service_Object * TAO:_make_TAO_Resource_Factory() "-ORBresources global -ORBpoa global -ORBcoltable global -ORBinputcdrallocator global"
dynamic Client_Strategy_Factory Service_Object * TAO:_make_TAO_Default_Client_Strategy_Factory()
dynamic Server_Strategy_Factory Service_Object * TAO:_make_TAO_Default_Server_Strategy_Factory() "-ORBconcurrency reactive -ORBdemuxstrategy dynamic -ORBtablesize 128 -ORBpoalock thread -ORBcoltbllock thread -ORBpoamgrlock thread"
diff --git a/TAO/orbsvcs/tests/EC_Mcast/svc.conf b/TAO/orbsvcs/tests/EC_Mcast/svc.conf
index 272f088b3dd..f3362851751 100644
--- a/TAO/orbsvcs/tests/EC_Mcast/svc.conf
+++ b/TAO/orbsvcs/tests/EC_Mcast/svc.conf
@@ -2,6 +2,6 @@
#
# The options are described in $TAO_ROOT/docs/Options.html
#
-dynamic Resource_Factory Service_Object * TAO:_make_TAO_Resource_Factory() "-ORBresources global -ORBpoa global -ORBcoltable global"
+dynamic Resource_Factory Service_Object * TAO:_make_TAO_Resource_Factory() "-ORBresources global -ORBpoa global -ORBcoltable global -ORBinputcdrallocator global"
dynamic Client_Strategy_Factory Service_Object * TAO:_make_TAO_Default_Client_Strategy_Factory()
dynamic Server_Strategy_Factory Service_Object * TAO:_make_TAO_Default_Server_Strategy_Factory() "-ORBconcurrency reactive -ORBdemuxstrategy dynamic -ORBtablesize 128 -ORBpoalock thread -ORBcoltbllock thread -ORBpoamgrlock thread"
diff --git a/TAO/tao/CDR.cpp b/TAO/tao/CDR.cpp
index 30a03c0105d..8cfc0d127ef 100644
--- a/TAO/tao/CDR.cpp
+++ b/TAO/tao/CDR.cpp
@@ -244,12 +244,12 @@ TAO_OutputCDR::grow_and_adjust (size_t size, size_t align, char*& buf)
ACE_Message_Block (block_size,
ACE_Message_Block::MB_DATA,
0, 0,
- orb_core->cdr_buffer_allocator (),
+ orb_core->output_cdr_buffer_allocator (),
0,
0,
ACE_Time_Value::zero,
ACE_Time_Value::max_time,
- orb_core->data_block_allocator ()),
+ orb_core->output_cdr_dblock_allocator ()),
-1);
this->good_bit_ = 1;
@@ -580,8 +580,18 @@ TAO_OutputCDR::write_boolean_array (const CORBA::Boolean* x,
TAO_InputCDR::TAO_InputCDR (const char *buf, size_t bufsiz,
int byte_order,
- TAO_Marshal_Factory *factory)
- : start_ (buf, bufsiz),
+ TAO_Marshal_Factory *factory,
+ ACE_Allocator* buffer_allocator,
+ ACE_Allocator* data_block_allocator)
+ : start_ (bufsiz,
+ ACE_Message_Block::MB_DATA,
+ 0,
+ buf,
+ buffer_allocator,
+ 0, 0,
+ ACE_Time_Value::zero,
+ ACE_Time_Value::max_time,
+ data_block_allocator),
factory_ (factory),
do_byte_swap_ (byte_order != TAO_ENCAP_BYTE_ORDER),
good_bit_ (1)
@@ -591,8 +601,19 @@ TAO_InputCDR::TAO_InputCDR (const char *buf, size_t bufsiz,
TAO_InputCDR::TAO_InputCDR (size_t bufsiz,
int byte_order,
- TAO_Marshal_Factory *factory)
- : start_ (bufsiz),
+ TAO_Marshal_Factory *factory,
+ ACE_Allocator* buffer_allocator,
+ ACE_Allocator* data_block_allocator)
+ : start_ (bufsiz,
+ ACE_Message_Block::MB_DATA,
+ 0,
+ 0,
+ buffer_allocator,
+ 0,
+ 0,
+ ACE_Time_Value::zero,
+ ACE_Time_Value::max_time,
+ data_block_allocator),
factory_ (factory),
do_byte_swap_ (byte_order != TAO_ENCAP_BYTE_ORDER),
good_bit_ (1)
@@ -685,8 +706,19 @@ TAO_InputCDR::operator= (const TAO_InputCDR& rhs)
return *this;
}
-TAO_InputCDR::TAO_InputCDR (const TAO_OutputCDR& rhs)
- : start_ (rhs.total_length () + CDR::MAX_ALIGNMENT),
+TAO_InputCDR::TAO_InputCDR (const TAO_OutputCDR& rhs,
+ ACE_Allocator* buffer_allocator,
+ ACE_Allocator* data_block_allocator)
+ : start_ (rhs.total_length () + CDR::MAX_ALIGNMENT,
+ ACE_Message_Block::MB_DATA,
+ 0,
+ 0,
+ buffer_allocator,
+ 0,
+ 0,
+ ACE_Time_Value::zero,
+ ACE_Time_Value::max_time,
+ data_block_allocator),
factory_ (rhs.factory_),
do_byte_swap_ (rhs.do_byte_swap_),
good_bit_ (1)
diff --git a/TAO/tao/CDR.h b/TAO/tao/CDR.h
index 62f8f85e4ee..7d6a8f61cd4 100644
--- a/TAO/tao/CDR.h
+++ b/TAO/tao/CDR.h
@@ -386,7 +386,9 @@ public:
TAO_InputCDR (const char* buf, size_t bufsiz,
int byte_order = TAO_ENCAP_BYTE_ORDER,
TAO_Marshal_Factory *f =
- TAO_Marshal::DEFAULT_MARSHAL_FACTORY);
+ TAO_Marshal::DEFAULT_MARSHAL_FACTORY,
+ ACE_Allocator* buffer_allocator = 0,
+ ACE_Allocator* data_block_allocator = 0);
// Create an input stream from an arbitrary buffer, care must be
// exercised wrt alignment, because this contructor will *not* work
// if the buffer is unproperly aligned.
@@ -394,14 +396,17 @@ public:
TAO_InputCDR (size_t bufsiz,
int byte_order = TAO_ENCAP_BYTE_ORDER,
TAO_Marshal_Factory *f =
- TAO_Marshal::DEFAULT_MARSHAL_FACTORY);
+ TAO_Marshal::DEFAULT_MARSHAL_FACTORY,
+ ACE_Allocator* buffer_allocator = 0,
+ ACE_Allocator* data_block_allocator = 0);
// Create an empty input stream. The caller is responsible for
// putting the right data in here.
TAO_InputCDR (ACE_Message_Block *data,
- int byte_order = TAO_ENCAP_BYTE_ORDER,
+ int byte_order =
+ TAO_ENCAP_BYTE_ORDER,
TAO_Marshal_Factory *f =
- TAO_Marshal::DEFAULT_MARSHAL_FACTORY);
+ TAO_Marshal::DEFAULT_MARSHAL_FACTORY);
// Create an input stream from an ACE_Message_Block
TAO_InputCDR (const TAO_InputCDR& rhs);
@@ -416,11 +421,14 @@ public:
// When interpreting indirected TypeCodes it is useful to make a
// "copy" of the stream starting in the new position.
- TAO_InputCDR (const TAO_InputCDR& rhs, size_t size);
+ TAO_InputCDR (const TAO_InputCDR& rhs,
+ size_t size);
// This creates an encapsulated stream, the first byte must be (per
// the spec) the byte order of the encapsulation.
- TAO_InputCDR (const TAO_OutputCDR& rhs);
+ TAO_InputCDR (const TAO_OutputCDR& rhs,
+ ACE_Allocator* buffer_allocator = 0,
+ ACE_Allocator* data_block_allocator = 0);
// Create an input CDR from an output CDR.
~TAO_InputCDR (void);
diff --git a/TAO/tao/Connect.cpp b/TAO/tao/Connect.cpp
index 38b2afbbf54..e5ab5f7020c 100644
--- a/TAO/tao/Connect.cpp
+++ b/TAO/tao/Connect.cpp
@@ -505,13 +505,21 @@ TAO_Server_Connection_Handler::handle_input (ACE_HANDLE)
// @@ TODO This should take its memory from a specialized
// allocator. It is better to use a message block than a on stack
// buffer because we cannot minimize memory copies in that case.
- TAO_InputCDR input (CDR::DEFAULT_BUFSIZE);
+ TAO_InputCDR input (CDR::DEFAULT_BUFSIZE,
+ TAO_ENCAP_BYTE_ORDER,
+ TAO_Marshal::DEFAULT_MARSHAL_FACTORY,
+ this->orb_core_->input_cdr_buffer_allocator (),
+ this->orb_core_->input_cdr_dblock_allocator ());
char repbuf[CDR::DEFAULT_BUFSIZE];
#if defined(ACE_HAS_PURIFY)
(void) ACE_OS::memset (repbuf, '\0', sizeof (repbuf));
#endif /* ACE_HAS_PURIFY */
- TAO_OutputCDR output (repbuf, sizeof(repbuf));
+ TAO_OutputCDR output (repbuf, sizeof(repbuf),
+ TAO_ENCAP_BYTE_ORDER,
+ TAO_Marshal::DEFAULT_MARSHAL_FACTORY,
+ this->orb_core_->output_cdr_buffer_allocator (),
+ this->orb_core_->output_cdr_buffer_allocator ());
int result = 0;
int error_encountered = 0;
diff --git a/TAO/tao/Invocation.cpp b/TAO/tao/Invocation.cpp
index f91113947b2..cb96ad2e090 100644
--- a/TAO/tao/Invocation.cpp
+++ b/TAO/tao/Invocation.cpp
@@ -62,8 +62,8 @@ TAO_GIOP_Invocation::TAO_GIOP_Invocation (IIOP_Object *data,
out_stream_ (buffer, sizeof buffer, /* CDR::DEFAULT_BUFSIZE */
TAO_ENCAP_BYTE_ORDER,
TAO_Marshal::DEFAULT_MARSHAL_FACTORY,
- orb_core->cdr_buffer_allocator (),
- orb_core->data_block_allocator ()),
+ orb_core->output_cdr_buffer_allocator (),
+ orb_core->output_cdr_dblock_allocator ()),
orb_core_ (orb_core)
{
// @@ TODO The comments here are scary, can someone please give me a
diff --git a/TAO/tao/Invocation.i b/TAO/tao/Invocation.i
index 222dc901891..e7fd39edc7c 100644
--- a/TAO/tao/Invocation.i
+++ b/TAO/tao/Invocation.i
@@ -25,7 +25,11 @@ TAO_GIOP_Twoway_Invocation (IIOP_Object *data,
const char *operation,
TAO_ORB_Core *orb_core)
: TAO_GIOP_Invocation (data, operation, orb_core),
- inp_stream_ (CDR::DEFAULT_BUFSIZE)
+ inp_stream_ (CDR::DEFAULT_BUFSIZE,
+ TAO_ENCAP_BYTE_ORDER,
+ TAO_Marshal::DEFAULT_MARSHAL_FACTORY,
+ orb_core->input_cdr_buffer_allocator (),
+ orb_core->input_cdr_dblock_allocator ())
{
}
diff --git a/TAO/tao/ORB_Core.cpp b/TAO/tao/ORB_Core.cpp
index fef52f80a3a..48ebb40eb45 100644
--- a/TAO/tao/ORB_Core.cpp
+++ b/TAO/tao/ORB_Core.cpp
@@ -92,6 +92,8 @@ TAO_ORB_Core::TAO_ORB_Core (void)
arl_same_port_connect_ (0),
#endif /* TAO_ARL_USES_SAME_CONNECTOR_PORT */
preconnections_ (0),
+ input_cdr_dblock_allocator_ (0),
+ input_cdr_buffer_allocator_ (0),
default_environment_ (0),
tss_environment_ (this)
{
@@ -106,8 +108,8 @@ TAO_ORB_Core::~TAO_ORB_Core (void)
ACE_OS::free (preconnections_);
// Clean up memory pools
- this->data_block_allocator_.remove ();
- this->cdr_buffer_allocator_.remove ();
+ this->output_cdr_dblock_allocator_.remove ();
+ this->output_cdr_buffer_allocator_.remove ();
}
TAO_Default_Reactor::TAO_Default_Reactor (int nolock)
@@ -122,8 +124,6 @@ TAO_Default_Reactor::~TAO_Default_Reactor (void)
{
}
-#define quote(x) #x
-
int
TAO_ORB_Core::init (int &argc, char *argv[])
{
@@ -153,7 +153,7 @@ TAO_ORB_Core::init (int &argc, char *argv[])
ACE_Arg_Shifter arg_shifter (argc, argv);
svc_config_argv[svc_config_argc++] = argv[0];
- ACE_Env_Value<int> defport (quote (TAO_DEFAULT_SERVER_PORT),
+ ACE_Env_Value<int> defport ("TAO_DEFAULT_SERVER_PORT",
TAO_DEFAULT_SERVER_PORT);
CORBA::String_var host = CORBA::string_dup ("");
CORBA::UShort port = defport;
@@ -436,7 +436,6 @@ TAO_ORB_Core::init (int &argc, char *argv[])
arg_shifter.ignore_arg ();
}
-
#if defined (DEBUG)
// Make it a little easier to debug programs using this code.
{
@@ -523,6 +522,11 @@ TAO_ORB_Core::init (int &argc, char *argv[])
this->connector (trf->get_connector ());
this->acceptor (trf->get_acceptor ());
+ this->input_cdr_dblock_allocator_ =
+ trf->input_cdr_dblock_allocator ();
+ this->input_cdr_buffer_allocator_ =
+ trf->input_cdr_buffer_allocator ();
+
TAO_Server_Strategy_Factory *ssf = this->server_factory ();
if (ssf == 0)
@@ -1129,53 +1133,42 @@ TAO_ORB_Core::get_next_follower (void)
return *iterator;
}
-
-TAO_Resource_Factory::TAO_Resource_Factory (void)
- : resource_source_ (TAO_GLOBAL),
- poa_source_ (TAO_GLOBAL),
- collocation_table_source_ (TAO_GLOBAL),
- reactor_lock_ (TAO_TOKEN)
+ACE_Allocator*
+TAO_ORB_Core::input_cdr_dblock_allocator (void)
{
+ if (this->input_cdr_dblock_allocator_ == 0)
+ {
+ this->input_cdr_dblock_allocator_ =
+ this->resource_factory ()->input_cdr_dblock_allocator ();
+ }
+ return this->input_cdr_dblock_allocator_;
}
-TAO_Resource_Factory::~TAO_Resource_Factory (void)
-{
-}
-
-void
-TAO_Resource_Factory::resource_source (int which_source)
-{
- resource_source_ = which_source;
-}
-
-int
-TAO_Resource_Factory::resource_source (void)
+ACE_Allocator*
+TAO_ORB_Core::input_cdr_buffer_allocator (void)
{
- return resource_source_;
+ if (this->input_cdr_buffer_allocator_ == 0)
+ {
+ this->input_cdr_buffer_allocator_ =
+ this->resource_factory ()->input_cdr_buffer_allocator ();
+ }
+ return this->input_cdr_buffer_allocator_;
}
-void
-TAO_Resource_Factory::poa_source (int which_source)
-{
- poa_source_ = which_source;
-}
+// ****************************************************************
-int
-TAO_Resource_Factory::poa_source (void)
-{
- return poa_source_;
-}
-int
-TAO_Resource_Factory::reactor_lock (void)
+TAO_Resource_Factory::TAO_Resource_Factory (void)
+ : resource_source_ (TAO_GLOBAL),
+ poa_source_ (TAO_GLOBAL),
+ collocation_table_source_ (TAO_GLOBAL),
+ reactor_lock_ (TAO_TOKEN),
+ cdr_allocator_source_ (TAO_TSS)
{
- return reactor_lock_;
}
-int
-TAO_Resource_Factory::init (int argc, char *argv[])
+TAO_Resource_Factory::~TAO_Resource_Factory (void)
{
- return this->parse_args (argc, argv);
}
int
@@ -1256,6 +1249,19 @@ TAO_Resource_Factory::parse_args (int argc, char **argv)
collocation_table_source_ = TAO_TSS;
}
}
+ else if (ACE_OS::strcmp (argv[curarg], "-ORBinputcdrallocator") == 0)
+ {
+ curarg++;
+ if (curarg < argc)
+ {
+ char *name = argv[curarg];
+
+ if (ACE_OS::strcasecmp (name, "global") == 0)
+ this->cdr_allocator_source_ = TAO_GLOBAL;
+ else if (ACE_OS::strcasecmp (name, "tss") == 0)
+ this->cdr_allocator_source_ = TAO_TSS;
+ }
+ }
// Don't allow a global ORB and a tss POA.
if ( (local_resource_source == TAO_GLOBAL) &&
@@ -1388,6 +1394,69 @@ TAO_Resource_Factory::get_allocator (void)
return 0;
}
+typedef ACE_Malloc<ACE_LOCAL_MEMORY_POOL,ACE_Null_Mutex> TSS_MALLOC;
+typedef ACE_Allocator_Adapter<TSS_MALLOC> TSS_ALLOCATOR;
+
+typedef ACE_Malloc<ACE_LOCAL_MEMORY_POOL,ACE_SYNCH_MUTEX> GBL_MALLOC;
+typedef ACE_Allocator_Adapter<GBL_MALLOC> GBL_ALLOCATOR;
+
+// @@ TODO We may be changing the state of the global App_Allocated
+// structure, but without any locks? It seems to be done all over
+// the place.
+
+ACE_Allocator*
+TAO_Resource_Factory::input_cdr_dblock_allocator (void)
+{
+ switch (this->cdr_allocator_source_)
+ {
+ case TAO_GLOBAL:
+ if (GLOBAL_APP_ALLOCATED::instance ()->input_cdr_dblock_allocator_ == 0)
+ {
+ ACE_NEW_RETURN (GLOBAL_APP_ALLOCATED::instance ()->input_cdr_dblock_allocator_,
+ GBL_ALLOCATOR,
+ 0);
+ }
+ return GLOBAL_APP_ALLOCATED::instance ()->input_cdr_dblock_allocator_;
+ break;
+ case TAO_TSS:
+ if (TSS_APP_ALLOCATED::instance ()->input_cdr_dblock_allocator_ == 0)
+ {
+ ACE_NEW_RETURN (TSS_APP_ALLOCATED::instance ()->input_cdr_dblock_allocator_,
+ TSS_ALLOCATOR,
+ 0);
+ }
+ return TSS_APP_ALLOCATED::instance ()->input_cdr_dblock_allocator_;
+ break;
+ }
+ return 0;
+}
+
+ACE_Allocator *
+TAO_Resource_Factory::input_cdr_buffer_allocator (void)
+{
+ switch (this->cdr_allocator_source_)
+ {
+ case TAO_GLOBAL:
+ if (GLOBAL_APP_ALLOCATED::instance ()->input_cdr_buffer_allocator_ == 0)
+ {
+ ACE_NEW_RETURN (GLOBAL_APP_ALLOCATED::instance ()->input_cdr_buffer_allocator_,
+ GBL_ALLOCATOR,
+ 0);
+ }
+ return GLOBAL_APP_ALLOCATED::instance ()->input_cdr_buffer_allocator_;
+ case TAO_TSS:
+ if (TSS_APP_ALLOCATED::instance ()->input_cdr_buffer_allocator_ == 0)
+ {
+ ACE_NEW_RETURN (TSS_APP_ALLOCATED::instance ()->input_cdr_buffer_allocator_,
+ TSS_ALLOCATOR,
+ 0);
+ }
+ return TSS_APP_ALLOCATED::instance ()->input_cdr_buffer_allocator_;
+ }
+ return 0;
+}
+
+
TAO_GLOBAL_Collocation_Table *
TAO_Resource_Factory::get_global_collocation_table (void)
{
@@ -1402,6 +1471,8 @@ TAO_Resource_Factory::Pre_Allocated::Pre_Allocated (void)
this->tm_.wait_on_exit (0);
}
+// ****************************************************************
+
TAO_Resource_Factory::Pre_Allocated::~Pre_Allocated (void)
{
// Zap the creation strategy that we created earlier
@@ -1434,6 +1505,8 @@ TAO_ORB_Core_instance (void)
template void ACE_Convert (const char *, u_int &);
# endif /* __GNUG__ */
+template class ACE_Malloc<ACE_MEMORY_POOL,ACE_SYNCH_MUTEX>;
+template class ACE_Allocator_Adapter<ACE_Malloc<ACE_MEMORY_POOL,ACE_SYNCH)MUTEX> >;
template class ACE_Env_Value<int>;
template class ACE_Env_Value<u_int>;
template class ACE_Strategy_Acceptor<TAO_Server_Connection_Handler, TAO_SOCK_ACCEPTOR>;
@@ -1484,6 +1557,8 @@ template class ACE_Select_Reactor_T< ACE_Select_Reactor_Token_T<ACE_Noop_Token>
#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
+#pragma instantiate ACE_Malloc<ACE_MEMORY_POOL,ACE_SYNCH_MUTEX>
+#pragma instantiate ACE_Allocator_Adapter<ACE_Malloc<ACE_MEMORY_POOL,ACE_SYNCH)MUTEX> >
#pragma instantiate ACE_Env_Value<int>
#pragma instantiate ACE_Env_Value<u_int>
#pragma instantiate ACE_Strategy_Acceptor<TAO_Server_Connection_Handler, TAO_SOCK_ACCEPTOR>
diff --git a/TAO/tao/ORB_Core.h b/TAO/tao/ORB_Core.h
index dc37ab6f297..79748768c36 100644
--- a/TAO/tao/ORB_Core.h
+++ b/TAO/tao/ORB_Core.h
@@ -233,11 +233,20 @@ public:
// returns randomly a follower from the leader-follower set
// returns follower on success, else 0
- ACE_Allocator *data_block_allocator (void);
+ ACE_Allocator *output_cdr_dblock_allocator (void);
// This allocator is always TSS and has no locks. It is intended for
// allocating the ACE_Data_Blocks used in *outgoing* CDR streams.
- ACE_Allocator *cdr_buffer_allocator (void);
+ ACE_Allocator *output_cdr_buffer_allocator (void);
+ // This allocator is always TSS and has no locks. It is intended for
+ // allocating the buffers used in *outgoing* CDR streams.
+
+ ACE_Allocator *input_cdr_dblock_allocator (void);
+ // This allocator maybe TSS or global, may or may not have locks. It
+ // is intended for allocating the ACE_Data_Blocks used in *outgoing*
+ // CDR streams.
+
+ ACE_Allocator *input_cdr_buffer_allocator (void);
// This allocator is always TSS and has no locks. It is intended for
// allocating the buffers used in *outgoing* CDR streams.
@@ -358,11 +367,15 @@ private:
typedef ACE_Malloc<ACE_LOCAL_MEMORY_POOL,ACE_Null_Mutex> TSS_MALLOC;
typedef ACE_Allocator_Adapter<TSS_MALLOC> TSS_ALLOCATOR;
- TSS_ALLOCATOR data_block_allocator_;
- // The Allocator for the ACE_Data_Blocks.
+ TSS_ALLOCATOR output_cdr_dblock_allocator_;
+ // The Allocator for the ACE_Data_Blocks used in the input CDRs.
+
+ TSS_ALLOCATOR output_cdr_buffer_allocator_;
+ // The Allocator for the input CDR buffers
- TSS_ALLOCATOR cdr_buffer_allocator_;
- // The Allocator for the CDR buffers.
+ ACE_Allocator *input_cdr_dblock_allocator_;
+ ACE_Allocator *input_cdr_buffer_allocator_;
+ // Cache the resource factory allocators.
CORBA_Environment* default_environment_;
// The default environment for the thread.
@@ -432,6 +445,9 @@ public:
virtual int poa_source (void);
// Get the POA source specifier.
+ int cdr_allocator_source (void);
+ // Modify and get the source for the CDR allocators
+
// = Resource Retrieval
//
// Methods in this category return pointers to resources. Based on
@@ -509,6 +525,11 @@ public:
// be available to stubs and generated code.
virtual int reactor_lock (void);
+ // Returns 0 if a reactor without locking was configured.
+
+ virtual ACE_Allocator* input_cdr_dblock_allocator (void);
+ virtual ACE_Allocator* input_cdr_buffer_allocator (void);
+ // Access the input CDR allocators.
// @@ I suspect that putting these structs inside of this class is
// going to break some compilers (e.g., HP/YUX) when you try to use
@@ -567,7 +588,7 @@ public:
// after obtaining information from the application such as
// arguments, etc.
{
- App_Allocated (void): orb_(0), poa_(0), alloc_(0) { };
+ App_Allocated (void);
// Constructor necessary because we have pointers. It's inlined
// here rather than in the .i file because it's easier than trying
// to re-order header files in corba.h to eliminate the "used
@@ -584,6 +605,10 @@ public:
ACE_Allocator *alloc_;
// Pointer to application-created ACE_Allocator.
+
+ ACE_Allocator *input_cdr_dblock_allocator_;
+ ACE_Allocator *input_cdr_buffer_allocator_;
+ // The allocators for the input CDR streams.
};
protected:
@@ -606,6 +631,12 @@ protected:
// Flag indicating wether we should provide a lock-freed reactor
// or not.
+ int cdr_allocator_source_;
+ // The source for the CDR allocator. Even with a TSS resource
+ // factory the user may be interested in global allocators for the
+ // CDR streams, for instance to keep the buffers around after the
+ // upcall and/or pass them to another thread.
+
// = Typedefs for the singleton types used to store our orb core
// information.
typedef ACE_Singleton<Pre_Allocated, ACE_SYNCH_MUTEX>
diff --git a/TAO/tao/ORB_Core.i b/TAO/tao/ORB_Core.i
index ba8a1704457..f3df9a4d8e5 100644
--- a/TAO/tao/ORB_Core.i
+++ b/TAO/tao/ORB_Core.i
@@ -148,15 +148,15 @@ ACE_Hash_Addr<ACE_INET_Addr>::hash_i (const ACE_INET_Addr &addr) const
#endif /* ACE_HAS_TEMPLATE_SPECIALIZATION && egcs, if __GNUG__ */
ACE_INLINE ACE_Allocator*
-TAO_ORB_Core::data_block_allocator (void)
+TAO_ORB_Core::output_cdr_dblock_allocator (void)
{
- return &this->data_block_allocator_;
+ return &this->output_cdr_dblock_allocator_;
}
ACE_INLINE ACE_Allocator*
-TAO_ORB_Core::cdr_buffer_allocator (void)
+TAO_ORB_Core::output_cdr_buffer_allocator (void)
{
- return &this->cdr_buffer_allocator_;
+ return &this->output_cdr_buffer_allocator_;
}
ACE_INLINE CORBA_Environment*
@@ -170,3 +170,54 @@ TAO_ORB_Core::default_environment (CORBA_Environment* env)
{
this->default_environment_ = env;
}
+
+// ****************************************************************
+
+ACE_INLINE void
+TAO_Resource_Factory::resource_source (int which_source)
+{
+ resource_source_ = which_source;
+}
+
+ACE_INLINE int
+TAO_Resource_Factory::resource_source (void)
+{
+ return resource_source_;
+}
+
+ACE_INLINE void
+TAO_Resource_Factory::poa_source (int which_source)
+{
+ poa_source_ = which_source;
+}
+
+ACE_INLINE int
+TAO_Resource_Factory::poa_source (void)
+{
+ return poa_source_;
+}
+
+ACE_INLINE int
+TAO_Resource_Factory::reactor_lock (void)
+{
+ return reactor_lock_;
+}
+
+ACE_INLINE int
+TAO_Resource_Factory::init (int argc, char *argv[])
+{
+ return this->parse_args (argc, argv);
+}
+
+// ****************************************************************
+
+ACE_INLINE
+TAO_Resource_Factory::App_Allocated::App_Allocated (void)
+ : orb_(0),
+ poa_(0),
+ alloc_(0),
+ input_cdr_dblock_allocator_ (0),
+ input_cdr_buffer_allocator_ (0)
+{
+}
+
diff --git a/TAO/tao/default_client.h b/TAO/tao/default_client.h
index ae6fccc887a..b2ab4b2c565 100644
--- a/TAO/tao/default_client.h
+++ b/TAO/tao/default_client.h
@@ -62,7 +62,7 @@ private:
enum Client_Connection_Handler_Type
{
MT_CLIENT_CONNECTION_HANDLER,
- ST_CLIENT_CONNECTION_HANDLER,
+ ST_CLIENT_CONNECTION_HANDLER
};
Client_Connection_Handler_Type client_connection_handler_;