TAO_Advanced_Resource_Factory Class Reference

TAO's default resource factory. More...

#include <advanced_resource.h>

Inheritance diagram for TAO_Advanced_Resource_Factory:

Inheritance graph
[legend]
Collaboration diagram for TAO_Advanced_Resource_Factory:

Collaboration graph
[legend]
List of all members.

Public Types

enum  Allocator_Lock_Type { TAO_ALLOCATOR_NULL_LOCK, TAO_ALLOCATOR_THREAD_LOCK }
 Type of lock used for the allocators. More...

enum  {
  TAO_REACTOR_SELECT_MT = 1, TAO_REACTOR_SELECT_ST = 2, TAO_REACTOR_WFMO = 3, TAO_REACTOR_MSGWFMO = 4,
  TAO_REACTOR_TP = 5
}
 Type of Reactor. More...

enum  { TAO_THREAD_QUEUE_NOT_SET, TAO_THREAD_QUEUE_FIFO, TAO_THREAD_QUEUE_LIFO }
 Thread queueing Strategy. More...


Public Member Functions

 TAO_Advanced_Resource_Factory (void)
 Constructor.

virtual ~TAO_Advanced_Resource_Factory (void)
 Destructor.

virtual int init (int argc, ACE_TCHAR *argv[])
 Dynamic linking hook.

virtual TAO_Connection_Purging_Strategycreate_purging_strategy (void)
virtual TAO_LF_Strategycreate_lf_strategy (void)
Resource Retrieval
virtual int init_protocol_factories (void)
virtual ACE_Allocatorinput_cdr_dblock_allocator (void)
virtual ACE_Allocatorinput_cdr_buffer_allocator (void)
virtual ACE_Allocatorinput_cdr_msgblock_allocator (void)
virtual ACE_Allocatoramh_response_handler_allocator (void)
virtual ACE_Allocatorami_response_handler_allocator (void)
virtual int input_cdr_allocator_type_locked (void)
virtual TAO_ProtocolFactorySetget_protocol_factories (void)

Protected Member Functions

virtual ACE_Reactor_Implallocate_reactor_impl (void) const
 Obtain the reactor implementation.

void report_option_value_error (const ACE_TCHAR *option_name, const ACE_TCHAR *option_value)
void report_unsupported_error (const ACE_TCHAR *option_name)
virtual int load_default_protocols (void)

Protected Attributes

TAO_ProtocolFactorySet protocol_factories_
 List of loaded protocol factories.

int reactor_registry_type_
 The type of reactor registry.

int reactor_type_
 Flag indicating which kind of reactor we should use.

int threadqueue_type_
Allocator_Lock_Type cdr_allocator_type_
 The type of CDR allocators.

Allocator_Lock_Type amh_response_handler_allocator_lock_type_
 Type of lock used by AMH response handler allocator.

Allocator_Lock_Type ami_response_handler_allocator_lock_type_
 Type of lock used by AMI response handler allocator.


Detailed Description

TAO's default resource factory.

Using a <{resource source specifier}> as a discriminator, the factory can return resource instances which are, e.g., global, stored in thread-specific storage, stored in shared memory, etc.

Definition at line 37 of file advanced_resource.h.


Member Enumeration Documentation

anonymous enum
 

Type of Reactor.

Enumeration values:
TAO_REACTOR_SELECT_MT  Use ACE_Token.
TAO_REACTOR_SELECT_ST  Use ACE_Noop_Token.
TAO_REACTOR_WFMO 
TAO_REACTOR_MSGWFMO 
TAO_REACTOR_TP 

Definition at line 59 of file advanced_resource.h.

00060   {
00061     /// Use ACE_Token
00062     TAO_REACTOR_SELECT_MT = 1,
00063 
00064     /// Use ACE_Noop_Token
00065     TAO_REACTOR_SELECT_ST = 2,
00066     TAO_REACTOR_WFMO      = 3,
00067     TAO_REACTOR_MSGWFMO   = 4,
00068     TAO_REACTOR_TP        = 5
00069   };

anonymous enum
 

Thread queueing Strategy.

Enumeration values:
TAO_THREAD_QUEUE_NOT_SET  Not set, use LIFO.
TAO_THREAD_QUEUE_FIFO  FIFO, first-in-first-out.
TAO_THREAD_QUEUE_LIFO  LIFO, last-in-first-out (default).

Definition at line 72 of file advanced_resource.h.

00073   {
00074     /// Not set, use LIFO.
00075     TAO_THREAD_QUEUE_NOT_SET,
00076 
00077     /// FIFO, first-in-first-out.
00078     TAO_THREAD_QUEUE_FIFO,
00079 
00080     /// LIFO, last-in-first-out (default).
00081     TAO_THREAD_QUEUE_LIFO
00082   };

