diff options
author | irfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-10-16 18:54:39 +0000 |
---|---|---|
committer | irfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-10-16 18:54:39 +0000 |
commit | 14cff64f3a41ef1cce7c8d07ccdc9528c7e73d1a (patch) | |
tree | cf53768f8e9317e92e66c7be16b62891ccac4815 | |
parent | e51367e839d2bffab3c31a21d2972c56ae32166a (diff) | |
download | ATCD-14cff64f3a41ef1cce7c8d07ccdc9528c7e73d1a.tar.gz |
*** empty log message ***
-rw-r--r-- | TAO/ChangeLog-98c | 26 | ||||
-rw-r--r-- | TAO/docs/Options.html | 25 | ||||
-rw-r--r-- | TAO/tao/Object_Table.cpp | 108 | ||||
-rw-r--r-- | TAO/tao/Object_Table.h | 25 | ||||
-rw-r--r-- | TAO/tao/Object_Table.i | 60 | ||||
-rw-r--r-- | TAO/tao/POA.cpp | 26 | ||||
-rw-r--r-- | TAO/tao/POA.h | 4 | ||||
-rw-r--r-- | TAO/tao/POA.i | 8 | ||||
-rw-r--r-- | TAO/tao/Server_Strategy_Factory.cpp | 3 | ||||
-rw-r--r-- | TAO/tao/Server_Strategy_Factory.h | 6 | ||||
-rw-r--r-- | TAO/tao/default_server.cpp | 56 | ||||
-rw-r--r-- | TAO/tao/default_server.h | 22 | ||||
-rw-r--r-- | TAO/tao/params.h | 5 |
13 files changed, 264 insertions, 110 deletions
diff --git a/TAO/ChangeLog-98c b/TAO/ChangeLog-98c index b3b0d4529d9..c3f2a86f527 100644 --- a/TAO/ChangeLog-98c +++ b/TAO/ChangeLog-98c @@ -1,3 +1,29 @@ +Fri Oct 16 04:16:19 1998 Irfan Pyarali <irfan@cs.wustl.edu> + + * tao/Object_Table and POA: Changed the object table and POA/TAO + options such that the POA now supports linear, active, and + dynamic lookup strategies with the system id policy and supports + linear, and dynamic lookup strategies with the user id policy. + The default lookup strategy for the system id policy is active, + while the default lookup strategy for the user id policy is + dynamic. + + Note that the active lookup strategy is only supported with the + system id policy. This is so because the user cannot decide the + id for the active lookup strategy. It must be generated by the + system. + + Also, added the ability for TAO_Dynamic_Hash_ObjTable and + TAO_Linear_ObjTable to create object ids. This makes them + usable with the system id policy. + + * tao/default_server.cpp (parse_args): Replaced -ORBdemuxstrategy + with -ORBsystemidpolicydemuxstrategy and + -ORBuseridpolicydemuxstrategy. + + * tao/params.h (TAO_Demux_Strategy): Removed TAO_NONE. It was not + being used. + Fri Oct 16 01:52:01 1998 Douglas C. Schmidt <schmidt@cs.wustl.edu> * TAO version 0.2.28 released. diff --git a/TAO/docs/Options.html b/TAO/docs/Options.html index 845a0887bd9..26dc3e635a9 100644 --- a/TAO/docs/Options.html +++ b/TAO/docs/Options.html @@ -121,10 +121,6 @@ or a number. The default is <TT>10013</TT>.</TD></TR> is <CODE>IOR</CODE>, which is the traditional nonsensical object reference, or <CODE>URL</CODE>, which looks more like a URL.</TD></TR> <TR> -<TD><CODE>-ORBobjdemux</CODE> <EM>demux_method</EM></TD> -<TD>Specifies the method used to demultiplex to an object. The range of values -is <CODE>dynamic</CODE>, <CODE>linear</CODE>, <CODE>active</CODE>, or <CODE>user</CODE>.</TD></TR> -<TR> <TD><CODE>-ORBtablesize</CODE> <EM>object table size</EM></TD> <TD>Specifies the size of the object table as a positive, non-zero integer. If not specified, the default is <TT>64</TT>.</TD></TR> @@ -246,12 +242,23 @@ for a purely Reactor-driven concurrency strategy or <TD><CODE>-ORBtablesize</CODE> <EM>object table size</EM></TD> <TD>Specify the size of the object table. If not specified, the default value is 64.</TD></TR> +<TR> + +<TD><CODE>-ORBuseridpolicydemuxstrategy</CODE> <EM>user id policy +based demultiplexing strategy</EM></TD> <TD>Specify the demultiplexing +lookup strategy to be used with the user id policy. The +<EM>demultiplexing strategy</EM> can be one of <CODE>dynamic</CODE>, +<CODE>linear</CODE>, or <CODE>user</CODE>. This option defaults to +use the <CODE>dynamic</CODE> strategy. </TD></TR> <TR> + +<TD><CODE>-ORBsystemidpolicydemuxstrategy</CODE> <EM>system id policy +based demultiplexing strategy</EM></TD> <TD>Specify the demultiplexing +lookup strategy to be used with the system id policy. The +<EM>demultiplexing strategy</EM> can be one of <CODE>dynamic</CODE>, +<CODE>linear</CODE>, <CODE>active</CODE>, or <CODE>user</CODE>. This +option defaults to use the <CODE>active</CODE> strategy. </TD></TR> <TR> -<TD><CODE>-ORBdemuxstrategy</CODE> <EM>demultiplexing strategy</EM></TD> -<TD>Specify the demultiplexing lookup strategy. The <EM>demultiplexing strategy</EM> -can be one of <CODE>dynamic</CODE>, <CODE>linear</CODE>, <CODE>active</CODE>, -or <CODE>user</CODE>.</TD></TR> -<TR> + <TD><CODE>-ORBthreadflags</CODE> <EM>thread flags</EM></TD> <TD>Specify the flags used for thread creation. Flags can be any logical-OR combination of <CODE>THR_DETACHED</CODE>, <CODE>THR_BOUND</CODE>, <CODE>THR_NEW_LWP</CODE>, diff --git a/TAO/tao/Object_Table.cpp b/TAO/tao/Object_Table.cpp index 3ce1cbeb39d..ea2c09719ec 100644 --- a/TAO/tao/Object_Table.cpp +++ b/TAO/tao/Object_Table.cpp @@ -15,12 +15,14 @@ TAO_Object_Table::TAO_Object_Table (TAO_Object_Table_Impl *impl, : impl_ (impl), delete_impl_ (delete_impl) { - if (this->impl_ == 0) - { - this->impl_ = - TAO_ORB_Core_instance ()->server_factory ()->create_object_table (); - this->delete_impl_ = 1; - } + ACE_ASSERT (this->impl_ != 0); +} + +TAO_Object_Table::TAO_Object_Table (int user_id_policy) +{ + this->impl_ = + TAO_ORB_Core_instance ()->server_factory ()->create_object_table (user_id_policy); + this->delete_impl_ = 1; } int @@ -93,51 +95,46 @@ ACE_Hash_Map_Manager<PortableServer::ObjectId, PortableServer::Servant, ACE_SYNC return hash; } -int -TAO_Dynamic_Hash_ObjTable::find (const PortableServer::ObjectId &id, - PortableServer::Servant &servant) +TAO_Dynamic_Hash_ObjTable::TAO_Dynamic_Hash_ObjTable (CORBA::ULong size) + : hash_map_ (size == 0 ? + ACE_static_cast (size_t, TAO_Object_Table_Impl::DEFAULT_TABLE_SIZE) : + size), + counter_ (0) { - return this->hash_map_.find (id, servant); } -int -TAO_Dynamic_Hash_ObjTable::bind (const PortableServer::ObjectId &id, - PortableServer::Servant servant) +PortableServer::ObjectId * +TAO_Dynamic_Hash_ObjTable::create_object_id (PortableServer::Servant servant, + CORBA::Environment &env) { - return this->hash_map_.bind (id, servant); -} + // This method assumes that locks are held when it is called + PortableServer::ObjectId *id; + CORBA::ULong size = sizeof (CORBA::ULong); + ACE_NEW_RETURN (id, + PortableServer::ObjectId (size), + 0); -int -TAO_Dynamic_Hash_ObjTable::unbind (const PortableServer::ObjectId &id, - PortableServer::Servant &servant) -{ - return this->hash_map_.unbind (id, servant); -} + id->length (size); -TAO_Dynamic_Hash_ObjTable::TAO_Dynamic_Hash_ObjTable (CORBA::ULong size) - : hash_map_ (size == 0 ? - ACE_static_cast (size_t, TAO_Object_Table_Impl::DEFAULT_TABLE_SIZE) : - size) -{ + ACE_OS::memcpy (id->get_buffer (), + &this->counter_, + size); + + this->counter_++; + + return id; } TAO_Linear_ObjTable::TAO_Linear_ObjTable (CORBA::ULong size) : next_ (0), tablesize_ (size == 0 ? ACE_static_cast (size_t, TAO_Object_Table_Impl::DEFAULT_TABLE_SIZE) : - size) + size), + counter_ (0) { ACE_NEW (table_, TAO_Object_Table_Entry[this->tablesize_]); } -// Active Demux search strategy -// constructor - -TAO_Active_Demux_ObjTable::TAO_Active_Demux_ObjTable (CORBA::ULong size) - : TAO_Linear_ObjTable (size) -{ -} - int TAO_Linear_ObjTable::bind (const PortableServer::ObjectId &id, PortableServer::Servant servant) @@ -239,6 +236,32 @@ TAO_Linear_ObjTable::resize (void) return 0; } +PortableServer::ObjectId * +TAO_Linear_ObjTable::create_object_id (PortableServer::Servant servant, + CORBA::Environment &env) +{ + PortableServer::ObjectId *id; + CORBA::ULong size = sizeof (CORBA::ULong); + ACE_NEW_RETURN (id, + PortableServer::ObjectId (size), + 0); + + id->length (size); + + ACE_OS::memcpy (id->get_buffer (), + &this->counter_, + size); + + this->counter_++; + + return id; +} + +TAO_Active_Demux_ObjTable::TAO_Active_Demux_ObjTable (CORBA::ULong size) + : TAO_Linear_ObjTable (size) +{ +} + int TAO_Active_Demux_ObjTable::bind (const PortableServer::ObjectId &id, PortableServer::Servant servant) @@ -247,12 +270,12 @@ TAO_Active_Demux_ObjTable::bind (const PortableServer::ObjectId &id, CORBA::ULong generation = 0; int result = this->parse_object_id (id, index, generation); - if (result != 0 - || index > this->tablesize_ - || this->table_[index].generation_ != generation) + if (result != 0 || + index > this->tablesize_ || + this->table_[index].generation_ != generation || + this->table_[index].is_free_ != 0) return -1; - ACE_ASSERT (this->table_[index].is_free_ == 0); this->table_[index].servant_ = servant; return 0; @@ -285,9 +308,10 @@ TAO_Active_Demux_ObjTable::unbind (const PortableServer::ObjectId &id, CORBA::ULong generation = 0; int result = this->parse_object_id (id, index, generation); - if (result != 0 - || index > this->tablesize_ - || this->table_[index].generation_ != generation) + if (result != 0 || + index > this->tablesize_ || + this->table_[index].generation_ != generation || + this->table_[index].is_free_ != 0) return -1; servant = this->table_[index].servant_; diff --git a/TAO/tao/Object_Table.h b/TAO/tao/Object_Table.h index e2df8f205d3..a3b170a3144 100644 --- a/TAO/tao/Object_Table.h +++ b/TAO/tao/Object_Table.h @@ -123,8 +123,11 @@ public: // is associated with <servant>, returns <0> otherwise. virtual PortableServer::ObjectId *create_object_id (PortableServer::Servant servant, - CORBA::Environment &env); + CORBA::Environment &env) = 0; // Create an object id + + virtual CORBA::ULong system_id_size (void) const = 0; + // Size of the system generated id. }; class TAO_Export TAO_Object_Table_Iterator @@ -167,9 +170,12 @@ class TAO_Export TAO_Object_Table // to pointers to CORBA objects. { public: - TAO_Object_Table (TAO_Object_Table_Impl *impl = 0, + TAO_Object_Table (TAO_Object_Table_Impl *impl, int delete_impl = 0); - // Constructor + // Constructor: Must pass valid <impl> + + TAO_Object_Table (int user_id_policy); + // Constructor: System creates table based on <user_id_policy> virtual ~TAO_Object_Table (void); // Destructor. @@ -213,6 +219,9 @@ public: CORBA::Environment &env); // Create an object id + virtual CORBA::ULong system_id_size (void) const; + // Size of the system generated id. + typedef TAO_Object_Table_Iterator iterator; iterator begin (void) const; iterator end (void) const; @@ -271,6 +280,9 @@ public: PortableServer::Servant servant); virtual int unbind (const PortableServer::ObjectId &id, PortableServer::Servant &servant); + virtual PortableServer::ObjectId *create_object_id (PortableServer::Servant servant, + CORBA::Environment &env); + virtual CORBA::ULong system_id_size (void) const; virtual TAO_Object_Table_Iterator_Impl *begin (void) const; virtual TAO_Object_Table_Iterator_Impl *end (void) const; @@ -281,6 +293,8 @@ public: protected: Hash_Map hash_map_; // internal hash table + + CORBA::ULong counter_; }; class TAO_Export TAO_Dynamic_Hash_ObjTable_Iterator : public TAO_Object_Table_Iterator_Impl @@ -363,6 +377,9 @@ public: PortableServer::Servant servant); virtual int unbind (const PortableServer::ObjectId &id, PortableServer::Servant &servant); + virtual PortableServer::ObjectId *create_object_id (PortableServer::Servant servant, + CORBA::Environment &env); + virtual CORBA::ULong system_id_size (void) const; virtual TAO_Object_Table_Iterator_Impl *begin () const; virtual TAO_Object_Table_Iterator_Impl *end () const; @@ -374,6 +391,7 @@ protected: CORBA::ULong tablesize_; TAO_Object_Table_Entry *table_; PortableServer::ObjectId empty_id_; + CORBA::ULong counter_; }; /****************************************************************/ @@ -409,6 +427,7 @@ public: PortableServer::Servant servant); virtual int unbind (const PortableServer::ObjectId &id, PortableServer::Servant &servant); + virtual CORBA::ULong system_id_size (void) const; virtual PortableServer::ObjectId *create_object_id (PortableServer::Servant servant, CORBA::Environment &env); diff --git a/TAO/tao/Object_Table.i b/TAO/tao/Object_Table.i index 9be11655526..ac03b9deafb 100644 --- a/TAO/tao/Object_Table.i +++ b/TAO/tao/Object_Table.i @@ -26,21 +26,6 @@ TAO_Object_Table_Impl::find (const PortableServer::ObjectId &id) return this->find (id, servant); } -ACE_INLINE PortableServer::ObjectId * -TAO_Object_Table_Impl::create_object_id (PortableServer::Servant servant, - CORBA::Environment &env) -{ - // This function is supposed to always fail. Only - // TAO_Active_Demux_ObjTable::create_object_id is supposed to - // succeed. - - ACE_UNUSED_ARG (servant); - - CORBA::Exception *exception = new CORBA::OBJ_ADAPTER (CORBA::COMPLETED_NO); - env.exception (exception); - return 0; -} - ACE_INLINE TAO_Object_Table_Iterator::TAO_Object_Table_Iterator (TAO_Object_Table_Iterator_Impl *impl) : impl_ (impl) @@ -182,6 +167,33 @@ TAO_Object_Table::create_object_id (PortableServer::Servant servant, return this->impl_->create_object_id (servant, env); } +ACE_INLINE CORBA::ULong +TAO_Object_Table::system_id_size (void) const +{ + return this->impl_->system_id_size (); +} + +ACE_INLINE int +TAO_Dynamic_Hash_ObjTable::find (const PortableServer::ObjectId &id, + PortableServer::Servant &servant) +{ + return this->hash_map_.find (id, servant); +} + +ACE_INLINE int +TAO_Dynamic_Hash_ObjTable::bind (const PortableServer::ObjectId &id, + PortableServer::Servant servant) +{ + return this->hash_map_.bind (id, servant); +} + +ACE_INLINE int +TAO_Dynamic_Hash_ObjTable::unbind (const PortableServer::ObjectId &id, + PortableServer::Servant &servant) +{ + return this->hash_map_.unbind (id, servant); +} + ACE_INLINE int TAO_Dynamic_Hash_ObjTable::find (const PortableServer::Servant servant) { @@ -201,6 +213,12 @@ TAO_Dynamic_Hash_ObjTable::find (const PortableServer::Servant servant, return this->TAO_Object_Table_Impl::find (servant, id); } +ACE_INLINE CORBA::ULong +TAO_Dynamic_Hash_ObjTable::system_id_size (void) const +{ + return sizeof (CORBA::ULong); +} + ACE_INLINE TAO_Dynamic_Hash_ObjTable_Iterator::TAO_Dynamic_Hash_ObjTable_Iterator (const Impl &impl) : impl_ (impl) @@ -310,6 +328,12 @@ TAO_Linear_ObjTable::find (const PortableServer::Servant servant, return this->TAO_Object_Table_Impl::find (servant, id); } +ACE_INLINE CORBA::ULong +TAO_Linear_ObjTable::system_id_size (void) const +{ + return sizeof (CORBA::ULong); +} + ACE_INLINE TAO_Object_Table_Iterator_Impl * TAO_Linear_ObjTable::begin (void) const { @@ -363,6 +387,12 @@ TAO_Active_Demux_ObjTable::parse_object_id (const PortableServer::ObjectId &id, return 0; } +ACE_INLINE CORBA::ULong +TAO_Active_Demux_ObjTable::system_id_size (void) const +{ + return 2 * sizeof (CORBA::ULong); +} + ACE_INLINE TAO_Dynamic_Hash_ObjTable::~TAO_Dynamic_Hash_ObjTable (void) { diff --git a/TAO/tao/POA.cpp b/TAO/tao/POA.cpp index 5de64c5517e..7dc4f5f5566 100644 --- a/TAO/tao/POA.cpp +++ b/TAO/tao/POA.cpp @@ -887,19 +887,10 @@ TAO_POA::TAO_POA (const TAO_POA::String &adapter_name, void TAO_POA::create_active_object_map (void) { - if (this->system_id ()) - { - // find the correct size - u_long size = TAO_ORB_Core_instance ()->server_factory ()->object_table_size (); - // Create the correct table - this->active_object_map_ = - new TAO_Object_Table (new TAO_Active_Demux_ObjTable (size), 1); - } - else - { - // Create the default table - this->active_object_map_ = new TAO_Object_Table; - } + int user_id_policy = !this->system_id (); + + // Create the active_object_map + this->active_object_map_ = new TAO_Object_Table (user_id_policy); } void @@ -1179,7 +1170,6 @@ TAO_POA::find_POA_i_optimized (const TAO_POA::String &adapter_name, else { // Find the topmost name - // Find the topmost name TAO_POA::String topmost_poa_name; TAO_POA::String tail_poa_name; this->parse_poa_name (adapter_name, @@ -2027,7 +2017,7 @@ int TAO_POA::locate_servant (const TAO_ObjectKey &key, CORBA::Environment &env) { - // Lock access to the POAManager for the duration of this transaction + // Lock access to the POA for the duration of this transaction TAO_POA_READ_GUARD_RETURN (ACE_Lock, monitor, this->lock (), -1, env); PortableServer::Servant servant = 0; @@ -2052,7 +2042,7 @@ PortableServer::Servant TAO_POA::find_servant (const TAO_ObjectKey &key, CORBA::Environment &env) { - // Lock access to the POAManager for the duration of this transaction + // Lock access to the POA for the duration of this transaction TAO_POA_READ_GUARD_RETURN (ACE_Lock, monitor, this->lock (), 0, env); PortableServer::Servant servant = 0; @@ -2318,7 +2308,7 @@ TAO_POA::dispatch_servant (const TAO_ObjectKey &key, { ACE_FUNCTION_TIMEPROBE (TAO_POA_DISPATCH_SERVANT_START); - // Lock access to the POAManager for the duration of this transaction + // Lock access to the POA for the duration of this transaction TAO_POA_READ_GUARD (ACE_Lock, monitor, this->lock (), env); this->dispatch_servant_i (key, req, context, orb_core, env); @@ -2445,7 +2435,7 @@ TAO_POA::parse_key (const TAO_ObjectKey &key, if (system_id) // The minus one is because we want <last_token_position> to point // to the separator - last_token_position = key.length () - (2 * sizeof (CORBA::ULong)) - 1; + last_token_position = key.length () - this->system_id_size () - 1; else last_token_position = this->rfind (key, TAO_POA::name_separator ()); diff --git a/TAO/tao/POA.h b/TAO/tao/POA.h index e9be1717a16..a95c44082fb 100644 --- a/TAO/tao/POA.h +++ b/TAO/tao/POA.h @@ -615,7 +615,7 @@ protected: virtual TAO_POA_Policies &policies (void); - virtual TAO_Object_Table &active_object_map (void); + virtual TAO_Object_Table &active_object_map (void) const; virtual void delete_child (const String &child, CORBA_Environment &_env = CORBA_Environment::default_environment ()); @@ -640,6 +640,8 @@ protected: virtual TAO_ObjectKey *create_object_key (const PortableServer::ObjectId &id); + virtual CORBA::ULong system_id_size (void) const; + virtual int is_poa_generated_id (const PortableServer::ObjectId &id); virtual int is_poa_generated_key (const TAO_ObjectKey &key); diff --git a/TAO/tao/POA.i b/TAO/tao/POA.i index 3c867992a23..b47dd66ac8c 100644 --- a/TAO/tao/POA.i +++ b/TAO/tao/POA.i @@ -341,7 +341,7 @@ TAO_POA::policies (void) } ACE_INLINE TAO_Object_Table & -TAO_POA::active_object_map (void) +TAO_POA::active_object_map (void) const { return *this->active_object_map_; } @@ -644,6 +644,12 @@ TAO_POA::create_object_id (PortableServer::Servant servant, return this->active_object_map ().create_object_id (servant, env); } +ACE_INLINE CORBA::ULong +TAO_POA::system_id_size (void) const +{ + return this->active_object_map ().system_id_size (); +} + ACE_INLINE ACE_Lock & TAO_POA_Manager::lock (void) { diff --git a/TAO/tao/Server_Strategy_Factory.cpp b/TAO/tao/Server_Strategy_Factory.cpp index a50a55998da..3cadbe38c66 100644 --- a/TAO/tao/Server_Strategy_Factory.cpp +++ b/TAO/tao/Server_Strategy_Factory.cpp @@ -43,8 +43,9 @@ TAO_Server_Strategy_Factory::scheduling_strategy (void) } TAO_Object_Table_Impl * -TAO_Server_Strategy_Factory::create_object_table (void) +TAO_Server_Strategy_Factory::create_object_table (int user_id_policy) { + ACE_UNUSED_ARG (user_id_policy); return 0; } diff --git a/TAO/tao/Server_Strategy_Factory.h b/TAO/tao/Server_Strategy_Factory.h index af17b316503..d869895e66d 100644 --- a/TAO/tao/Server_Strategy_Factory.h +++ b/TAO/tao/Server_Strategy_Factory.h @@ -62,8 +62,10 @@ public: virtual SCHEDULING_STRATEGY *scheduling_strategy (void); // Return the scheduling strategy used. - virtual TAO_Object_Table_Impl *create_object_table (void); - // Return a new key-->object table + virtual TAO_Object_Table_Impl *create_object_table (int user_id_policy); + // Return a new id-->object table. If <user_id_policy> is true, the + // request is being made for a POA with USER ID policy. Otherwise, + // the SYSTEM_ID policy is being used. virtual ACE_Lock *create_poa_lock (void); // Return a new lock for use in locking the POA. diff --git a/TAO/tao/default_server.cpp b/TAO/tao/default_server.cpp index 6dddb5a4578..a0c3a9c21ec 100644 --- a/TAO/tao/default_server.cpp +++ b/TAO/tao/default_server.cpp @@ -12,7 +12,8 @@ ACE_RCSID(tao, default_server, "$Id$") TAO_Default_Server_Strategy_Factory::TAO_Default_Server_Strategy_Factory (void) : thread_flags_ (0), object_table_size_ (TAO_DEFAULT_SERVER_OBJECT_TABLE_SIZE), - object_lookup_strategy_ (TAO_DYNAMIC_HASH), + object_lookup_strategy_for_user_id_policy_ (TAO_DYNAMIC_HASH), + object_lookup_strategy_for_system_id_policy_ (TAO_ACTIVE_DEMUX), poa_lock_type_ (TAO_THREAD_LOCK), poa_mgr_lock_type_ (TAO_THREAD_LOCK), event_loop_lock_type_ (TAO_NULL_LOCK), @@ -168,13 +169,34 @@ TAO_Default_Server_Strategy_Factory::create_cached_connector_lock (void) } TAO_Object_Table_Impl * -TAO_Default_Server_Strategy_Factory::create_object_table (void) +TAO_Default_Server_Strategy_Factory::create_object_table (int user_id_policy) +{ + if (user_id_policy) + return this->create_user_id_policy_object_table (); + else + return this->create_system_id_policy_object_table (); +} + +TAO_Object_Table_Impl * +TAO_Default_Server_Strategy_Factory::create_user_id_policy_object_table (void) +{ + return this->create_object_table_i (this->object_lookup_strategy_for_user_id_policy_); +} + +TAO_Object_Table_Impl * +TAO_Default_Server_Strategy_Factory::create_system_id_policy_object_table (void) +{ + return this->create_object_table_i (this->object_lookup_strategy_for_system_id_policy_); +} + +TAO_Object_Table_Impl * +TAO_Default_Server_Strategy_Factory::create_object_table_i (TAO_Demux_Strategy table_type) { // Create the appropriate-sized object table based on passed // arguments. TAO_Object_Table_Impl *objtable = 0; - switch (this->object_lookup_strategy_) + switch (table_type) { case TAO_LINEAR: ACE_NEW_RETURN (objtable, @@ -202,8 +224,6 @@ TAO_Default_Server_Strategy_Factory::create_object_table (void) 0); break; case TAO_DYNAMIC_HASH: - case TAO_NONE: - default: ACE_NEW_RETURN (objtable, TAO_Dynamic_Hash_ObjTable (this->object_table_size_), 0); @@ -285,7 +305,23 @@ TAO_Default_Server_Strategy_Factory::parse_args (int argc, char *argv[]) if (curarg < argc) this->object_table_size_ = ACE_OS::strtoul (argv[curarg], 0, 10); } - else if (ACE_OS::strcmp (argv[curarg], "-ORBdemuxstrategy") == 0) + else if (ACE_OS::strcmp (argv[curarg], "-ORBuseridpolicydemuxstrategy") == 0) + { + curarg++; + if (curarg < argc) + { + char *name = argv[curarg]; + + // Active demux not supported with user id policy + if (ACE_OS::strcasecmp (name, "dynamic") == 0) + this->object_lookup_strategy_for_user_id_policy_ = TAO_DYNAMIC_HASH; + else if (ACE_OS::strcasecmp (name, "linear") == 0) + this->object_lookup_strategy_for_user_id_policy_ = TAO_LINEAR; + else if (ACE_OS::strcasecmp (name, "user") == 0) + this->object_lookup_strategy_for_user_id_policy_ = TAO_USER_DEFINED; + } + } + else if (ACE_OS::strcmp (argv[curarg], "-ORBsystemidpolicydemuxstrategy") == 0) { curarg++; if (curarg < argc) @@ -293,13 +329,13 @@ TAO_Default_Server_Strategy_Factory::parse_args (int argc, char *argv[]) char *name = argv[curarg]; if (ACE_OS::strcasecmp (name, "dynamic") == 0) - this->object_lookup_strategy_ = TAO_DYNAMIC_HASH; + this->object_lookup_strategy_for_system_id_policy_ = TAO_DYNAMIC_HASH; else if (ACE_OS::strcasecmp (name, "linear") == 0) - this->object_lookup_strategy_ = TAO_LINEAR; + this->object_lookup_strategy_for_system_id_policy_ = TAO_LINEAR; else if (ACE_OS::strcasecmp (name, "active") == 0) - this->object_lookup_strategy_ = TAO_ACTIVE_DEMUX; + this->object_lookup_strategy_for_system_id_policy_ = TAO_ACTIVE_DEMUX; else if (ACE_OS::strcasecmp (name, "user") == 0) - this->object_lookup_strategy_ = TAO_USER_DEFINED; + this->object_lookup_strategy_for_system_id_policy_ = TAO_USER_DEFINED; } } else if (ACE_OS::strcmp (argv[curarg], "-ORBpoalock") == 0) diff --git a/TAO/tao/default_server.h b/TAO/tao/default_server.h index f528c7fb1f3..43107322258 100644 --- a/TAO/tao/default_server.h +++ b/TAO/tao/default_server.h @@ -50,8 +50,10 @@ public: virtual CONCURRENCY_STRATEGY *concurrency_strategy (void); - virtual TAO_Object_Table_Impl *create_object_table (void); - // Factory method for object tables. + virtual TAO_Object_Table_Impl *create_object_table (int user_id_policy); + // Return a new id-->object table. If <user_id_policy> is true, the + // request is being made for a POA with USER ID policy. Otherwise, + // the SYSTEM_ID policy is being used. virtual ACE_Lock *create_poa_lock (void); // Creates and returns a lock for POA based on the setting for @@ -114,17 +116,27 @@ public: // <-ORBeventlock> <{which}> // where <{which}> is one of <thread> or <null> (default <null>) -private: +protected: void tokenize (char *flag_string); + // = Helpers for <create_object_table> + TAO_Object_Table_Impl *create_user_id_policy_object_table (void); + TAO_Object_Table_Impl *create_system_id_policy_object_table (void); + TAO_Object_Table_Impl *create_object_table_i (TAO_Demux_Strategy table_type); + u_long thread_flags_; // Default thread flags passed to thr_create(). u_long object_table_size_; // Default size of object lookup table. - TAO_Demux_Strategy object_lookup_strategy_; - // The type of lookup/demultiplexing strategy being used + TAO_Demux_Strategy object_lookup_strategy_for_user_id_policy_; + // The type of lookup/demultiplexing strategy being used for user id + // policy + + TAO_Demux_Strategy object_lookup_strategy_for_system_id_policy_; + // The type of lookup/demultiplexing strategy being used for system + // id policy enum Lock_Type { diff --git a/TAO/tao/params.h b/TAO/tao/params.h index 7b8934b78f5..910aa6521b1 100644 --- a/TAO/tao/params.h +++ b/TAO/tao/params.h @@ -164,14 +164,13 @@ private: // For selecting a address notation }; -typedef enum +enum TAO_Demux_Strategy { - TAO_NONE, TAO_LINEAR, TAO_DYNAMIC_HASH, TAO_ACTIVE_DEMUX, TAO_USER_DEFINED -} TAO_Demux_Strategy; +}; class TAO_Export TAO_OA_Parameters // = TITLE |