summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Cleeland <chris.cleeland@gmail.com>1997-08-08 21:52:16 +0000
committerChris Cleeland <chris.cleeland@gmail.com>1997-08-08 21:52:16 +0000
commitee35246bbf23e5bee551ef7c21c5294233ca29ff (patch)
treea5cb80a5ba3067b98404629ef328e3c97f848fac
parent06e4dabf7dd1144d7a6ed11ca05a1325160ed84a (diff)
downloadATCD-ee35246bbf23e5bee551ef7c21c5294233ca29ff.tar.gz
Checkpoint commit of service config stuff. Hasn't even been compiled,
so don't count on it working!
-rw-r--r--TAO/ChangeLog-98c27
-rw-r--r--TAO/tao/Makefile11
-rw-r--r--TAO/tao/client_factory.cpp62
-rw-r--r--TAO/tao/client_factory.h87
-rw-r--r--TAO/tao/client_factory.i30
-rw-r--r--TAO/tao/default_client.cpp68
-rw-r--r--TAO/tao/default_client.h68
-rw-r--r--TAO/tao/default_client.i2
-rw-r--r--TAO/tao/default_server.cpp154
-rw-r--r--TAO/tao/default_server.h92
-rw-r--r--TAO/tao/default_server.i2
-rw-r--r--TAO/tao/factories.cpp180
-rw-r--r--TAO/tao/factories.h143
-rw-r--r--TAO/tao/orbobj.cpp151
-rw-r--r--TAO/tao/orbobj.h6
-rw-r--r--TAO/tao/orbobj.i26
-rw-r--r--TAO/tao/params.h23
-rw-r--r--TAO/tao/params.i4
-rw-r--r--TAO/tao/server_factory.cpp30
-rw-r--r--TAO/tao/server_factory.h80
-rw-r--r--TAO/tao/server_factory.i37
-rw-r--r--TAO/tao/svc.conf.eg4
22 files changed, 899 insertions, 388 deletions
diff --git a/TAO/ChangeLog-98c b/TAO/ChangeLog-98c
index 02346f80626..8fc23f19f60 100644
--- a/TAO/ChangeLog-98c
+++ b/TAO/ChangeLog-98c
@@ -1,3 +1,30 @@
+Fri Aug 8 14:25:20 1997 Chris Cleeland <cleeland@cs.wustl.edu>
+
+ * tao/orbobj.*: Updated various methods to use the new
+ dynamically-linked strategy factories discussed below.
+
+ * tao/default_client.*: This file now contains the default client
+ strategy factory which is (a) dynamically linkable by the service
+ configurator and (b) can be configured by flags passed in via
+ service configurator.
+
+ * tao/client_factory.*: This file now contains the abstract base
+ class for the client strategy factory.
+
+ * tao/default_server.*: This file now contains the default server
+ strategy factory which is (a) dynamically linkable by the service
+ configurator and (b) can be configured by flags passed in via
+ service configurator.
+
+ * tao/server_factory.*: This file now contains the abstract base
+ class for the server strategy factory.
+
+ * tao/params.*: Renamed DEMUX_STRATEGY enum to TAO_Demux_Strategy
+ and put it at global scope instead of within TAO_OA_Parameters.
+
+ * tao/svc.conf.eg: Created this file to serve as an example of
+ various lines one might find in an application's svc.conf.
+
Thu Aug 7 09:51:31 1997 Aniruddha Gokhale <gokhale@mambo.cs.wustl.edu>
* factories.cpp: Incorrect use of ACE_ASSERT in
diff --git a/TAO/tao/Makefile b/TAO/tao/Makefile
index c43684c6572..a665b817aa3 100644
--- a/TAO/tao/Makefile
+++ b/TAO/tao/Makefile
@@ -15,8 +15,10 @@ CORBA_SRCS = any corbacom except nvlist object orbobj principa \
request svrrqst boa typecode optable
# These are components that are only headers and must be installed
-OTHERS_HDRS = align cdr giop iiopobj iioporb xdr roa connect params factories marshal debug
-OTHERS_INLN = any boa cdr connect factories iiopobj iioporb object orbobj params roa svrrqst typecode marshal
+OTHERS_HDRS = align cdr giop iiopobj iioporb xdr roa connect params marshal debug \
+ default_client default_server server_factory client_factory
+OTHERS_INLN = any boa cdr connect iiopobj iioporb object orbobj params roa svrrqst typecode marshal \
+ default_client default_server server_factory client_factory
# These are components that are either header & source or source-only
OTHERS_SRCS = \
giop \
@@ -25,7 +27,10 @@ OTHERS_SRCS = \
invoke \
roa \
params \
- factories \
+ default_client \
+ default_server \
+ server_factory \
+ client_factory \
objtable \
connect \
xdr \
diff --git a/TAO/tao/client_factory.cpp b/TAO/tao/client_factory.cpp
new file mode 100644
index 00000000000..cffc8fadf10
--- /dev/null
+++ b/TAO/tao/client_factory.cpp
@@ -0,0 +1,62 @@
+// ============================================================================
+//
+// = LIBRARY
+// TAO
+//
+// = FILENAME
+// client_factory.cpp
+//
+// = AUTHOR
+// Chris Cleeland
+//
+// = VERSION
+// $Id$
+// ============================================================================
+
+#if !defined(__ACE_INLINE__)
+# include "client_factory.i"
+#endif
+
+// Template specializations which allow the cached connection manager
+// to work better.
+
+size_t
+ACE_Hash_Addr<ACE_INET_Addr, TAO_Client_Connection_Handler>::hash_i (const ACE_INET_Addr &addr) const
+{
+ return addr.get_ip_address () + addr.get_port_number ();
+}
+
+int
+ACE_Hash_Addr<ACE_INET_Addr, TAO_Client_Connection_Handler>::compare_i (const ACE_INET_Addr &a1,
+ const ACE_INET_Addr &a2) const
+{
+ return a1 != a2;
+}
+
+int
+TAO_Client_Connection_Handler::open(void *)
+{
+ // Here is where we could enable all sorts of things such as
+ // nonblock I/O, sock buf sizes, TCP no-delay, etc.
+
+ const int MAX_SOCK_BUF_SIZE = 65536;
+ if (this->peer ().set_option(SOL_SOCKET, SO_SNDBUF, (void
+ *)&MAX_SOCK_BUF_SIZE,
+ sizeof(MAX_SOCK_BUF_SIZE)) == -1)
+ return -1;
+ if (this->peer ().set_option(SOL_SOCKET, SO_RCVBUF, (void
+ *)&MAX_SOCK_BUF_SIZE,
+ sizeof (MAX_SOCK_BUF_SIZE)) == -1)
+ return -1;
+
+ // For now, we just return success
+ return 0;
+}
+
+#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
+template class ACE_Strategy_Connector<TAO_Client_Connection_Handler, ACE_SOCK_CONNECTOR>;
+template class ACE_NOOP_Creation_Strategy<TAO_Client_Connection_Handler>;
+#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
+#pragma instantiate ACE_Strategy_Connector<TAO_Client_Connection_Handler, ACE_SOCK_CONNECTOR>
+#pragma instantiate ACE_NOOP_Creation_Strategy<TAO_Client_Connection_Handler>
+#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
diff --git a/TAO/tao/client_factory.h b/TAO/tao/client_factory.h
new file mode 100644
index 00000000000..dc7171f05eb
--- /dev/null
+++ b/TAO/tao/client_factory.h
@@ -0,0 +1,87 @@
+// This may look like C, but it's really -*- C++ -*-
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO
+//
+// = FILENAME
+// client_factory.h
+//
+// = AUTHOR
+// Chris Cleeland
+//
+// = VERSION
+// $Id$
+// ============================================================================
+
+#if !defined(TAO_CLIENT_FACTORY_H)
+# define TAO_CLIENT_FACTORY_H
+
+# include "ace/SOCK_Acceptor.h"
+# include "ace/SOCK_Connector.h"
+# include "ace/Svc_Handler.h"
+# include "ace/Strategies_T.h"
+# include "ace/Connector.h"
+# include "ace/Synch.h"
+
+# include "tao/params.h"
+
+class TAO_Client_Connection_Handler : public ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH>
+// = TITLE
+// <Svc_Handler> used on the client side and returned
+// by the <TAO_Client_Factory::CONNECTOR>.
+// @@ Should this be in here or in the default_client.*?
+{
+public:
+ // = Intialization method.
+ TAO_Client_Connection_Handler (ACE_Thread_Manager* = 0);
+ // Do-nothing constructor
+
+ // = <Connector> hook.
+ virtual int open (void*);
+ // Initialization hook
+
+ void in_use (CORBA_Boolean);
+ // Set the in-use flag.
+
+ CORBA_Boolean in_use (void);
+ // Return state of the in-use flag.
+
+private:
+ CORBA_Boolean in_use_;
+ // True value indicates that something is using this handler.
+};
+
+
+class TAO_Client_Strategy_Factory : public ACE_Service_Object
+ // = TITLE
+ // Abstract factory used by the client to turn out various
+ // strategies used on the client side.
+{
+public:
+ // = Intialization and termination methods.
+ TAO_Client_Strategy_Factory (void);
+ // Constructor
+
+ virtual ~TAO_Client_Strategy_Factory (void);
+ // Destructor
+
+ // = Client-side strategy types.
+ typedef ACE_Strategy_Connector<TAO_Client_Connection_Handler, ACE_SOCK_CONNECTOR>
+ CONNECTOR;
+ typedef ACE_NOOP_Creation_Strategy<TAO_Client_Connection_Handler>
+ NULL_CREATION_STRATEGY;
+
+ // = Factory methods for ORB strategies.
+
+#if defined (TAO_HAS_CLIENT_CONCURRENCY)
+ virtual CONCURRENCY_STRATEGY *concurrency_strategy (void);
+#endif
+
+ virtual CONNECTOR *connector (void);
+ // Return a pointer to a connector using appropriate strategies.
+
+};
+
+#endif /* TAO_CLIENT_FACTORY_H */
diff --git a/TAO/tao/client_factory.i b/TAO/tao/client_factory.i
new file mode 100644
index 00000000000..efb9c3e3132
--- /dev/null
+++ b/TAO/tao/client_factory.i
@@ -0,0 +1,30 @@
+ACE_INLINE
+TAO_Client_Connection_Handler::TAO_Client_Connection_Handler (ACE_Thread_Manager *)
+ : in_use_ (0)
+{}
+
+ACE_INLINE CORBA_Boolean
+TAO_Client_Connection_Handler::in_use (void)
+{
+ return in_use_;
+}
+
+ACE_INLINE void
+TAO_Client_Connection_Handler::in_use (CORBA_Boolean flag)
+{
+ in_use_ = flag;
+}
+
+ACE_INLINE CONNECTOR *
+TAO_Client_Strategy_Factory::connector (void)
+{
+ return 0;
+}
+
+ACE_INLINE
+TAO_Client_Strategy_Factory::TAO_Client_Strategy_Factory (void)
+{}
+
+ACE_INLINE
+TAO_Client_Strategy_Factory::~TAO_Client_Strategy_Factory (void)
+{}
diff --git a/TAO/tao/default_client.cpp b/TAO/tao/default_client.cpp
new file mode 100644
index 00000000000..158d66db881
--- /dev/null
+++ b/TAO/tao/default_client.cpp
@@ -0,0 +1,68 @@
+// ============================================================================
+//
+// = LIBRARY
+// TAO
+//
+// = FILENAME
+// default_client.cpp
+//
+// = AUTHOR
+// Chris Cleeland
+//
+// = VERSION
+// $Id$
+// ============================================================================
+
+
+#define ACE_BUILD_SVC_DLL
+#include "default_client.h"
+
+TAO_Default_Client_Strategy_Factory::TAO_Default_Client_Strategy_Factory (void)
+{
+ // When should I do this open ()? It seems like this is way too
+ // early, but doing it in the accessor for connector () seems like
+ // it would be too late as well.
+ connector_.open (ACE_Reactor::instance (),
+ &null_creation_strategy_,
+ &caching_connect_strategy_,
+#if defined (TAO_HAS_CLIENT_CONCURRENCY)
+ concurrency_strategy_ ()
+#else
+ 0
+#endif /* TAO_HAS_CLIENT_CONCURRENCY */
+ );
+}
+
+TAO_Default_Client_Strategy_Factory::~TAO_Default_Client_Strategy_Factory (void)
+{}
+
+int
+TAO_Default_Client_Strategy_Factory::init (int argc, char *argv[])
+{
+ return this->parse_args (argc, argv);
+}
+
+TAO_Client_Strategy_Factory::CONNECTOR*
+TAO_Default_Client_Strategy_Factory::connector (void)
+{
+ return &connector_;
+}
+
+int
+TAO_Default_Client_Strategy_Factory::parse_args (int argc, char *argv[])
+{
+ // no args to parse at this time
+ return 0;
+}
+
+#if ! defined(__ACE_INLINE__)
+# include "default_client.i"
+#endif
+
+#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
+template class ACE_Cached_Connect_Strategy<TAO_Client_Connection_Handler, ACE_SOCK_CONNECTOR, ACE_SYNCH_RW_MUTEX>;
+#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
+#pragma instantiate ACE_Cached_Connect_Strategy<TAO_Client_Connection_Handler, ACE_SOCK_CONNECTOR, ACE_SYNCH_RW_MUTEX>
+#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
+
+ACE_SVC_FACTORY_DEFINE (TAO_Default_Client_Strategy_Factory)
diff --git a/TAO/tao/default_client.h b/TAO/tao/default_client.h
new file mode 100644
index 00000000000..00c012ff193
--- /dev/null
+++ b/TAO/tao/default_client.h
@@ -0,0 +1,68 @@
+// This may look like C, but it's really -*- C++ -*-
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO
+//
+// = FILENAME
+// default_client.h
+//
+// = AUTHOR
+// Chris Cleeland
+//
+// = VERSION
+// $Id$
+// ============================================================================
+
+#if !defined (TAO_DEFAULT_CLIENT_H)
+# define TAO_DEFAULT_CLIENT_H
+
+# include "ace/SOCK_Acceptor.h"
+# include "ace/SOCK_Connector.h"
+# include "ace/Strategies_T.h"
+# include "ace/Connector.h"
+# include "ace/Synch.h"
+
+# include "tao/params.h"
+# include "tao/connect.h"
+# include "tao/objtable.h"
+
+class TAO_Default_Client_Strategy_Factory : public TAO_Client_Strategy_Factory
+// = TITLE
+// This is the "default" client strategy factor for TAO...basically, it
+// includes strategies that are configured through command-line options
+// so that everything operates as if there were no dynamically-linkable
+// strategies.
+{
+public:
+ typedef ACE_Cached_Connect_Strategy<TAO_Client_Connection_Handler,
+ ACE_SOCK_CONNECTOR,
+ ACE_SYNCH_RW_MUTEX>
+ CACHED_CONNECT_STRATEGY;
+
+ TAO_Default_Client_Strategy_Factory (void);
+ virtual ~TAO_Default_Client_Strategy_Factory (void);
+
+ virtual TAO_Client_Strategy_Factory::CONNECTOR *connector (void);
+ // Return a pointer to a connector using appropriate strategies.
+
+ // = SERVICE CONFIGURATOR HOOKS
+ virtual int init(int argc, char* argv[]);
+ // Dynamic linking hook
+
+ int parse_args(int argc, char* argv[]);
+ // Parse svc.conf arguments
+
+private:
+# if defined (TAO_HAS_CLIENT_CONCURRENCY)
+ CONCURRENCY_STRATEGY *concurrency_strategy_;
+# endif
+ CONNECTOR connector_;
+ NULL_CREATION_STRATEGY null_creation_strategy_;
+ CACHED_CONNECT_STRATEGY caching_connect_strategy_;
+};
+
+ACE_SVC_FACTORY_DECLARE (TAO_Default_Client_Strategy_Factory)
+
+#endif /* TAO_DEFAULT_CLIENT_H */
diff --git a/TAO/tao/default_client.i b/TAO/tao/default_client.i
new file mode 100644
index 00000000000..fa599c50301
--- /dev/null
+++ b/TAO/tao/default_client.i
@@ -0,0 +1,2 @@
+// This is the inline file, which probably shouldn't be used since all
+// the methods are virtual and will be dynamically linked in anyway.
diff --git a/TAO/tao/default_server.cpp b/TAO/tao/default_server.cpp
new file mode 100644
index 00000000000..1d9fc7698ac
--- /dev/null
+++ b/TAO/tao/default_server.cpp
@@ -0,0 +1,154 @@
+// ============================================================================
+//
+// = FILENAME
+// default_server.cpp
+//
+// = AUTHOR
+// Chris Cleeland
+//
+// = VERSION
+// $Id$
+// ============================================================================
+
+#define ACE_BUILD_SVC_DLL
+#include "default_server.h"
+
+TAO_Default_Server_Strategy_Factory::TAO_Default_Server_Strategy_Factory(void)
+ : thread_flags_ (0),
+ object_table_size_ (SERVER_OBJECT_TABLE_SIZE),
+ concurrency_strategy_ (0),
+ objtable_ (0)
+{}
+
+TAO_Default_Server_Strategy_Factory::~TAO_Default_Server_Strategy_Factory (void)
+{
+ // perform appropriate cleanup
+ delete this->objtable_;
+}
+
+TAO_Default_Server_Strategy_Factory::CONCURRENCY_STRATEGY*
+TAO_Default_Server_Strategy_Factory::concurrency_strategy(void)
+{
+ return this->concurrency_strategy_;
+}
+
+TAO_Default_Server_Strategy_Factory::TAO_Object_Table*
+TAO_Default_Server_Strategy_Factory::object_lookup_strategy(void)
+{
+ return this->objtable_;
+}
+
+// Evil macros b/c I'm lazy!
+#define BEGINCHECK if (0)
+#define CHECKANDSET(sym) else if (ACE_OS::strcmp (flag, #sym) == 0) ACE_SET_BITS (this->thread_flags_, sym)
+#define ENDCHECK
+
+void
+TAO_Default_Server_Strategy_Factory::tokenize (char *flag_string)
+{
+ // @@ Danger! strtok not re-entrant...need to find a re-entrant version!
+ for (char *flag = ACE_OS::strtok (flag_string, "|");
+ flag != 0;
+ flag = ACE_OS::strtok(0, "|"))
+ {
+ BEGINCHECK;
+ CHECKANDSET (THR_DETACHED);
+ CHECKANDSET (THR_BOUND);
+ CHECKANDSET (THR_NEW_LWP);
+ CHECKANDSET (THR_SUSPENDED);
+ CHECKANDSET (THR_DAEMON);
+ ENDCHECK;
+ }
+
+}
+
+int
+TAO_Default_Server_Strategy_Factory::init(int argc, char* argv[])
+{
+ return this->parse_args(argc, argv);
+}
+
+int
+TAO_Default_Server_Strategy_Factory::parse_args(int argc, char* argv[])
+{
+ ACE_TRACE("TAO_Default_Server_Strategy_Factory::parse_args");
+
+ ACE_Get_Opt get_opt (argc, argv, "t:s:RTL:", 0);
+
+ TAO_Demux_Strategy strat = TAO_NONE;
+
+ for (int c; (c = get_opt()) != -1; )
+ {
+ switch(c)
+ {
+ case 't':
+ {
+ char* temp = get_opt.optarg;
+ this->tokenize(temp);
+ }
+ break;
+
+ case 's':
+ this->object_table_size_ = ACE_OS::strtoul(get_opt.optarg);
+ break;
+
+ case 'R':
+ // Set Reactive concurrency strategy
+ this->concurrency_strategy_ = &reactive_strategy_;
+ break;
+
+ case 'T':
+ // Set thread-per-connection concurrency strategy
+ this->concurrency_strategy_ = &threaded_strategy_;
+ break;
+
+ case 'L':
+ {
+ char *name = getopt.opt_arg;
+ if (ACE_OS::strcasecmp(name, "dynamic") == 0)
+ strat = TAO_DYNAMIC_HASH;
+ else if (ACE_OS::strcasecmp(name, "linear") == 0)
+ strat = TAO_LINEAR;
+ else if (ACE_OS::strcasecmp(name, "active") == 0)
+ strat = TAO_ACTIVE_HASH;
+ else if (ACE_OS::strcasecmp(name, "user") == 0)
+ strat = TAO_USER_DEFINED;
+ }
+ break;
+ }
+ }
+
+ // Create the appropriate-sized object table based on passed arguments.
+ switch (strat)
+ {
+ case TAO_LINEAR:
+ ACE_NEW (this->objtable_, TAO_Linear_ObjTable (this->object_table_size_));
+ break;
+#if 0
+ // Don't do this one right now until we determine how to deal
+ // with its reliance on a global singleton.
+ case TAO_USER_DEFINED:
+ // it is assumed that the user would have used the hooks to supply a
+ // user-defined instance of the object table
+ this->objtable_ = p->userdef_lookup_strategy ();
+ break;
+#endif
+ case TAO_ACTIVE_DEMUX:
+ ACE_NEW (this->objtable_, TAO_Active_Demux_ObjTable (this->object_table_size_));
+ break;
+ case TAO_DYNAMIC_HASH:
+ case TAO_NONE:
+ default:
+ ACE_NEW (this->objtable_, TAO_Dynamic_Hash_ObjTable (this->object_table_size_));
+ break;
+ }
+}
+
+#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
+//template class ...
+#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
+#pragma instantiate ...
+#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
+
+ACE_SVC_FACTORY_DEFINE (TAO_Default_Server_Strategy_Factory)
+
diff --git a/TAO/tao/default_server.h b/TAO/tao/default_server.h
new file mode 100644
index 00000000000..d46c6ed36b9
--- /dev/null
+++ b/TAO/tao/default_server.h
@@ -0,0 +1,92 @@
+// This may look like C, but it's really -*- C++ -*-
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO
+//
+// = FILENAME
+// default_server.h
+//
+// = AUTHOR
+// Chris Cleeland
+//
+// = VERSION
+// $Id$
+// ============================================================================
+
+#if !defined (TAO_DEFAULT_SERVER_FACTORY_H)
+# define TAO_DEFAULT_SERVER_FACTORY_H
+
+# include "ace/SOCK_Acceptor.h"
+# include "ace/Svc_Handler.h"
+# include "ace/Strategies_T.h"
+# include "ace/Connector.h"
+# include "ace/Synch.h"
+# include "ace/Service_Object.h"
+
+# include "tao/connect.h"
+# include "tao/objtable.h"
+
+# if !defined(SERVER_OBJECT_TABLE_SIZE)
+# define SERVER_OBJECT_TABLE_SIZE 64
+# endif
+
+class TAO_Default_Server_Strategy_Factory : public TAO_Server_Factory
+// = TITLE
+// This is the default strategy factory for CORBA servers. It
+// basically allows one to choose strategies via argument flags and
+// so gives substantial freedom for experimentation at the expense
+// of memory.
+{
+public:
+ // = Initialization and termination methods.
+ TAO_Default_Server_Strategy_Factory (void);
+ virtual ~TAO_Default_Server_Strategy_Factory (void);
+
+ // = Server-side ORB Strategy Factory Methods.
+ virtual CREATION_STRATEGY *creation_strategy (void);
+ virtual ACCEPT_STRATEGY *accept_strategy (void);
+ virtual CONCURRENCY_STRATEGY *concurrency_strategy (void);
+ virtual SCHEDULING_STRATEGY *scheduling_strategy (void);
+ virtual TAO_Object_Table *object_lookup_strategy( void);
+
+ // = SERVICE CONFIGURATOR HOOKS
+ virtual int init (int argc, char* argv[]);
+ int parse_args (int argc, char* argv[]);
+
+private:
+ void tokenize (char* flag_string);
+
+ u_long thread_flags_;
+ // Default thread flags passed to thr_create().
+
+ u_long object_table_size_;
+ // Default size of object lookup table.
+
+ // = Strategies Used.
+ ACE_Reactive_Strategy<TAO_OA_Connection_Handler> reactive_strategy_;
+ // A strategy for passively establishing connections which utilizes the Reactor.
+ ACE_Thread_Strategy<TAO_OA_Connection_Handler> threaded_strategy_;
+ // The threaded strategy used for passively establishing connections.
+
+ CONCURRENCY_STRATEGY *concurrency_strategy_;
+ // concrete concurrency strategy.
+
+ TAO_Object_Table *objtable_;
+ // instance of object table
+#if 0
+ // Someday we'll need these!
+ CREATION_STRATEGY *creation_strategy_;
+ ACCEPT_STRATEGY *accept_strategy_;
+ SCHEDULING_STRATEGY *scheduling_strategy_;
+#endif
+};
+
+ACE_SVC_FACTORY_DECLARE (TAO_Default_Server_Strategy_Factory)
+
+# if defined(__ACE_INLINE__)
+# include "default_server.i"
+# endif
+
+#endif /* TAO_DEFAULT_SERVER_FACTORY_H */
diff --git a/TAO/tao/default_server.i b/TAO/tao/default_server.i
new file mode 100644
index 00000000000..fa599c50301
--- /dev/null
+++ b/TAO/tao/default_server.i
@@ -0,0 +1,2 @@
+// This is the inline file, which probably shouldn't be used since all
+// the methods are virtual and will be dynamically linked in anyway.
diff --git a/TAO/tao/factories.cpp b/TAO/tao/factories.cpp
deleted file mode 100644
index 67e936d96c1..00000000000
--- a/TAO/tao/factories.cpp
+++ /dev/null
@@ -1,180 +0,0 @@
-#include "tao/factories.h"
-
-#if !defined(__ACE_INLINE__)
-# include "factories.i"
-#endif
-
-// Template specializations which allow the cached connection manager
-// to work better.
-
-size_t
-ACE_Hash_Addr<ACE_INET_Addr, TAO_Client_Connection_Handler>::hash_i (const ACE_INET_Addr &addr) const
-{
- return addr.get_ip_address () + addr.get_port_number ();
-}
-
-int
-ACE_Hash_Addr<ACE_INET_Addr, TAO_Client_Connection_Handler>::compare_i (const ACE_INET_Addr &a1,
- const ACE_INET_Addr &a2) const
-{
- return a1 != a2;
-}
-
-int
-TAO_Client_Connection_Handler::open(void *)
-{
- // Here is where we could enable all sorts of things such as
- // nonblock I/O, sock buf sizes, TCP no-delay, etc.
-
- const int MAX_SOCK_BUF_SIZE = 65536;
- if (this->peer ().set_option(SOL_SOCKET, SO_SNDBUF, (void
- *)&MAX_SOCK_BUF_SIZE,
- sizeof(MAX_SOCK_BUF_SIZE)) == -1)
- return -1;
- if (this->peer ().set_option(SOL_SOCKET, SO_RCVBUF, (void
- *)&MAX_SOCK_BUF_SIZE,
- sizeof (MAX_SOCK_BUF_SIZE)) == -1)
- return -1;
-
- // For now, we just return success
- return 0;
-}
-
-// Determine the appropriate default thread flags, based on system.
-// When I put the concurrency strategy into the factory, then this
-// will go away b/c the concurrency strategy will do this appropriate
-// for each platform!
-# if defined(linux)
-# define ROA_DEFAULT_THREADFLAGS (THR_DETACHED)
-# elif defined(WIN32)
-# define ROA_DEFAULT_THREADFLAGS (THR_DETACHED)
-# elif defined(sparc)
-# define ROA_DEFAULT_THREADFLAGS (THR_DETACHED | THR_BOUND)
-# else
-# define ROA_DEFAULT_THREADFLAGS (THR_DETACHED)
-# endif
-
-TAO_Server_Factory::CONCURRENCY_STRATEGY*
-TAO_Server_Factory::concurrency_strategy ()
-{
- TAO_OA_Parameters* p = TAO_OA_PARAMS::instance ();
-
-
- if (p->using_threads ())
- {
- // Set the strategy parameters
- threaded_strategy_.open (ACE_Thread_Manager::instance (),
- ROA_DEFAULT_THREADFLAGS);
- concurrency_strategy_ = &threaded_strategy_;
- }
- else
- {
- reactive_strategy_.open (ACE_Reactor::instance ());
- concurrency_strategy_ = &reactive_strategy_;
- }
-
- return concurrency_strategy_;
-}
-
-TAO_Object_Table *
-TAO_Server_Factory::object_lookup_strategy (void)
-{
- TAO_OA_Parameters* p = TAO_OA_PARAMS::instance ();
-
- // Since these are dynamically created, when do they get destroyed?
- // XXXASG: My guess is that these should go when the OA is freed
- switch (p->demux_strategy ())
- {
- case TAO_OA_Parameters::TAO_LINEAR:
- ACE_NEW_RETURN (this->objtable_,
- TAO_Linear_ObjTable (p->tablesize ()),
- 0);
- break;
- case TAO_OA_Parameters::TAO_USER_DEFINED:
- // it is assumed that the user would have used the hooks to supply a
- // user-defined instance of the object table
- // ACE_ASSERT (this->objtable_ != 0);
- this->objtable_ = p->userdef_lookup_strategy ();
- break;
- case TAO_OA_Parameters::TAO_ACTIVE_DEMUX:
- ACE_NEW_RETURN (this->objtable_,
- TAO_Active_Demux_ObjTable (p->tablesize ()),
- 0);
- break;
- case TAO_OA_Parameters::TAO_DYNAMIC_HASH:
- default:
- ACE_NEW_RETURN (this->objtable_,
- TAO_Dynamic_Hash_ObjTable (p->tablesize ()),
- 0);
- }
- return this->objtable_;
-}
-
-TAO_Client_Factory::TAO_Client_Factory (void)
-{
- // When should I do this open ()? It seems like this is way too
- // early, but doing it in the accessor for connector () seems like
- // it would be too late as well.
- connector_.open (ACE_Reactor::instance (),
- &null_creation_strategy_,
- &caching_connect_strategy_,
-#if defined (TAO_HAS_CLIENT_CONCURRENCY)
- concurrency_strategy_ ()
-#else
- 0
-#endif /* TAO_HAS_CLIENT_CONCURRENCY */
- );
-}
-
-TAO_Client_Factory::~TAO_Client_Factory (void)
-{}
-
-#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
-template class ACE_Thread_Strategy<TAO_OA_Connection_Handler>;
-template class ACE_Concurrency_Strategy<TAO_OA_Connection_Handler>;
-template class ACE_Reactive_Strategy<TAO_OA_Connection_Handler>;
-template class ACE_Creation_Strategy<TAO_OA_Connection_Handler>;
-template class ACE_Scheduling_Strategy<TAO_OA_Connection_Handler>;
-template class ACE_Accept_Strategy<TAO_OA_Connection_Handler, ACE_SOCK_ACCEPTOR>;
-
-template class ACE_Creation_Strategy<TAO_Client_Connection_Handler>;
-template class ACE_Connect_Strategy<TAO_Client_Connection_Handler, ACE_SOCK_CONNECTOR>;
-template class ACE_Concurrency_Strategy<TAO_Client_Connection_Handler>;
-template class ACE_Cached_Connect_Strategy<TAO_Client_Connection_Handler, ACE_SOCK_CONNECTOR, ACE_SYNCH_RW_MUTEX>;
-template class ACE_NOOP_Creation_Strategy<TAO_Client_Connection_Handler>;
-template class ACE_Strategy_Connector<TAO_Client_Connection_Handler, ACE_SOCK_CONNECTOR>;
-template class ACE_Connector<TAO_Client_Connection_Handler, ACE_SOCK_CONNECTOR>;
-#define TAO_HASH_ADDR ACE_Hash_Addr<ACE_INET_Addr, TAO_Client_Connection_Handler>
-template class TAO_HASH_ADDR;
-template class ACE_Hash_Map_Manager<TAO_HASH_ADDR, TAO_Client_Connection_Handler*, ACE_SYNCH_RW_MUTEX>;
-template class ACE_Hash_Map_Entry<TAO_HASH_ADDR, TAO_Client_Connection_Handler*>;
-#define TAO_SVC_TUPLE ACE_Svc_Tuple<TAO_Client_Connection_Handler>
-template class TAO_SVC_TUPLE;
-template class ACE_Map_Manager<int, TAO_SVC_TUPLE*, ACE_SYNCH_RW_MUTEX>;
-template class ACE_Map_Iterator<int, TAO_SVC_TUPLE*, ACE_SYNCH_RW_MUTEX>;
-template class ACE_Map_Entry<int, TAO_SVC_TUPLE*>;
-#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
-#pragma instantiate ACE_Thread_Strategy<TAO_OA_Connection_Handler>
-#pragma instantiate ACE_Concurrency_Strategy<TAO_OA_Connection_Handler>
-#pragma instantiate ACE_Reactive_Strategy<TAO_OA_Connection_Handler>
-#pragma instantiate ACE_Creation_Strategy<TAO_OA_Connection_Handler>
-#pragma instantiate ACE_Scheduling_Strategy<TAO_OA_Connection_Handler>
-#pragma instantiate ACE_Accept_Strategy<TAO_OA_Connection_Handler, ACE_SOCK_ACCEPTOR>
-
-#pragma instantiate ACE_Creation_Strategy<TAO_Client_Connection_Handler>
-#pragma instantiate ACE_Connect_Strategy<TAO_Client_Connection_Handler, ACE_SOCK_CONNECTOR>
-#pragma instantiate ACE_Concurrency_Strategy<TAO_Client_Connection_Handler>
-#pragma instantiate ACE_Cached_Connect_Strategy<TAO_Client_Connection_Handler, ACE_SOCK_CONNECTOR, ACE_SYNCH_RW_MUTEX>
-#pragma instantiate ACE_NOOP_Creation_Strategy<TAO_Client_Connection_Handler>
-#pragma instantiate ACE_Strategy_Connector<TAO_Client_Connection_Handler, ACE_SOCK_CONNECTOR>
-#pragma instantiate ACE_Connector<TAO_Client_Connection_Handler, ACE_SOCK_CONNECTOR>
-#define TAO_HASH_ADDR ACE_Hash_Addr<ACE_INET_Addr, TAO_Client_Connection_Handler>
-#pragma instantiate TAO_HASH_ADDR
-#pragma instantiate ACE_Hash_Map_Manager<TAO_HASH_ADDR, TAO_Client_Connection_Handler*, ACE_SYNCH_RW_MUTEX>
-#pragma instantiate ACE_Hash_Map_Entry<TAO_HASH_ADDR, TAO_Client_Connection_Handler*>
-#define TAO_SVC_TUPLE ACE_Svc_Tuple<TAO_Client_Connection_Handler>
-#pragma instantiate TAO_SVC_TUPLE
-#pragma instantiate ACE_Map_Manager<int, TAO_SVC_TUPLE*, ACE_SYNCH_RW_MUTEX>
-#pragma instantiate ACE_Map_Iterator<int, TAO_SVC_TUPLE*, ACE_SYNCH_RW_MUTEX>
-#pragma instantiate ACE_Map_Entry<int, TAO_SVC_TUPLE*>
-#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
diff --git a/TAO/tao/factories.h b/TAO/tao/factories.h
deleted file mode 100644
index 26307616513..00000000000
--- a/TAO/tao/factories.h
+++ /dev/null
@@ -1,143 +0,0 @@
-// This may look like C, but it's really -*- C++ -*-
-
-// ============================================================================
-//
-// = LIBRARY
-// TAO
-//
-// = FILENAME
-// factories.h
-//
-// = AUTHOR
-// Chris Cleeland
-//
-// = VERSION
-// $Id$
-// ============================================================================
-
-#if !defined (TAO_FACTORIES_H)
-# define TAO_FACTORIES_H
-
-# include "ace/SOCK_Acceptor.h"
-# include "ace/SOCK_Connector.h"
-# include "ace/Strategies_T.h"
-# include "ace/Connector.h"
-# include "ace/Synch.h"
-
-# include "tao/params.h"
-# include "tao/connect.h"
-# include "tao/objtable.h"
-
-class TAO_Client_Connection_Handler : public ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH>
- // = TITLE
- // <Svc_Handler> used on the client side and returned
- // by the <TAO_Client_Factory::CONNECTOR>.
-{
-public:
- TAO_Client_Connection_Handler (ACE_Thread_Manager* = 0);
- // Do-nothing constructor
-
- virtual int open (void*);
- // Initialization hook
-
- void in_use (CORBA_Boolean);
- // Set the in-use flag.
-
- CORBA_Boolean in_use (void);
- // Return state of the in-use flag.
-
-private:
- CORBA_Boolean in_use_;
- // True value indicates that something is using this handler.
-};
-
-class TAO_Client_Factory
- // = TITLE
- // Abstract factory used by the client to turn out various
- // strategies used on the client side.
-{
-public:
- typedef ACE_Strategy_Connector<TAO_Client_Connection_Handler, ACE_SOCK_CONNECTOR>
- CONNECTOR;
- typedef ACE_NOOP_Creation_Strategy<TAO_Client_Connection_Handler>
- NULL_CREATION_STRATEGY;
- typedef ACE_Cached_Connect_Strategy<TAO_Client_Connection_Handler,
- ACE_SOCK_CONNECTOR,
- ACE_SYNCH_RW_MUTEX>
- CACHED_CONNECT_STRATEGY;
-
-#if defined (TAO_HAS_CLIENT_CONCURRENCY)
- CONCURRENCY_STRATEGY *concurrency_strategy (void);
-#endif
-
- CONNECTOR *connector (void);
- // Return a pointer to a connector using appropriate strategies.
-
- TAO_Client_Factory (void);
- ~TAO_Client_Factory (void);
-
-private:
-#if defined (TAO_HAS_CLIENT_CONCURRENCY)
- CONCURRENCY_STRATEGY *concurrency_strategy_;
-#endif
- CONNECTOR connector_;
- NULL_CREATION_STRATEGY null_creation_strategy_;
- CACHED_CONNECT_STRATEGY caching_connect_strategy_;
-};
-
-class TAO_Server_Factory
- // = TITLE
- // Abstract factory used by the server side to turn out various
- // strategies of special utility to it.
-{
-public:
- // = SERVER-SIDE
- typedef ACE_Creation_Strategy<TAO_OA_Connection_Handler> CREATION_STRATEGY;
- typedef ACE_Accept_Strategy<TAO_OA_Connection_Handler, ACE_SOCK_ACCEPTOR> ACCEPT_STRATEGY;
- typedef ACE_Concurrency_Strategy<TAO_OA_Connection_Handler> CONCURRENCY_STRATEGY;
- typedef ACE_Scheduling_Strategy<TAO_OA_Connection_Handler> SCHEDULING_STRATEGY;
-
- CREATION_STRATEGY *creation_strategy (void);
- // return concrete creation strategy
-
- ACCEPT_STRATEGY *accept_strategy (void);
- // return concrete acceptor strategy
-
- CONCURRENCY_STRATEGY *concurrency_strategy (void);
- // return the concurrency strategy used
-
- SCHEDULING_STRATEGY *scheduling_strategy (void);
- // return the scheduling strategy used
-
- TAO_Object_Table *object_lookup_strategy (void);
- // return the concrete object lookup strategy
-
- TAO_Server_Factory (void);
- // constructor
-
-private:
- // = COMMON
- ACE_Thread_Strategy<TAO_OA_Connection_Handler> threaded_strategy_;
- // The threaded strategy used for passively establishing connections.
- ACE_Reactive_Strategy<TAO_OA_Connection_Handler> reactive_strategy_;
- // A strategy for passively establishing connections which utilizes the Reactor.
-
- // = SERVER
- CONCURRENCY_STRATEGY *concurrency_strategy_;
- // concrete concurrency strategy
-
- TAO_Object_Table *objtable_;
- // instance of object table
-#if 0
- // Someday we'll need these!
- CREATION_STRATEGY *creation_strategy_;
- ACCEPT_STRATEGY *accept_strategy_;
- SCHEDULING_STRATEGY *scheduling_strategy_;
-#endif
-};
-
-# if defined (__ACE_INLINE__)
-# include "factories.i"
-# endif
-
-#endif /* TAO_FACTORIES_H */
diff --git a/TAO/tao/orbobj.cpp b/TAO/tao/orbobj.cpp
index 4c11b9458b4..f067ed48297 100644
--- a/TAO/tao/orbobj.cpp
+++ b/TAO/tao/orbobj.cpp
@@ -41,6 +41,56 @@ DEFINE_GUID (IID_CORBA_ORB,
DEFINE_GUID (IID_STUB_Object,
0xa201e4c7, 0xf258, 0x11ce, 0x95, 0x98, 0x0, 0x0, 0xc0, 0x7c, 0xa8, 0x98);
+TAO_Client_Strategy_Factory&
+CORBA_ORB::client_factory(void)
+{
+ if (client_factory_ == 0)
+ {
+ // Look in the service repository for an instance
+ client_factory_ =
+ ACE_Dynamic_Service<TAO_Client_Strategy_Factory>::instance("Client_Strategy_Factory");
+ client_factory_from_service_config_ = CORBA_B_TRUE;
+ }
+
+ if (client_factory_ == 0)
+ {
+ // Still don't have one
+ ACE_NEW(client_factory_, TAO_Default_Client_Strategy_Factory);
+ // this will throw an exception if it fails on exception-throwing platforms
+ client_factory_from_service_config_ = CORBA_B_FALSE;
+ // @@ At this point we need to register this with the
+ // Service_Repository in order to get it cleaned up properly.
+ // But, for now we let it leak.
+ }
+
+ return *client_factory_;
+}
+
+TAO_Server_Strategy_Factory&
+CORBA_ORB::server_factory(void)
+{
+ if (server_factory_ == 0)
+ {
+ // Look in the service repository for an instance
+ server_factory_ =
+ ACE_Dynamic_Service<TAO_Server_Strategy_Factory>::instance("Server_Strategy_Factory");
+ server_factory_from_service_config_ = CORBA_B_TRUE;
+ }
+
+ if (server_factory_ == 0)
+ {
+ // Still don't have one
+ ACE_NEW(server_factory_, TAO_Default_Server_Strategy_Factory);
+ // this will throw an exception if it fails on exception-throwing platforms
+ server_factory_from_service_config_ = CORBA_B_FALSE;
+ // @@ At this point we need to register this with the
+ // Service_Repository in order to get it cleaned up properly.
+ // But, for now we let it leak.
+ }
+
+ return *server_factory_;
+}
+
ULONG __stdcall
CORBA_ORB::Release (void)
{
@@ -64,9 +114,17 @@ CORBA_ORB::Release (void)
// registry. Registry will be used to assign orb names and to
// establish which is the default.
+// Little convenience function use in parsing arguments
+inline static void
+argvec_shift(int& argc, char *argv[], int numslots)
+{
+ ACE_OS::memmove(&argv[0], &argv[numslots], (argc - numslots)*sizeof(argv[0]));
+ argc -= numslots;
+}
+
CORBA_ORB_ptr
-CORBA_ORB_init (int &/* argc */,
- char *const * /* argv */,
+CORBA_ORB_init (int &argc,
+ char *const *argv,
char *orb_name,
CORBA_Environment &env)
{
@@ -97,14 +155,56 @@ CORBA_ORB_init (int &/* argc */,
return 0;
}
- // ignoring argc, argv for now -- no arguments we care about
+ // Parse arguments to the ORB. Typically the ORB is passed
+ // arguments straight from the command line, so we will simply pass
+ // through them and respond to the ones we understand and ignore
+ // those we don't.
//
- // XXX should remove any of the "-ORB*" arguments that we know about
- // ... and report errors for the rest.
+ // In some instances, we may actually build another vector of
+ // arguments and stash it for use initializing other components such
+ // as the ACE_Service_Config or the RootPOA.
//
- // Parsing of these arguments should set values in a
- // TAO_ORB_Parameters instance, likely the one contained in the
- // newly-created ORB.
+ // @@ Should we consume arguments we understand or leave all
+ // arguments in the vector?
+
+ // Prepare a copy of the argument vector
+ char *svc_config_argv[]; // @@ Should this be a data member?
+ // Probably, but there's no object in which to scope it.
+ int svc_config_argc = 0;
+ ACE_NEW (svc_config_argv, char *[argc + 1]);
+
+ // Be certain to copy the program name.
+ // @@ I'm not sure that this convention makes sense. Perhaps we
+ // @@ should use the ORB's name in place of argv[0]?
+ svc_config_argv[svc_config_argc++] = argv[0];
+
+ for (int i = 1; i < argc; )
+ {
+ if (ACE_OS::strcmp (argv[i], "-ORBsvcconf") == 0)
+ {
+ // Specify the name of the svc.conf file to be used
+ svc_config_argv[svc_config_argc++] = "-f";
+
+ if (i + 1 < argc)
+ // @@ Should we dup the string before assigning?
+ svc_config_argv[svc_config_argc++] = argv[i + 1];
+
+ argvec_shift(argc, argv[i], 2);
+ }
+ else if (ACE_OS::strcmp (argv[i], "-OAdaemon") == 0)
+ {
+ // Be a daemon
+ svc_config_argv[svc_config_argc++] = "-b";
+
+ argvec_shift(argc, argv[i], 1);
+ }
+ else if (ACE_OS::strcmp (argv[i], "-d") == 0)
+ {
+ // Turn on debugging
+ svc_config_argv[svc_config_argc++] = "-d";
+ argvec_shift(argc, argv[i], 1);
+ }
+ }
#ifdef DEBUG
// Make it a little easier to debug programs using this code.
@@ -148,7 +248,7 @@ CORBA_ORB_init (int &/* argc */,
// implementation artifact of potential writes to dead connections,
// as it'd be way expensive. Do it here; who cares about SIGPIPE in
// these kinds of applications, anyway?
- (void) ACE_OS::signal (SIGPIPE, SIG_IGN);
+ (void) ACE_OS::signal (SIGPIPE, SIG_IGN);
#endif // SIGPIPE
ACE_OS::socket_init (ACE_WSOCK_VERSION);
@@ -161,6 +261,9 @@ CORBA_ORB_init (int &/* argc */,
if (env.exception () != 0)
return 0;
+ // Initialize the Service Configurator
+ ACE_Service_Config::open(svc_config_argc, svc_config_argv);
+
// Inititalize the "ORB" pseudo-object now.
IIOP_ORB_ptr the_orb = TAO_ORB::instance ();
the_orb->use_omg_ior_format (CORBA_Boolean (use_ior));
@@ -228,10 +331,7 @@ CORBA_BOA_ptr CORBA_ORB::BOA_init (int &argc,
if (i + 1 < argc)
id = CORBA_string_dup (argv[i + 1]);
- for (int j = i ; j + 2 < argc ; j++)
- argv[j] = argv[j + 2];
-
- argc -= 2;
+ argvec_shift(argc, argv[i], 2);
}
else if (ACE_OS::strcmp (argv[i], "-OAhost") == 0)
{
@@ -240,10 +340,7 @@ CORBA_BOA_ptr CORBA_ORB::BOA_init (int &argc,
if (i + 1 < argc)
host = CORBA_string_dup (argv[i + 1]);
- for (int j = i ; j + 2 < argc ; j++)
- argv[j] = argv[j + 2];
-
- argc -= 2;
+ argvec_shift(argc, argv[i], 2);
}
else if (ACE_OS::strcmp (argv[i], "-OAport") == 0)
{
@@ -252,10 +349,7 @@ CORBA_BOA_ptr CORBA_ORB::BOA_init (int &argc,
// @@ We shouldn't limit this to being specified as an int! --cjc
port = ACE_OS::atoi (argv[i + 1]);
- for (int j = i ; j + 2 < argc ; j++)
- argv[j] = argv[j + 2];
-
- argc -= 2;
+ argvec_shift(argc, argv[i], 2);
}
else if (ACE_OS::strcmp (argv[i], "-OAobjdemux") == 0)
{
@@ -264,10 +358,7 @@ CORBA_BOA_ptr CORBA_ORB::BOA_init (int &argc,
if (i + 1 < argc)
demux = CORBA_string_dup (argv[i+1]);
- for (int j = i ; j + 2 < argc ; j++)
- argv[j] = argv[j + 2];
-
- argc -= 2;
+ argvec_shift(argc, argv[i], 2);
}
else if (ACE_OS::strcmp (argv[i], "-OAtablesize") == 0)
{
@@ -275,10 +366,7 @@ CORBA_BOA_ptr CORBA_ORB::BOA_init (int &argc,
if (i + 1 < argc)
tablesize = ACE_OS::atoi (argv[i+1]);
- for (int j = i ; j + 2 < argc ; j++)
- argv[j] = argv[j + 2];
-
- argc -= 2;
+ argvec_shift(argc, argv[i], 2);
}
else if (ACE_OS::strcmp (argv[i], "-OArcvsock") == 0)
{
@@ -292,10 +380,7 @@ CORBA_BOA_ptr CORBA_ORB::BOA_init (int &argc,
{
// Specify whether or not threads should be used.
use_threads = CORBA_B_TRUE;
- for (int j = i ; j + 1 < argc ; j++)
- argv[j] = argv[j + 1];
-
- argc -= 1;
+ argvec_shift(argc, argv[i], 1);
}
else
i++;
diff --git a/TAO/tao/orbobj.h b/TAO/tao/orbobj.h
index dc3ba93a7c6..81951bbb019 100644
--- a/TAO/tao/orbobj.h
+++ b/TAO/tao/orbobj.h
@@ -93,8 +93,10 @@ private:
ACE_SYNCH_MUTEX lock_;
u_int refcount_;
- TAO_Client_Factory client_factory_;
- TAO_Server_Factory server_factory_;
+ TAO_Client_Strategy_Factory *client_factory_;
+ CORBA_Boolean client_factory_from_service_config_;
+ TAO_Server_Strategy_Factory *server_factory_;
+ CORBA_Boolean server_factory_from_service_config_;
TAO_ORB_Parameters params_;
// = NON-PROVIDED METHODS
diff --git a/TAO/tao/orbobj.i b/TAO/tao/orbobj.i
index 19a1508ffbd..ecf273d5b3f 100644
--- a/TAO/tao/orbobj.i
+++ b/TAO/tao/orbobj.i
@@ -3,6 +3,10 @@
// Constructor and destructor are accessible to subclasses
ACE_INLINE
CORBA_ORB::CORBA_ORB (void)
+ : client_factory_(0),
+ client_factory_from_service_config_(CORBA_B_FALSE),
+ server_factory_(0),
+ server_factory_from_service_config_(CORBA_B_FALSE)
{
refcount_ = 1;
}
@@ -10,6 +14,14 @@ CORBA_ORB::CORBA_ORB (void)
ACE_INLINE
CORBA_ORB::~CORBA_ORB (void)
{
+ ACE_Service_Config::close();
+
+ if (! client_factory_from_service_config_)
+ delete client_factory_;
+
+ if (! server_factory_from_service_config_)
+ delete server_factory_;
+
assert (refcount_ == 0);
}
@@ -53,20 +65,6 @@ CORBA_ORB::AddRef (void)
}
ACE_INLINE
-TAO_Client_Factory&
-CORBA_ORB::client_factory(void)
-{
- return client_factory_;
-}
-
-ACE_INLINE
-TAO_Server_Factory&
-CORBA_ORB::server_factory(void)
-{
- return server_factory_;
-}
-
-ACE_INLINE
TAO_ORB_Parameters&
CORBA_ORB::params(void)
{
diff --git a/TAO/tao/params.h b/TAO/tao/params.h
index d499236bf97..b38937052b2 100644
--- a/TAO/tao/params.h
+++ b/TAO/tao/params.h
@@ -37,6 +37,15 @@ public:
// = SERVER-SIDE
};
+typedef enum
+ {
+ TAO_NONE,
+ TAO_LINEAR,
+ TAO_DYNAMIC_HASH,
+ TAO_ACTIVE_DEMUX,
+ TAO_USER_DEFINED
+ } TAO_Demux_Strategy;
+
class ACE_Svc_Export TAO_OA_Parameters
// = TITLE
// Parameters specific to an Object Adapter. By definition, this
@@ -55,14 +64,6 @@ public:
static TAO_OA_Parameters *instance (TAO_OA_Parameters*);
// Set the Singleton instance.
- enum DEMUX_STRATEGY
- {
- TAO_LINEAR,
- TAO_DYNAMIC_HASH,
- TAO_ACTIVE_DEMUX,
- TAO_USER_DEFINED
- };
-
typedef CORBA_BOA::dsi_handler UpcallFunc;
typedef void (*ForwardFunc)(CORBA_OctetSeq &,
CORBA_Object_ptr &, void *,
@@ -129,10 +130,10 @@ public:
// "user_def", or "active_demux". If the value is not valid, then
// <Dynamic Hash> is used as a default.
- void demux_strategy (DEMUX_STRATEGY s);
+ void demux_strategy (TAO_Demux_Strategy s);
// Specify the demultiplexing strategy to be used.
- DEMUX_STRATEGY demux_strategy (void);
+ TAO_Demux_Strategy demux_strategy (void);
// Return the demultiplexing strategy being used.
void userdef_lookup_strategy (TAO_Object_Table *&ot);
@@ -179,7 +180,7 @@ private:
CORBA_BOA_ptr oa_;
// Pointer to One True Object Adapter
- DEMUX_STRATEGY demux_;
+ TAO_Demux_Strategy demux_;
// demux strategy
ACE_INET_Addr addr_;
diff --git a/TAO/tao/params.i b/TAO/tao/params.i
index 2def6c914eb..de0a8bb3fe7 100644
--- a/TAO/tao/params.i
+++ b/TAO/tao/params.i
@@ -94,12 +94,12 @@ TAO_OA_Parameters::addr (void)
}
ACE_INLINE void
-TAO_OA_Parameters::demux_strategy (DEMUX_STRATEGY strategy)
+TAO_OA_Parameters::demux_strategy (TAO_Demux_Strategy strategy)
{
this->demux_ = strategy; // Trust that the value is valid!
}
-ACE_INLINE TAO_OA_Parameters::DEMUX_STRATEGY
+ACE_INLINE TAO_OA_Parameters::TAO_Demux_Strategy
TAO_OA_Parameters::demux_strategy (void)
{
return this->demux_;
diff --git a/TAO/tao/server_factory.cpp b/TAO/tao/server_factory.cpp
new file mode 100644
index 00000000000..7a7e2f94691
--- /dev/null
+++ b/TAO/tao/server_factory.cpp
@@ -0,0 +1,30 @@
+// ============================================================================
+//
+// = LIBRARY
+// TAO
+//
+// = FILENAME
+// server_factory.cpp
+//
+// = AUTHOR
+// Chris Cleeland
+//
+// = VERSION
+// $Id$
+// ============================================================================
+
+#if !defined(__ACE_INLINE__)
+# include "server_factory.i"
+#endif
+
+#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
+template class ACE_Creation_Strategy<TAO_OA_Connection_Handler>;
+template class ACE_Accept_Strategy<TAO_OA_Connection_Handler, ACE_SOCK_ACCEPTOR>;
+template class ACE_Concurrency_Strategy<TAO_OA_Connection_Handler>;
+template class ACE_Scheduling_Strategy<TAO_OA_Connection_Handler>;
+#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
+#pragma instantiate ACE_Creation_Strategy<TAO_OA_Connection_Handler>
+#pragma instantiate ACE_Accept_Strategy<TAO_OA_Connection_Handler, ACE_SOCK_ACCEPTOR>
+#pragma instantiate ACE_Concurrency_Strategy<TAO_OA_Connection_Handler>
+#pragma instantiate ACE_Scheduling_Strategy<TAO_OA_Connection_Handler>
+#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
diff --git a/TAO/tao/server_factory.h b/TAO/tao/server_factory.h
new file mode 100644
index 00000000000..e75fa94a64b
--- /dev/null
+++ b/TAO/tao/server_factory.h
@@ -0,0 +1,80 @@
+// This may look like C, but it's really -*- C++ -*-
+
+// ============================================================================
+//
+// = LIBRARY
+// TAO
+//
+// = FILENAME
+// server_factory.h
+//
+// = AUTHOR
+// Chris Cleeland
+//
+// = VERSION
+// $Id$
+// ============================================================================
+
+#if !defined(TAO_SERVER_FACTORY_H)
+# define TAO_SERVER_FACTORY_H
+
+# include "ace/SOCK_Acceptor.h"
+# include "ace/Svc_Handler.h"
+# include "ace/Strategies_T.h"
+# include "ace/Connector.h"
+# include "ace/Synch.h"
+# include "ace/Service_Object.h"
+
+# include "tao/connect.h"
+# include "tao/objtable.h"
+
+
+class TAO_Server_Strategy_Factory : public ACE_Service_Object
+ // = TITLE
+ //
+ // Base class for the server's abstract factory which turns out
+ // various strategies of special utility to it. This simply
+ // serves as an interface to a subclass that REALLY gets
+ // specified and loaded by the Service Configurator.
+{
+public:
+ // = Initialization and termination methods.
+ TAO_Server_Strategy_Factory (void);
+ // constructor
+
+ virtual ~TAO_Server_Strategy_Factory(void);
+ // destructor
+
+
+ // = SERVER-SIDE factory types.
+ typedef ACE_Creation_Strategy<TAO_OA_Connection_Handler> CREATION_STRATEGY;
+ typedef ACE_Accept_Strategy<TAO_OA_Connection_Handler, ACE_SOCK_ACCEPTOR> ACCEPT_STRATEGY;
+ typedef ACE_Concurrency_Strategy<TAO_OA_Connection_Handler> CONCURRENCY_STRATEGY;
+ typedef ACE_Scheduling_Strategy<TAO_OA_Connection_Handler> SCHEDULING_STRATEGY;
+
+ // = Factory methods for the server-side strategies.
+
+ virtual CREATION_STRATEGY *creation_strategy (void);
+ // Return concrete creation strategy.
+
+ virtual ACCEPT_STRATEGY *accept_strategy (void);
+ // Return concrete acceptor strategy.
+
+ virtual CONCURRENCY_STRATEGY *concurrency_strategy (void);
+ // Return the concurrency strategy used.
+
+ virtual SCHEDULING_STRATEGY *scheduling_strategy (void);
+ // Return the scheduling strategy used.
+
+ virtual TAO_Object_Table *object_lookup_strategy (void);
+ // Return the concrete object lookup strategy.
+
+private:
+};
+
+
+# if defined(__ACE_INLINE__)
+# include "server_factory.i"
+# endif
+
+#endif
diff --git a/TAO/tao/server_factory.i b/TAO/tao/server_factory.i
new file mode 100644
index 00000000000..0543e2c9b96
--- /dev/null
+++ b/TAO/tao/server_factory.i
@@ -0,0 +1,37 @@
+ACE_INLINE
+TAO_Server_Strategy_Factory::TAO_Server_Strategy_Factory (void)
+{}
+
+ACE_INLINE
+TAO_Server_Strategy_Factory::~TAO_Server_Strategy_Factory(void)
+{}
+
+ACE_INLINE CREATION_STRATEGY *
+TAO_Server_Strategy_Factory::creation_strategy (void)
+{
+ return 0;
+}
+
+ACE_INLINE ACCEPT_STRATEGY *
+TAO_Server_Strategy_Factory::accept_strategy (void)
+{
+ return 0;
+}
+
+ACE_INLINE CONCURRENCY_STRATEGY *
+TAO_Server_Strategy_Factory::concurrency_strategy (void)
+{
+ return 0;
+}
+
+ACE_INLINE SCHEDULING_STRATEGY *
+TAO_Server_Strategy_Factory::scheduling_strategy (void)
+{
+ return 0;
+}
+
+ACE_INLINE TAO_Object_Table *
+TAO_Server_Strategy_Factory::object_lookup_strategy (void)
+{
+ return 0;
+}
diff --git a/TAO/tao/svc.conf.eg b/TAO/tao/svc.conf.eg
new file mode 100644
index 00000000000..a9a3ded5b91
--- /dev/null
+++ b/TAO/tao/svc.conf.eg
@@ -0,0 +1,4 @@
+# Reactive, dynamic object table with 64 slots
+dynamic Server_Strategy_Factory TAO_Default_Server_Strategy_Factory "-R -L dynamic -o 64"
+# Thread-per-Connection, hash object table with 128 slots
+dynamic Server_Strategy_Factory TAO_Default_Server_Strategy_Factory "-T -L hash -o 128"