enum TAO_Advanced_Resource_Factory::Allocator_Lock_Type
 

Type of lock used for the allocators.

Enumeration values:
TAO_ALLOCATOR_NULL_LOCK 
TAO_ALLOCATOR_THREAD_LOCK 

Definition at line 52 of file advanced_resource.h.

00053   {
00054     TAO_ALLOCATOR_NULL_LOCK,
00055     TAO_ALLOCATOR_THREAD_LOCK
00056   };


Constructor & Destructor Documentation

TAO_Advanced_Resource_Factory::TAO_Advanced_Resource_Factory void   ) 
 

Constructor.

Definition at line 66 of file advanced_resource.cpp.

00067   : reactor_type_ (TAO_REACTOR_TP),
00068     threadqueue_type_ (TAO_THREAD_QUEUE_NOT_SET),
00069     cdr_allocator_type_ (TAO_ALLOCATOR_THREAD_LOCK),
00070     amh_response_handler_allocator_lock_type_ (TAO_ALLOCATOR_THREAD_LOCK),
00071     ami_response_handler_allocator_lock_type_ (TAO_ALLOCATOR_THREAD_LOCK)
00072 {
00073   // Constructor
00074 }

TAO_Advanced_Resource_Factory::~TAO_Advanced_Resource_Factory void   )  [virtual]
 

Destructor.

Definition at line 76 of file advanced_resource.cpp.

References TAO_ProtocolFactorySetItor.

00077 {
00078   // Destructor
00079   TAO_ProtocolFactorySetItor end = this->protocol_factories_.end ();
00080 
00081   for (TAO_ProtocolFactorySetItor iterator =
00082          this->protocol_factories_.begin ();
00083        iterator != end;
00084        ++iterator)
00085     delete *iterator;
00086 
00087   this->protocol_factories_.reset ();
00088 }


Member Function Documentation

ACE_Reactor_Impl * TAO_Advanced_Resource_Factory::allocate_reactor_impl void   )  const [protected, virtual]
 

Obtain the reactor implementation.

Reimplemented from TAO_Default_Resource_Factory.

Definition at line 632 of file advanced_resource.cpp.

References ACE_NEW_RETURN, ACE_Sig_Handler, ACE_Timer_Queue, reactor_type_, TAO_NULL_LOCK_REACTOR, TAO_REACTOR, and TAO_THREAD_QUEUE_FIFO.

00633 {
00634   ACE_Reactor_Impl *impl = 0;
00635 
00636   /*
00637    * Hook for specializing the Reactor implementation in TAO.
00638    */
00639 //@@ TAO_ADVANCED_RESOURCE_REACTOR_SPL_COMMENT_HOOK_START
00640   switch (this->reactor_type_)
00641     {
00642     case TAO_REACTOR_SELECT_MT:
00643       ACE_NEW_RETURN (impl,
00644                       TAO_REACTOR ((ACE_Sig_Handler*)0,
00645                                    (ACE_Timer_Queue*)0,
00646                                    0,
00647                                    (ACE_Reactor_Notify*)0,
00648                                    this->reactor_mask_signals_),
00649                       0);
00650       break;
00651 
00652     case TAO_REACTOR_SELECT_ST:
00653       ACE_NEW_RETURN (impl,
00654                       TAO_NULL_LOCK_REACTOR ((ACE_Sig_Handler*)0,
00655                                              (ACE_Timer_Queue*)0,
00656                                              0,
00657                                              (ACE_Reactor_Notify*)0,
00658                                              this->reactor_mask_signals_),
00659                       0);
00660       break;
00661 
00662     case TAO_REACTOR_WFMO:
00663 #if defined(ACE_WIN32) && !defined (ACE_LACKS_MSG_WFMO)
00664       ACE_NEW_RETURN (impl, ACE_WFMO_Reactor, 0);
00665 #endif /* ACE_WIN32 && !ACE_LACKS_MSG_WFMO */
00666       break;
00667 
00668     case TAO_REACTOR_MSGWFMO:
00669 #if defined(ACE_WIN32) && !defined (ACE_HAS_WINCE) && !defined (ACE_HAS_PHARLAP)
00670       ACE_NEW_RETURN (impl, ACE_Msg_WFMO_Reactor, 0);
00671 #endif /* ACE_WIN32 && !ACE_HAS_WINCE */
00672       break;
00673 
00674     default:
00675     case TAO_REACTOR_TP:
00676       ACE_NEW_RETURN (impl, ACE_TP_Reactor ((ACE_Sig_Handler*)0,
00677                                             (ACE_Timer_Queue*)0,
00678                                             this->reactor_mask_signals_,
00679                                             this->threadqueue_type_ == TAO_THREAD_QUEUE_FIFO ?
00680                                               ACE_Select_Reactor_Token::FIFO :
00681                                               ACE_Select_Reactor_Token::LIFO),
00682                       0);
00683       break;
00684     }
00685 
00686 //@@ TAO_ADVANCED_RESOURCE_REACTOR_SPL_COMMENT_HOOK_END
00687 
00688   return impl;
00689 }

