summaryrefslogtreecommitdiff
path: root/TAO/tao/ORB_Core.cpp
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 /TAO/tao/ORB_Core.cpp
parenta77cd81afe23a24e83f82adfa5c47e42217d9116 (diff)
downloadATCD-3e14ff8ac10b468d0db9e3aeb911194d994a4f26.tar.gz
ChangeLogTag:Wed Sep 30 00:26:44 1998 Carlos O'Ryan <coryan@cs.wustl.edu>
Diffstat (limited to 'TAO/tao/ORB_Core.cpp')
-rw-r--r--TAO/tao/ORB_Core.cpp157
1 files changed, 116 insertions, 41 deletions
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>