summaryrefslogtreecommitdiff
path: root/TAO/tao/default_resource.cpp
diff options
context:
space:
mode:
authordoccvs <doccvs@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2000-11-09 18:48:44 +0000
committerdoccvs <doccvs@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2000-11-09 18:48:44 +0000
commit8dccd76e3578375c8116595dc5aeeb6c7bfa1a93 (patch)
tree7008cc34c876503e0da1d07eeb2891025fbb0d49 /TAO/tao/default_resource.cpp
parentb94281170201e6d3646efb65c6124c324d18fc80 (diff)
downloadATCD-8dccd76e3578375c8116595dc5aeeb6c7bfa1a93.tar.gz
ChangeLogTag: Thu Nov 9 10:38:19 2000 Priyanka Gontla <pgontla@ece.uci.edu>
Diffstat (limited to 'TAO/tao/default_resource.cpp')
-rw-r--r--TAO/tao/default_resource.cpp477
1 files changed, 35 insertions, 442 deletions
diff --git a/TAO/tao/default_resource.cpp b/TAO/tao/default_resource.cpp
index 8a7a7407650..ec602b639b4 100644
--- a/TAO/tao/default_resource.cpp
+++ b/TAO/tao/default_resource.cpp
@@ -1,25 +1,16 @@
// $Id$
#include "tao/default_resource.h"
-#include "tao/Client_Strategy_Factory.h"
-#include "tao/Server_Strategy_Factory.h"
+
#include "tao/ORB_Core.h"
#include "tao/debug.h"
#include "tao/IIOP_Factory.h"
-#include "tao/UIOP_Factory.h"
-#include "tao/SHMIOP_Factory.h"
+
#include "tao/Acceptor_Registry.h"
#include "tao/Connector_Registry.h"
#include "tao/Single_Reactor.h"
-#include "tao/Reactor_Per_Priority.h"
-#include "tao/Direct_Priority_Mapping.h"
-#include "tao/Linear_Priority_Mapping.h"
-
-#include "ace/Select_Reactor.h"
-#include "ace/FlReactor.h"
-#include "ace/TkReactor.h"
-#include "ace/WFMO_Reactor.h"
-#include "ace/Msg_WFMO_Reactor.h"
+#include "tao/Priority_Mapping.h"
+
#include "ace/TP_Reactor.h"
#include "ace/Dynamic_Service.h"
#include "ace/Arg_Shifter.h"
@@ -31,21 +22,15 @@
ACE_RCSID(tao, default_resource, "$Id$")
-
TAO_Default_Resource_Factory::TAO_Default_Resource_Factory (void)
: use_tss_resources_ (0),
use_locked_data_blocks_ (1),
- reactor_registry_type_ (TAO_SINGLE_REACTOR),
- reactor_type_ (TAO_REACTOR_SELECT_MT),
- cdr_allocator_type_ (TAO_ALLOCATOR_THREAD_LOCK),
parser_names_count_ (0),
parser_names_ (0),
protocol_factories_ (),
connection_caching_type_ (TAO_CONNECTION_CACHING_STRATEGY),
purge_percentage_ (TAO_PURGE_PERCENT),
reactor_mask_signals_ (1),
- sched_policy_ (ACE_SCHED_OTHER),
- priority_mapping_type_ (TAO_PRIORITY_MAPPING_DIRECT),
dynamically_allocated_reactor_ (0),
cached_connection_lock_type_ (TAO_THREAD_LOCK)
{
@@ -123,24 +108,6 @@ TAO_Default_Resource_Factory::init (int argc, char **argv)
}
else if (ACE_OS::strcasecmp (argv[curarg],
- "-ORBReactorLock") == 0)
- {
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("TAO_Default_Resource obsolete -ORBReactorLock ")
- ACE_TEXT ("option, please use -ORBReactorType\n")));
- curarg++;
- if (curarg < argc)
- {
- char *name = argv[curarg];
-
- if (ACE_OS::strcasecmp (name, "null") == 0)
- reactor_type_ = TAO_REACTOR_SELECT_ST;
- else if (ACE_OS::strcasecmp (name, "token") == 0)
- reactor_type_= TAO_REACTOR_SELECT_MT;
- }
- }
-
- else if (ACE_OS::strcasecmp (argv[curarg],
"-ORBReactorMaskSignals") == 0)
{
curarg++;
@@ -156,110 +123,6 @@ TAO_Default_Resource_Factory::init (int argc, char **argv)
}
else if (ACE_OS::strcasecmp (argv[curarg],
- "-ORBReactorRegistry") == 0)
- {
- curarg++;
- if (curarg < argc)
- {
- char *name = argv[curarg];
-
- if (ACE_OS::strcasecmp (name,
- "single") == 0)
- this->reactor_registry_type_ = TAO_SINGLE_REACTOR;
- else if (ACE_OS::strcasecmp (name,
- "per-priority") == 0)
- this->reactor_registry_type_ = TAO_REACTOR_PER_PRIORITY;
- else
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("TAO_Default_Factory - unknown argument")
- ACE_TEXT (" <%s> for -ORBReactorRegistry\n"), name));
- }
- }
-
- else if (ACE_OS::strcasecmp (argv[curarg],
- "-ORBReactorType") == 0)
- {
- curarg++;
- if (curarg < argc)
- {
- char *name = argv[curarg];
-
- if (ACE_OS::strcasecmp (name,
- "select_mt") == 0)
- reactor_type_ = TAO_REACTOR_SELECT_MT;
- else if (ACE_OS::strcasecmp (name,
- "select_st") == 0)
- reactor_type_ = TAO_REACTOR_SELECT_ST;
- else if (ACE_OS::strcasecmp (name,
- "fl") == 0)
-#if defined(ACE_HAS_FL)
- reactor_type_ = TAO_REACTOR_FL;
-#else
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("TAO_Default_Factory - FlReactor")
- ACE_TEXT (" not supported on this platform\n")));
-#endif /* ACE_HAS_FL */
- else if (ACE_OS::strcasecmp (name, "tk_reactor") == 0)
-#if defined(ACE_HAS_TK)
- reactor_type_ = TAO_REACTOR_TK;
-#else
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("TAO_Default_Factory - TkReactor")
- ACE_TEXT (" not supported on this platform\n")));
-#endif /* ACE_HAS_TK */
- else if (ACE_OS::strcasecmp (name,
- "wfmo") == 0)
-#if defined(ACE_WIN32)
- reactor_type_ = TAO_REACTOR_WFMO;
-#else
- ACE_DEBUG ((LM_DEBUG,
- "TAO_Default_Factory - WFMO Reactor"
- " not supported on this platform\n"));
-#endif /* ACE_WIN32 */
- else if (ACE_OS::strcasecmp (name,
- "msg_wfmo") == 0)
-#if defined(ACE_WIN32)
- reactor_type_ = TAO_REACTOR_MSGWFMO;
-#else
- ACE_DEBUG ((LM_DEBUG,
- "TAO_Default_Factory - MsgWFMO Reactor"
- " not supported on this platform\n"));
-#endif /* ACE_WIN32 */
-
- else if (ACE_OS::strcasecmp (name,
- "tp") == 0)
- reactor_type_ = TAO_REACTOR_TP;
- else
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("TAO_Default_Factory - unknown argument")
- ACE_TEXT (" <%s> for -ORBreactortype\n"), name));
- }
- }
-
- else if (ACE_OS::strcasecmp (argv[curarg],
- "-ORBInputCDRAllocator") == 0)
- {
- curarg++;
- if (curarg < argc)
- {
- char *name = argv[curarg];
-
- if (ACE_OS::strcasecmp (name,
- "null") == 0)
- {
- this->cdr_allocator_type_ = TAO_ALLOCATOR_NULL_LOCK;
- this->use_locked_data_blocks_ = 0;
- }
- else if (ACE_OS::strcasecmp (name,
- "thread") == 0)
- {
- this->cdr_allocator_type_ = TAO_ALLOCATOR_THREAD_LOCK;
- this->use_locked_data_blocks_ = 1;
- }
- }
- }
-
- else if (ACE_OS::strcasecmp (argv[curarg],
"-ORBProtocolFactory") == 0)
{
TAO_ProtocolFactorySet *pset = this->get_protocol_factories ();
@@ -317,51 +180,6 @@ TAO_Default_Resource_Factory::init (int argc, char **argv)
}
else if (ACE_OS::strcasecmp (argv[curarg],
- "-ORBSchedPolicy") == 0)
- {
- curarg++;
- if (curarg < argc)
- {
- char *name = argv[curarg];
-
- if (ACE_OS::strcasecmp (name,
- "SCHED_OTHER") == 0)
- this->sched_policy_ = ACE_SCHED_OTHER;
- else if (ACE_OS::strcasecmp (name,
- "SCHED_FIFO") == 0)
- this->sched_policy_ = ACE_SCHED_FIFO;
- else if (ACE_OS::strcasecmp (name,
- "SCHED_RR") == 0)
- this->sched_policy_ = ACE_SCHED_RR;
- else
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("TAO_Default_Factory - unknown argument")
- ACE_TEXT (" <%s> for -ORBSchedPolicy\n"), name));
- }
- }
-
- else if (ACE_OS::strcasecmp (argv[curarg],
- "-ORBPriorityMapping") == 0)
- {
- curarg++;
- if (curarg < argc)
- {
- char *name = argv[curarg];
-
- if (ACE_OS::strcasecmp (name,
- "linear") == 0)
- this->priority_mapping_type_ = TAO_PRIORITY_MAPPING_LINEAR;
- else if (ACE_OS::strcasecmp (name,
- "direct") == 0)
- this->priority_mapping_type_ = TAO_PRIORITY_MAPPING_DIRECT;
- else
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("TAO_Default_Factory - unknown argument")
- ACE_TEXT (" <%s> for -ORBPriorityMapping\n"), name));
- }
- }
-
- else if (ACE_OS::strcasecmp (argv[curarg],
"-ORBIORParser") == 0)
{
curarg++;
@@ -524,14 +342,10 @@ TAO_Default_Resource_Factory::add_to_ior_parser_names (const char *curarg)
return 0;
}
+// This is virtual and protected...
int
-TAO_Default_Resource_Factory::init_protocol_factories (void)
+TAO_Default_Resource_Factory::load_default_protocols (void)
{
- TAO_ProtocolFactorySetItor end = protocol_factories_.end ();
- TAO_ProtocolFactorySetItor factory = protocol_factories_.begin ();
-
- if (factory == end)
- {
// If the user did not list any protocols in her svc.conf file
// then default to TAO's basic protocols.
// You do *NOT* need modify this code to add your own protocol,
@@ -634,133 +448,18 @@ TAO_Default_Resource_Factory::init_protocol_factories (void)
ACE_TEXT ("protocol <IIOP_Factory>\n")));
}
-#if TAO_HAS_UIOP == 1
- protocol_factory =
- ACE_Dynamic_Service<TAO_Protocol_Factory>::instance ("UIOP_Factory");
-
- if (protocol_factory == 0)
- {
- if (TAO_orbdebug)
- ACE_ERROR ((LM_WARNING,
- "(%P|%t) WARNING - No %s found in Service Repository."
- " Using default instance.\n",
- "UIOP Protocol Factory"));
-
- ACE_NEW_RETURN (protocol_factory,
- TAO_UIOP_Protocol_Factory,
- -1);
-
- ACE_AUTO_PTR_RESET (safe_protocol_factory,
- protocol_factory,
- TAO_Protocol_Factory);
-
- transfer_ownership = 1;
- }
- else
- {
- transfer_ownership = 0;
- }
-
- ACE_NEW_RETURN (item, TAO_Protocol_Item ("UIOP_Factory"), -1);
- // If the TAO_Protocol_Item retains ownership of the
- // TAO_Protocol_Factory then we used an auto_ptr<> above, so
- // release the TAO_Protocol_Factory from it. Otherwise, we
- // obtained the TAO_Protocol_Factory from the Service
- // Configurator so an auto_ptr<> wasn't used since the Service
- // Configurator retains ownership, hence there was no need to
- // use an auto_ptr<> in this method.
- item->factory ((transfer_ownership ?
- safe_protocol_factory.release () :
- protocol_factory),
- transfer_ownership);
-
- if (this->protocol_factories_.insert (item) == -1)
- {
- ACE_ERROR ((LM_ERROR,
- ACE_TEXT ("TAO (%P|%t) Unable to add ")
- ACE_TEXT ("<%s> to protocol factory set.\n"),
- item->protocol_name ().c_str ()));
-
- delete item;
-
- if (transfer_ownership == 0)
- delete protocol_factory;
-
- return -1;
- }
-
- if (TAO_debug_level > 0)
- {
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("TAO (%P|%t) Loaded default ")
- ACE_TEXT ("protocol <UIOP_Factory>\n")));
- }
-#endif /* TAO_HAS_UIOP == 1 */
-
-#if defined (TAO_HAS_SHMIOP) && (TAO_HAS_SHMIOP != 0)
- protocol_factory =
- ACE_Dynamic_Service<TAO_Protocol_Factory>::instance ("SHMIOP_Factory");
-
- if (protocol_factory == 0)
- {
- if (TAO_orbdebug)
- ACE_ERROR ((LM_WARNING,
- "(%P|%t) WARNING - No %s found in Service Repository."
- " Using default instance.\n",
- "SHMIOP Protocol Factory"));
-
- ACE_NEW_RETURN (protocol_factory,
- TAO_SHMIOP_Protocol_Factory,
- -1);
-
- ACE_AUTO_PTR_RESET (safe_protocol_factory,
- protocol_factory,
- TAO_Protocol_Factory);
-
- transfer_ownership = 1;
- }
- else
- {
- transfer_ownership = 0;
- }
-
- ACE_NEW_RETURN (item, TAO_Protocol_Item ("SHMIOP_Factory"), -1);
- // If the TAO_Protocol_Item retains ownership of the
- // TAO_Protocol_Factory then we used an auto_ptr<> above, so
- // release the TAO_Protocol_Factory from it. Otherwise, we
- // obtained the TAO_Protocol_Factory from the Service
- // Configurator so an auto_ptr<> wasn't used since the Service
- // Configurator retains ownership, hence there was no need to
- // use an auto_ptr<> in this method.
- item->factory ((transfer_ownership ?
- safe_protocol_factory.release () :
- protocol_factory),
- transfer_ownership);
-
- if (this->protocol_factories_.insert (item) == -1)
- {
- ACE_ERROR ((LM_ERROR,
- ACE_TEXT ("TAO (%P|%t) Unable to add ")
- ACE_TEXT ("<%s> to protocol factory set.\n"),
- item->protocol_name ().c_str ()));
-
- delete item;
-
- if (transfer_ownership == 0)
- delete protocol_factory;
-
- return -1;
- }
+ return 0;
+}
- if (TAO_debug_level > 0)
- {
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("TAO (%P|%t) Loaded default ")
- ACE_TEXT ("protocol <SHMIOP_Factory>\n")));
- }
-#endif /* TAO_HAS_SHMIOP && TAO_HAS_SHMIOP != 0 */
+int
+TAO_Default_Resource_Factory::init_protocol_factories (void)
+{
+ TAO_ProtocolFactorySetItor end = protocol_factories_.end ();
+ TAO_ProtocolFactorySetItor factory = protocol_factories_.begin ();
- return 0;
+ if (factory == end)
+ {
+ return this->load_default_protocols ();
}
for (; factory != end; factory++)
@@ -834,22 +533,10 @@ TAO_Reactor_Registry *
TAO_Default_Resource_Factory::get_reactor_registry (void)
{
TAO_Reactor_Registry *reactor_registry = 0;
- switch (this->reactor_registry_type_)
- {
- default:
- case TAO_SINGLE_REACTOR:
- ACE_NEW_RETURN (reactor_registry,
- TAO_Single_Reactor,
- 0);
- break;
-
- case TAO_REACTOR_PER_PRIORITY:
- ACE_NEW_RETURN (reactor_registry,
- TAO_Reactor_Per_Priority,
- 0);
- break;
- }
+ ACE_NEW_RETURN (reactor_registry,
+ TAO_Single_Reactor,
+ 0);
return reactor_registry;
}
@@ -857,60 +544,11 @@ ACE_Reactor_Impl*
TAO_Default_Resource_Factory::allocate_reactor_impl (void) const
{
ACE_Reactor_Impl *impl = 0;
- switch (this->reactor_type_)
- {
- default:
- case TAO_REACTOR_SELECT_MT:
- ACE_NEW_RETURN (impl,
- TAO_REACTOR ((ACE_Sig_Handler*)0,
- (ACE_Timer_Queue*)0,
- 0,
- (ACE_Reactor_Notify*)0,
- this->reactor_mask_signals_),
- 0);
- break;
-
- case TAO_REACTOR_SELECT_ST:
- ACE_NEW_RETURN (impl,
- TAO_NULL_LOCK_REACTOR ((ACE_Sig_Handler*)0,
- (ACE_Timer_Queue*)0,
- 0,
- (ACE_Reactor_Notify*)0,
- this->reactor_mask_signals_),
- 0);
- break;
-
- case TAO_REACTOR_FL:
-#if defined(ACE_HAS_FL)
- ACE_NEW_RETURN (impl, ACE_FlReactor, 0);
-#endif /* ACE_HAS_FL */
- break;
-
- case TAO_REACTOR_TK:
-#if defined(ACE_HAS_TK)
- ACE_NEW_RETURN (impl, ACE_TkReactor, 0);
-#endif /* ACE_HAS_TK */
- break;
-
- case TAO_REACTOR_WFMO:
-#if defined(ACE_WIN32) && !defined (ACE_LACKS_MSG_WFMO)
- ACE_NEW_RETURN (impl, ACE_WFMO_Reactor, 0);
-#endif /* ACE_WIN32 && !ACE_LACKS_MSG_WFMO */
- break;
-
- case TAO_REACTOR_MSGWFMO:
-#if defined(ACE_WIN32) && !defined (ACE_HAS_WINCE)
- ACE_NEW_RETURN (impl, ACE_Msg_WFMO_Reactor, 0);
-#endif /* ACE_WIN32 && !ACE_HAS_WINCE */
- break;
-
- case TAO_REACTOR_TP:
- ACE_NEW_RETURN (impl, ACE_TP_Reactor ((ACE_Sig_Handler*)0,
- (ACE_Timer_Queue*)0,
- this->reactor_mask_signals_),
- 0);
- break;
- }
+
+ ACE_NEW_RETURN (impl, ACE_TP_Reactor ((ACE_Sig_Handler*)0,
+ (ACE_Timer_Queue*)0,
+ this->reactor_mask_signals_),
+ 0);
return impl;
}
@@ -953,21 +591,9 @@ ACE_Allocator *
TAO_Default_Resource_Factory::input_cdr_dblock_allocator (void)
{
ACE_Allocator *allocator = 0;
- switch (this->cdr_allocator_type_)
- {
- case TAO_ALLOCATOR_NULL_LOCK:
- ACE_NEW_RETURN (allocator,
- NULL_LOCK_ALLOCATOR,
- 0);
- break;
-
- case TAO_ALLOCATOR_THREAD_LOCK:
- default:
- ACE_NEW_RETURN (allocator,
- LOCKED_ALLOCATOR,
- 0);
- break;
- }
+ ACE_NEW_RETURN (allocator,
+ LOCKED_ALLOCATOR,
+ 0);
return allocator;
}
@@ -976,21 +602,10 @@ ACE_Allocator *
TAO_Default_Resource_Factory::input_cdr_buffer_allocator (void)
{
ACE_Allocator *allocator = 0;
- switch (this->cdr_allocator_type_)
- {
- case TAO_ALLOCATOR_NULL_LOCK:
- ACE_NEW_RETURN (allocator,
- NULL_LOCK_ALLOCATOR,
- 0);
- break;
-
- case TAO_ALLOCATOR_THREAD_LOCK:
- default:
- ACE_NEW_RETURN (allocator,
- LOCKED_ALLOCATOR,
- 0);
- break;
- }
+ ACE_NEW_RETURN (allocator,
+ LOCKED_ALLOCATOR,
+ 0);
+
return allocator;
}
@@ -1046,24 +661,10 @@ TAO_Default_Resource_Factory::get_priority_mapping (void)
return 0;
#else
TAO_Priority_Mapping *pm;
- switch (this->priority_mapping_type_)
- {
- case TAO_PRIORITY_MAPPING_LINEAR:
- ACE_NEW_RETURN (pm,
- TAO_Linear_Priority_Mapping (this->sched_policy_),
- 0);
- break;
- case TAO_PRIORITY_MAPPING_DIRECT:
- ACE_NEW_RETURN (pm,
- TAO_Direct_Priority_Mapping (this->sched_policy_),
- 0);
- break;
- default:
- ACE_NEW_RETURN (pm,
- TAO_Priority_Mapping,
- 0);
- break;
- }
+
+ ACE_NEW_RETURN (pm,
+ TAO_Priority_Mapping,
+ 0);
return pm;
#endif /* TAO_HAS_RT_CORBA == 0 */
}
@@ -1082,19 +683,11 @@ ACE_FACTORY_DEFINE (TAO, TAO_Default_Resource_Factory)
#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
-template class ACE_Select_Reactor_Token_T<ACE_Noop_Token>;
-template class ACE_Lock_Adapter<ACE_Select_Reactor_Token_T<ACE_Noop_Token> >;
-template class ACE_Select_Reactor_T< ACE_Select_Reactor_Token_T<ACE_Noop_Token> >;
-
template class auto_ptr<TAO_Protocol_Factory>;
template class ACE_Auto_Basic_Ptr<TAO_Protocol_Factory>;
#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
-#pragma instantiate ACE_Select_Reactor_Token_T<ACE_Noop_Token>
-#pragma instantiate ACE_Lock_Adapter< ACE_Select_Reactor_Token_T<ACE_Noop_Token> >
-#pragma instantiate ACE_Select_Reactor_T< ACE_Select_Reactor_Token_T<ACE_Noop_Token> >
-
#pragma instantiate auto_ptr<TAO_Protocol_Factory>
#pragma ACE_Auto_Basic_Ptr<TAO_Protocol_Factory>