ACE_Allocator * TAO_Advanced_Resource_Factory::amh_response_handler_allocator void   )  [virtual]
 

Reimplemented from TAO_Default_Resource_Factory.

Definition at line 751 of file advanced_resource.cpp.

References ACE_NEW_RETURN, TAO_Default_Resource_Factory::amh_response_handler_allocator(), amh_response_handler_allocator_lock_type_, NULL_LOCK_ALLOCATOR, and TAO_ALLOCATOR_NULL_LOCK.

00752 {
00753   ACE_Allocator *allocator = 0;
00754   switch (this->amh_response_handler_allocator_lock_type_)
00755     {
00756     case TAO_ALLOCATOR_NULL_LOCK:
00757       ACE_NEW_RETURN (allocator,
00758                       NULL_LOCK_ALLOCATOR,
00759                       0);
00760       break;
00761     default:
00762       return
00763         this->TAO_Default_Resource_Factory::amh_response_handler_allocator();
00764     }
00765 
00766   return allocator;
00767 }

ACE_Allocator * TAO_Advanced_Resource_Factory::ami_response_handler_allocator void   )  [virtual]
 

Reimplemented from TAO_Default_Resource_Factory.

Definition at line 770 of file advanced_resource.cpp.

References ACE_NEW_RETURN, TAO_Default_Resource_Factory::ami_response_handler_allocator(), ami_response_handler_allocator_lock_type_, NULL_LOCK_ALLOCATOR, and TAO_ALLOCATOR_NULL_LOCK.

00771 {
00772   ACE_Allocator *allocator = 0;
00773   switch (this->ami_response_handler_allocator_lock_type_)
00774     {
00775     case TAO_ALLOCATOR_NULL_LOCK:
00776       ACE_NEW_RETURN (allocator,
00777                       NULL_LOCK_ALLOCATOR,
00778                       0);
00779       break;
00780     default:
00781       return
00782         this->TAO_Default_Resource_Factory::ami_response_handler_allocator();
00783     }
00784 
00785   return allocator;
00786 }

TAO_LF_Strategy * TAO_Advanced_Resource_Factory::create_lf_strategy void   )  [virtual]
 

Reimplemented from TAO_Default_Resource_Factory.

Definition at line 836 of file advanced_resource.cpp.

References ACE_NEW_RETURN, and reactor_type_.

00837 {
00838   TAO_LF_Strategy *strategy = 0;
00839 
00840   if (this->reactor_type_ == TAO_REACTOR_SELECT_ST)
00841     {
00842       ACE_NEW_RETURN (strategy,
00843                       TAO_LF_Strategy_Null,
00844                       0);
00845     }
00846   else
00847     {
00848       ACE_NEW_RETURN (strategy,
00849                       TAO_LF_Strategy_Complete,
00850                       0);
00851     }
00852   return strategy;
00853 }

TAO_Connection_Purging_Strategy * TAO_Advanced_Resource_Factory::create_purging_strategy void   )  [virtual]
 

Reimplemented from TAO_Default_Resource_Factory.

Definition at line 795 of file advanced_resource.cpp.

References ACE_ERROR, ACE_NEW_RETURN, ACE_TEXT, and LM_ERROR.

00796 {
00797   TAO_Connection_Purging_Strategy *strategy = 0;
00798 
00799   switch(this->connection_purging_type_)
00800     {
00801     case TAO_Resource_Factory::LFU:
00802       ACE_NEW_RETURN (strategy,
00803                       TAO_LFU_Connection_Purging_Strategy (
00804                                                this->cache_maximum ()),
00805                       0);
00806       break;
00807     case TAO_Resource_Factory::FIFO:
00808       ACE_NEW_RETURN (strategy,
00809                       TAO_FIFO_Connection_Purging_Strategy (
00810                                                this->cache_maximum ()),
00811                       0);
00812       break;
00813     case TAO_Resource_Factory::NOOP:
00814       ACE_NEW_RETURN (strategy,
00815                       TAO_NULL_Connection_Purging_Strategy (
00816                                                this->cache_maximum ()),
00817                       0);
00818       break;
00819     case TAO_Resource_Factory::LRU:
00820       ACE_NEW_RETURN (strategy,
00821                       TAO_LRU_Connection_Purging_Strategy (
00822                                                this->cache_maximum ()),
00823                       0);
00824       break;
00825     default:
00826       ACE_ERROR ((LM_ERROR,
00827                   ACE_TEXT("TAO (%P|%t) - ")
00828                   ACE_TEXT("Unknown connection purging strategy ")
00829                   ACE_TEXT("type was found.\n")));
00830     }
00831 
00832   return strategy;
00833 }

TAO_ProtocolFactorySet * TAO_Advanced_Resource_Factory::get_protocol_factories void   )  [virtual]
 

Reimplemented from TAO_Default_Resource_Factory.

Definition at line 626 of file advanced_resource.cpp.

00627 {
00628   return &protocol_factories_;
00629 }

virtual int TAO_Advanced_Resource_Factory::init int  argc,
ACE_TCHAR argv[]
[virtual]
 

Dynamic linking hook.

Reimplemented from TAO_Default_Resource_Factory.

int TAO_Advanced_Resource_Factory::init_protocol_factories void   )  [virtual]
 

Reimplemented from TAO_Default_Resource_Factory.

Definition at line 307 of file advanced_resource.cpp.

References ACE_AUTO_PTR_RESET, ACE_CString, ACE_DEBUG, ACE_ERROR, ACE_ERROR_RETURN, ACE_NEW_RETURN, ACE_TEXT, ACE_TEXT_CHAR_TO_TCHAR, TAO_Resource_Factory::disable_factory(), TAO_Protocol_Item::factory(), ACE_Dynamic_Service< TYPE >::instance(), LM_DEBUG, LM_ERROR, LM_WARNING, load_default_protocols(), TAO_Protocol_Item::protocol_name(), ACE_Auto_Basic_Ptr< X >::release(), TAO_debug_level, and TAO_ProtocolFactorySetItor.

00308 {
00309 
00310   // If the default resource factory exists, then disable it.
00311   // This causes any directives for the "Resource_Factory" to
00312   // report warnings.
00313   // This is needed to ensure warnings when no static directive
00314   // for this factory is used (and init() is not called).
00315   TAO_Resource_Factory *default_resource_factory =
00316     ACE_Dynamic_Service<TAO_Resource_Factory>::instance ("Resource_Factory");
00317   if (default_resource_factory != 0)
00318     {
00319       default_resource_factory->disable_factory();
00320     }
00321 
00322   TAO_ProtocolFactorySetItor end = protocol_factories_.end ();
00323   TAO_ProtocolFactorySetItor factory = protocol_factories_.begin ();
00324 
00325   if (factory == end)
00326     {
00327       TAO_Protocol_Factory *protocol_factory = 0;
00328       auto_ptr<TAO_Protocol_Factory> safe_protocol_factory;
00329 
00330       TAO_Protocol_Item *item = 0;
00331 
00332       // If a protocol factory is obtained from the Service
00333       // Configurator then do not transfer ownership to the
00334       // TAO_Protocol_Item.
00335       int transfer_ownership = 0;
00336 
00337       int r = this->load_default_protocols ();
00338 
00339       if (r == -1)
00340         return -1;
00341 
00342 #if TAO_HAS_UIOP == 1
00343       protocol_factory =
00344         ACE_Dynamic_Service<TAO_Protocol_Factory>::instance ("UIOP_Factory");
00345 
00346       if (protocol_factory == 0)
00347         {
00348           if (TAO_debug_level > 0)
00349             ACE_ERROR ((LM_WARNING,
00350                         ACE_TEXT("(%P|%t) WARNING - No %s found in Service Repository.")
00351                         ACE_TEXT("  Using default instance.\n"),
00352                         ACE_TEXT("UIOP Protocol Factory")));
00353 
00354           ACE_NEW_RETURN (protocol_factory,
00355                           TAO_UIOP_Protocol_Factory,
00356                           -1);
00357 
00358           ACE_AUTO_PTR_RESET (safe_protocol_factory,
00359                               protocol_factory,
00360                               TAO_Protocol_Factory);
00361 
00362           transfer_ownership = 1;
00363         }
00364       else
00365         {
00366           transfer_ownership = 0;
00367         }
00368 
00369       ACE_NEW_RETURN (item, TAO_Protocol_Item ("UIOP_Factory"), -1);
00370       // If the TAO_Protocol_Item retains ownership of the
00371       // TAO_Protocol_Factory then we used an auto_ptr<> above, so
00372       // release the TAO_Protocol_Factory from it.  Otherwise, we
00373       // obtained the TAO_Protocol_Factory from the Service
00374       // Configurator so an auto_ptr<> wasn't used since the Service
00375       // Configurator retains ownership, hence there was no need to
00376       // use an auto_ptr<> in this method.
00377       item->factory ((transfer_ownership ?
00378                       safe_protocol_factory.release () :
00379                       protocol_factory),
00380                      transfer_ownership);
00381 
00382       if (this->protocol_factories_.insert (item) == -1)
00383         {
00384           ACE_ERROR ((LM_ERROR,
00385                       ACE_TEXT("TAO (%P|%t) Unable to add ")
00386                       ACE_TEXT("<%s> to protocol factory set.\n"),
00387                       ACE_TEXT_CHAR_TO_TCHAR(item->protocol_name ().c_str ())));
00388 
00389           delete item;
00390 
00391           if (transfer_ownership == 0)
00392             delete protocol_factory;
00393 
00394           return -1;
00395         }
00396 
00397       if (TAO_debug_level > 0)
00398         {
00399           ACE_DEBUG ((LM_DEBUG,
00400                       ACE_TEXT("TAO (%P|%t) Loaded default ")
00401                       ACE_TEXT("protocol <UIOP_Factory>\n")));
00402         }
00403 #endif /* TAO_HAS_UIOP == 1 */
00404 
00405 #if defined (TAO_HAS_SHMIOP) && (TAO_HAS_SHMIOP != 0)
00406       protocol_factory =
00407         ACE_Dynamic_Service<TAO_Protocol_Factory>::instance ("SHMIOP_Factory");
00408 
00409       if (protocol_factory == 0)
00410         {
00411           if (TAO_debug_level > 0)
00412             ACE_ERROR ((LM_WARNING,
00413                         ACE_TEXT("(%P|%t) WARNING - No %s found in Service Repository.")
00414                         ACE_TEXT("  Using default instance.\n"),
00415                         ACE_TEXT("SHMIOP Protocol Factory")));
00416 
00417           ACE_NEW_RETURN (protocol_factory,
00418                           TAO_SHMIOP_Protocol_Factory,
00419                           -1);
00420 
00421           ACE_AUTO_PTR_RESET (safe_protocol_factory,
00422                               protocol_factory,
00423                               TAO_Protocol_Factory);
00424 
00425           transfer_ownership = 1;
00426         }
00427       else
00428         {
00429           transfer_ownership = 0;
00430         }
00431 
00432       ACE_NEW_RETURN (item, TAO_Protocol_Item ("SHMIOP_Factory"), -1);
00433       // If the TAO_Protocol_Item retains ownership of the
00434       // TAO_Protocol_Factory then we used an auto_ptr<> above, so
00435       // release the TAO_Protocol_Factory from it.  Otherwise, we
00436       // obtained the TAO_Protocol_Factory from the Service
00437       // Configurator so an auto_ptr<> wasn't used since the Service
00438       // Configurator retains ownership, hence there was no need to
00439       // use an auto_ptr<> in this method.
00440       item->factory ((transfer_ownership ?
00441                       safe_protocol_factory.release () :
00442                       protocol_factory),
00443                      transfer_ownership);
00444 
00445       if (this->protocol_factories_.insert (item) == -1)
00446         {
00447           ACE_ERROR ((LM_ERROR,
00448                       ACE_TEXT("TAO (%P|%t) Unable to add ")
00449                       ACE_TEXT("<%s> to protocol factory set.\n"),
00450                       ACE_TEXT_CHAR_TO_TCHAR(item->protocol_name ().c_str ())));
00451 
00452           delete item;
00453 
00454           if (transfer_ownership == 0)
00455             delete protocol_factory;
00456 
00457           return -1;
00458         }
00459 
00460       if (TAO_debug_level > 0)
00461         {
00462           ACE_DEBUG ((LM_DEBUG,
00463                       ACE_TEXT("TAO (%P|%t) Loaded default ")
00464                       ACE_TEXT("protocol <SHMIOP_Factory>\n")));
00465         }
00466 #endif /* TAO_HAS_SHMIOP && TAO_HAS_SHMIOP != 0 */
00467 
00468 #if defined (TAO_HAS_DIOP) && (TAO_HAS_DIOP != 0)
00469       protocol_factory =
00470         ACE_Dynamic_Service<TAO_Protocol_Factory>::instance ("DIOP_Factory");
00471 
00472       if (protocol_factory == 0)
00473         {
00474           if (TAO_debug_level > 0)
00475             ACE_ERROR ((LM_WARNING,
00476                         ACE_TEXT("(%P|%t) WARNING - No %s found in Service Repository.")
00477                         ACE_TEXT("  Using default instance.\n"),
00478                         ACE_TEXT("DIOP Protocol Factory")));
00479 
00480           ACE_NEW_RETURN (protocol_factory,
00481                           TAO_DIOP_Protocol_Factory,
00482                           -1);
00483 
00484           ACE_AUTO_PTR_RESET (safe_protocol_factory,
00485                               protocol_factory,
00486                               TAO_Protocol_Factory);
00487 
00488           transfer_ownership = 1;
00489         }
00490       else
00491         {
00492           transfer_ownership = 0;
00493         }
00494 
00495       ACE_NEW_RETURN (item, TAO_Protocol_Item ("DIOP_Factory"), -1);
00496       // If the TAO_Protocol_Item retains ownership of the
00497       // TAO_Protocol_Factory then we used an auto_ptr<> above, so
00498       // release the TAO_Protocol_Factory from it.  Otherwise, we
00499       // obtained the TAO_Protocol_Factory from the Service
00500       // Configurator so an auto_ptr<> wasn't used since the Service
00501       // Configurator retains ownership, hence there was no need to
00502       // use an auto_ptr<> in this method.
00503       item->factory ((transfer_ownership ?
00504                       safe_protocol_factory.release () :
00505                       protocol_factory),
00506                      transfer_ownership);
00507 
00508       if (this->protocol_factories_.insert (item) == -1)
00509         {
00510           ACE_ERROR ((LM_ERROR,
00511                       ACE_TEXT("TAO (%P|%t) Unable to add ")
00512                       ACE_TEXT("<%s> to protocol factory set.\n"),
00513                       ACE_TEXT_CHAR_TO_TCHAR(item->protocol_name ().c_str ())));
00514 
00515           delete item;
00516 
00517           if (transfer_ownership == 0)
00518             delete protocol_factory;
00519 
00520           return -1;
00521         }
00522 
00523       if (TAO_debug_level > 0)
00524         {
00525           ACE_DEBUG ((LM_DEBUG,
00526                       ACE_TEXT("TAO (%P|%t) Loaded default ")
00527                       ACE_TEXT("protocol <DIOP_Factory>\n")));
00528         }
00529 #endif /* TAO_HAS_DIOP && TAO_HAS_DIOP != 0 */
00530 
00531 #if defined (TAO_HAS_SCIOP) && (TAO_HAS_SCIOP != 0)
00532       protocol_factory =
00533         ACE_Dynamic_Service<TAO_Protocol_Factory>::instance ("SCIOP_Factory");
00534 
00535       if (protocol_factory == 0)
00536         {
00537           if (TAO_debug_level > 0)
00538             ACE_ERROR ((LM_WARNING,
00539                         ACE_TEXT("(%P|%t) WARNING - No %s found in Service Repository.")
00540                         ACE_TEXT("  Using default instance.\n"),
00541                         ACE_TEXT("SCIOP Protocol Factory")));
00542 
00543           ACE_NEW_RETURN (protocol_factory,
00544                           TAO_SCIOP_Protocol_Factory,
00545                           -1);
00546 
00547           ACE_AUTO_PTR_RESET (safe_protocol_factory,
00548                               protocol_factory,
00549                               TAO_Protocol_Factory);
00550 
00551           transfer_ownership = 1;
00552         }
00553       else
00554         {
00555           transfer_ownership = 0;
00556         }
00557 
00558       ACE_NEW_RETURN (item, TAO_Protocol_Item ("SCIOP_Factory"), -1);
00559       // If the TAO_Protocol_Item retains ownership of the
00560       // TAO_Protocol_Factory then we used an auto_ptr<> above, so
00561       // release the TAO_Protocol_Factory from it.  Otherwise, we
00562       // obtained the TAO_Protocol_Factory from the Service
00563       // Configurator so an auto_ptr<> wasn't used since the Service
00564       // Configurator retains ownership, hence there was no need to
00565       // use an auto_ptr<> in this method.
00566       item->factory ((transfer_ownership ?
00567                       safe_protocol_factory.release () :
00568                       protocol_factory),
00569                      transfer_ownership);
00570 
00571       if (this->protocol_factories_.insert (item) == -1)
00572         {
00573           ACE_ERROR ((LM_ERROR,
00574                       ACE_TEXT("TAO (%P|%t) Unable to add ")
00575                       ACE_TEXT("<%s> to protocol factory set.\n"),
00576                       ACE_TEXT_CHAR_TO_TCHAR(item->protocol_name ().c_str ())));
00577 
00578           delete item;
00579 
00580           if (transfer_ownership == 0)
00581             delete protocol_factory;
00582 
00583           return -1;
00584         }
00585 
00586       if (TAO_debug_level > 0)
00587         {
00588           ACE_DEBUG ((LM_DEBUG,
00589                       ACE_TEXT("TAO (%P|%t) Loaded default ")
00590                       ACE_TEXT("protocol <SCIOP_Factory>\n")));
00591         }
00592 #endif /* TAO_HAS_SCIOP && TAO_HAS_SCIOP != 0 */
00593 
00594       return 0;
00595 
00596     }
00597 
00598   for (; factory != end; factory++)
00599     {
00600       const ACE_CString &name = (*factory)->protocol_name ();
00601 
00602       (*factory)->factory (
00603         ACE_Dynamic_Service<TAO_Protocol_Factory>::instance (name.c_str ()));
00604       if ((*factory)->factory () == 0)
00605         {
00606           ACE_ERROR_RETURN ((LM_ERROR,
00607                              ACE_TEXT("TAO (%P|%t) Unable to load ")
00608                              ACE_TEXT("protocol <%s>, %m\n"),
00609                              ACE_TEXT_CHAR_TO_TCHAR(name.c_str ())),
00610                             -1);
00611         }
00612 
00613       if (TAO_debug_level > 0)
00614         {
00615           ACE_DEBUG ((LM_DEBUG,
00616                       ACE_TEXT("TAO (%P|%t) Loaded protocol <%s>\n"),
00617                       ACE_TEXT_CHAR_TO_TCHAR(name.c_str ())));
00618         }
00619     }
00620  return 0;
00621 }

int TAO_Advanced_Resource_Factory::input_cdr_allocator_type_locked void   )  [virtual]
 

Reimplemented from TAO_Default_Resource_Factory.

Definition at line 789 of file advanced_resource.cpp.

References cdr_allocator_type_, and TAO_ALLOCATOR_NULL_LOCK.

00790 {
00791   return this->cdr_allocator_type_ == TAO_ALLOCATOR_NULL_LOCK ? 0 : 1;
00792 }

ACE_Allocator * TAO_Advanced_Resource_Factory::input_cdr_buffer_allocator void   )  [virtual]
 

Reimplemented from TAO_Default_Resource_Factory.

Definition at line 714 of file advanced_resource.cpp.

References ACE_NEW_RETURN, cdr_allocator_type_, TAO_Default_Resource_Factory::input_cdr_buffer_allocator(), NULL_LOCK_ALLOCATOR, and TAO_ALLOCATOR_NULL_LOCK.

00715 {
00716   ACE_Allocator *allocator = 0;
00717   switch (this->cdr_allocator_type_)
00718     {
00719     case TAO_ALLOCATOR_NULL_LOCK:
00720       ACE_NEW_RETURN (allocator,
00721                       NULL_LOCK_ALLOCATOR,
00722                       0);
00723       break;
00724     default:
00725       return
00726         this->TAO_Default_Resource_Factory::input_cdr_buffer_allocator();
00727     }
00728   return allocator;
00729 }

ACE_Allocator * TAO_Advanced_Resource_Factory::input_cdr_dblock_allocator void   )  [virtual]
 

Reimplemented from TAO_Default_Resource_Factory.

Definition at line 695 of file advanced_resource.cpp.

References ACE_NEW_RETURN, cdr_allocator_type_, TAO_Default_Resource_Factory::input_cdr_dblock_allocator(), NULL_LOCK_ALLOCATOR, and TAO_ALLOCATOR_NULL_LOCK.

00696 {
00697   ACE_Allocator *allocator = 0;
00698   switch (this->cdr_allocator_type_)
00699     {
00700     case TAO_ALLOCATOR_NULL_LOCK:
00701       ACE_NEW_RETURN (allocator,
00702                       NULL_LOCK_ALLOCATOR,
00703                       0);
00704       break;
00705     default:
00706       return
00707         this->TAO_Default_Resource_Factory::input_cdr_dblock_allocator();
00708     }
00709 
00710   return allocator;
00711 }

ACE_Allocator * TAO_Advanced_Resource_Factory::input_cdr_msgblock_allocator void   )  [virtual]
 

Reimplemented from TAO_Default_Resource_Factory.

Definition at line 732 of file advanced_resource.cpp.

References ACE_NEW_RETURN, cdr_allocator_type_, TAO_Default_Resource_Factory::input_cdr_msgblock_allocator(), NULL_LOCK_ALLOCATOR, and TAO_ALLOCATOR_NULL_LOCK.

00733 {
00734   ACE_Allocator *allocator = 0;
00735   switch (this->cdr_allocator_type_)
00736     {
00737     case TAO_ALLOCATOR_NULL_LOCK:
00738       ACE_NEW_RETURN (allocator,
00739                       NULL_LOCK_ALLOCATOR,
00740                       0);
00741       break;
00742     default:
00743       return
00744         this->TAO_Default_Resource_Factory::input_cdr_msgblock_allocator();
00745     }
00746 
00747   return allocator;
00748 }

int TAO_Advanced_Resource_Factory::load_default_protocols void   )  [protected, virtual]
 

Reimplemented from TAO_Default_Resource_Factory.

Definition at line 289 of file advanced_resource.cpp.

References TAO_Default_Resource_Factory::load_default_protocols().

Referenced by init_protocol_factories().

00290 {
00291   const int r =
00292     this->TAO_Default_Resource_Factory::load_default_protocols ();
00293 
00294   this->protocol_factories_ =
00295     this->TAO_Default_Resource_Factory::protocol_factories_;
00296 
00297   this->TAO_Default_Resource_Factory::protocol_factories_.reset ();
00298 
00299   if (r == -1)
00300     return -1;
00301   // Load the UIOP and SHMIOP protocols...
00302 
00303   return 0;
00304 }

void TAO_Advanced_Resource_Factory::report_option_value_error const ACE_TCHAR option_name,
const ACE_TCHAR option_value
[protected]
 

Reimplemented from TAO_Default_Resource_Factory.

Definition at line 856 of file advanced_resource.cpp.

References ACE_DEBUG, ACE_TEXT, and LM_DEBUG.

00859 {
00860   ACE_DEBUG((LM_DEBUG,
00861              ACE_TEXT("Advanced_Resource_Factory - unknown argument")
00862              ACE_TEXT(" <%s> for <%s>\n"),
00863              option_value,
00864              option_name));
00865 }

void TAO_Advanced_Resource_Factory::report_unsupported_error const ACE_TCHAR option_name  )  [protected]
 

Definition at line 868 of file advanced_resource.cpp.

References ACE_DEBUG, ACE_TEXT, and LM_DEBUG.

00870 {
00871   ACE_DEBUG((LM_DEBUG,
00872              ACE_TEXT("Advanced_Resource_Factory - <%s>")
00873              ACE_TEXT(" not supported on this platform\n"),
00874              option_name));
00875 }


Member Data Documentation

Allocator_Lock_Type TAO_Advanced_Resource_Factory::amh_response_handler_allocator_lock_type_ [protected]
 

Type of lock used by AMH response handler allocator.

Definition at line 128 of file advanced_resource.h.

Referenced by amh_response_handler_allocator().

Allocator_Lock_Type TAO_Advanced_Resource_Factory::ami_response_handler_allocator_lock_type_ [protected]
 

Type of lock used by AMI response handler allocator.

Definition at line 131 of file advanced_resource.h.

Referenced by ami_response_handler_allocator().

Allocator_Lock_Type TAO_Advanced_Resource_Factory::cdr_allocator_type_ [protected]
 

The type of CDR allocators.

Definition at line 125 of file advanced_resource.h.

Referenced by input_cdr_allocator_type_locked(), input_cdr_buffer_allocator(), input_cdr_dblock_allocator(), and input_cdr_msgblock_allocator().

TAO_ProtocolFactorySet TAO_Advanced_Resource_Factory::protocol_factories_ [protected]
 

List of loaded protocol factories.

Reimplemented from TAO_Default_Resource_Factory.

Definition at line 112 of file advanced_resource.h.

int TAO_Advanced_Resource_Factory::reactor_registry_type_ [protected]
 

The type of reactor registry.

Definition at line 115 of file advanced_resource.h.

int TAO_Advanced_Resource_Factory::reactor_type_ [protected]
 

Flag indicating which kind of reactor we should use.

Definition at line 118 of file advanced_resource.h.

Referenced by allocate_reactor_impl(), and create_lf_strategy().

int TAO_Advanced_Resource_Factory::threadqueue_type_ [protected]
 

The type of queueing strategy to use for multi-threaded select reactors, TAO_REACTOR_SELECT_MT and TAO_REACTOR_TP.

Definition at line 122 of file advanced_resource.h.


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 13:40:58 2006 for TAO_Strategies by doxygen 1.3.6