#include <advanced_resource.h>
Inheritance diagram for TAO_Advanced_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 39 of file advanced_resource.h.
anonymous enum |
Type of Reactor.
TAO_REACTOR_SELECT_MT | Use ACE_Token. |
TAO_REACTOR_SELECT_ST | Use ACE_Noop_Token. |
TAO_REACTOR_WFMO | |
TAO_REACTOR_MSGWFMO | |
TAO_REACTOR_TP | |
TAO_REACTOR_DEV_POLL |
Definition at line 62 of file advanced_resource.h.
00063 { 00064 /// Use ACE_Token 00065 TAO_REACTOR_SELECT_MT = 1, 00066 00067 /// Use ACE_Noop_Token 00068 TAO_REACTOR_SELECT_ST = 2, 00069 TAO_REACTOR_WFMO = 3, 00070 TAO_REACTOR_MSGWFMO = 4, 00071 TAO_REACTOR_TP = 5, 00072 TAO_REACTOR_DEV_POLL = 6 00073 };
anonymous enum |
Thread queueing Strategy.
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 76 of file advanced_resource.h.
00077 { 00078 /// Not set, use LIFO. 00079 TAO_THREAD_QUEUE_NOT_SET, 00080 00081 /// FIFO, first-in-first-out. 00082 TAO_THREAD_QUEUE_FIFO, 00083 00084 /// LIFO, last-in-first-out (default). 00085 TAO_THREAD_QUEUE_LIFO 00086 };
Type of lock used for the allocators.
Definition at line 55 of file advanced_resource.h.
00056 { 00057 TAO_ALLOCATOR_NULL_LOCK, 00058 TAO_ALLOCATOR_THREAD_LOCK 00059 };
TAO_Advanced_Resource_Factory::TAO_Advanced_Resource_Factory | ( | void | ) |
Constructor.
Definition at line 73 of file advanced_resource.cpp.
00074 : reactor_type_ (TAO_DEFAULT_REACTOR_TYPE), 00075 threadqueue_type_ (TAO_THREAD_QUEUE_NOT_SET), 00076 cdr_allocator_type_ (TAO_ALLOCATOR_THREAD_LOCK), 00077 amh_response_handler_allocator_lock_type_ (TAO_ALLOCATOR_THREAD_LOCK), 00078 ami_response_handler_allocator_lock_type_ (TAO_ALLOCATOR_THREAD_LOCK) 00079 { 00080 // Constructor 00081 }
TAO_Advanced_Resource_Factory::~TAO_Advanced_Resource_Factory | ( | void | ) | [virtual] |
Destructor.
Definition at line 83 of file advanced_resource.cpp.
References ACE_Unbounded_Set_Ex< T, C >::end(), protocol_factories_, and ACE_Unbounded_Set_Ex< T, C >::reset().
00084 { 00085 // Destructor 00086 TAO_ProtocolFactorySetItor end = this->protocol_factories_.end (); 00087 00088 for (TAO_ProtocolFactorySetItor iterator = 00089 this->protocol_factories_.begin (); 00090 iterator != end; 00091 ++iterator) 00092 delete *iterator; 00093 00094 this->protocol_factories_.reset (); 00095 }
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 419 of file advanced_resource.cpp.
References ACE_NEW_RETURN, ACE::max_handles(), TAO_NULL_LOCK_REACTOR, TAO_REACTOR, TAO_REACTOR_DEV_POLL, TAO_REACTOR_MSGWFMO, TAO_REACTOR_SELECT_MT, TAO_REACTOR_SELECT_ST, TAO_REACTOR_TP, TAO_REACTOR_WFMO, and TAO_THREAD_QUEUE_FIFO.
00420 { 00421 ACE_Reactor_Impl *impl = 0; 00422 00423 /* 00424 * Hook for specializing the Reactor implementation in TAO. 00425 */ 00426 //@@ TAO_ADVANCED_RESOURCE_REACTOR_SPL_COMMENT_HOOK_START 00427 switch (this->reactor_type_) 00428 { 00429 case TAO_REACTOR_SELECT_MT: 00430 ACE_NEW_RETURN (impl, 00431 TAO_REACTOR ((ACE_Sig_Handler*)0, 00432 (ACE_Timer_Queue*)0, 00433 0, 00434 (ACE_Reactor_Notify*)0, 00435 this->reactor_mask_signals_), 00436 0); 00437 break; 00438 00439 case TAO_REACTOR_SELECT_ST: 00440 ACE_NEW_RETURN (impl, 00441 TAO_NULL_LOCK_REACTOR ((ACE_Sig_Handler*)0, 00442 (ACE_Timer_Queue*)0, 00443 0, 00444 (ACE_Reactor_Notify*)0, 00445 this->reactor_mask_signals_), 00446 0); 00447 break; 00448 00449 case TAO_REACTOR_WFMO: 00450 #if defined(ACE_WIN32) 00451 ACE_NEW_RETURN (impl, ACE_WFMO_Reactor, 0); 00452 #endif /* ACE_WIN32 */ 00453 break; 00454 00455 #if defined(ACE_WIN32) \ 00456 && !defined (ACE_LACKS_MSG_WFMO) \ 00457 && !defined (ACE_HAS_WINCE) \ 00458 && !defined (ACE_HAS_PHARLAP) 00459 case TAO_REACTOR_MSGWFMO: 00460 ACE_NEW_RETURN (impl, ACE_Msg_WFMO_Reactor, 0); 00461 break; 00462 #endif /* ACE_WIN32 && !ACE_LACKS_MSG_WFMO */ 00463 00464 #if defined (ACE_HAS_EVENT_POLL) || defined (ACE_HAS_DEV_POLL) 00465 case TAO_REACTOR_DEV_POLL: 00466 ACE_NEW_RETURN (impl, 00467 ACE_Dev_Poll_Reactor (ACE::max_handles (), 00468 1, // restart 00469 (ACE_Sig_Handler*)0, 00470 (ACE_Timer_Queue*)0, 00471 0, // Do not disable notify 00472 0, // Allocate notify handler 00473 this->reactor_mask_signals_, 00474 ACE_Select_Reactor_Token::LIFO), 00475 0); 00476 break; 00477 #endif /* ACE_HAS_EVENT_POLL || ACE_HAS_DEV_POLL */ 00478 00479 default: 00480 case TAO_REACTOR_TP: 00481 ACE_NEW_RETURN (impl, 00482 ACE_TP_Reactor (ACE::max_handles (), 00483 1, 00484 (ACE_Sig_Handler*)0, 00485 (ACE_Timer_Queue*)0, 00486 this->reactor_mask_signals_, 00487 this->threadqueue_type_ == TAO_THREAD_QUEUE_FIFO ? 00488 ACE_Select_Reactor_Token::FIFO : 00489 ACE_Select_Reactor_Token::LIFO), 00490 0); 00491 break; 00492 } 00493 00494 //@@ TAO_ADVANCED_RESOURCE_REACTOR_SPL_COMMENT_HOOK_END 00495 00496 return impl; 00497 }
ACE_Allocator * TAO_Advanced_Resource_Factory::amh_response_handler_allocator | ( | void | ) | [virtual] |
Reimplemented from TAO_Default_Resource_Factory.
Definition at line 559 of file advanced_resource.cpp.
References ACE_NEW_RETURN, TAO_Default_Resource_Factory::amh_response_handler_allocator(), and TAO_ALLOCATOR_NULL_LOCK.
00560 { 00561 ACE_Allocator *allocator = 0; 00562 switch (this->amh_response_handler_allocator_lock_type_) 00563 { 00564 case TAO_ALLOCATOR_NULL_LOCK: 00565 ACE_NEW_RETURN (allocator, 00566 NULL_LOCK_ALLOCATOR, 00567 0); 00568 break; 00569 default: 00570 return 00571 this->TAO_Default_Resource_Factory::amh_response_handler_allocator(); 00572 } 00573 00574 return allocator; 00575 }
ACE_Allocator * TAO_Advanced_Resource_Factory::ami_response_handler_allocator | ( | void | ) | [virtual] |
Reimplemented from TAO_Default_Resource_Factory.
Definition at line 578 of file advanced_resource.cpp.
References ACE_NEW_RETURN, TAO_Default_Resource_Factory::ami_response_handler_allocator(), and TAO_ALLOCATOR_NULL_LOCK.
00579 { 00580 ACE_Allocator *allocator = 0; 00581 switch (this->ami_response_handler_allocator_lock_type_) 00582 { 00583 case TAO_ALLOCATOR_NULL_LOCK: 00584 ACE_NEW_RETURN (allocator, 00585 NULL_LOCK_ALLOCATOR, 00586 0); 00587 break; 00588 default: 00589 return 00590 this->TAO_Default_Resource_Factory::ami_response_handler_allocator(); 00591 } 00592 00593 return allocator; 00594 }
TAO_LF_Strategy * TAO_Advanced_Resource_Factory::create_lf_strategy | ( | void | ) | [virtual] |
Reimplemented from TAO_Default_Resource_Factory.
Definition at line 644 of file advanced_resource.cpp.
References ACE_NEW_RETURN, and TAO_REACTOR_SELECT_ST.
00645 { 00646 TAO_LF_Strategy *strategy = 0; 00647 00648 if (this->reactor_type_ == TAO_REACTOR_SELECT_ST) 00649 { 00650 ACE_NEW_RETURN (strategy, 00651 TAO_LF_Strategy_Null, 00652 0); 00653 } 00654 else 00655 { 00656 ACE_NEW_RETURN (strategy, 00657 TAO_LF_Strategy_Complete, 00658 0); 00659 } 00660 return strategy; 00661 }
TAO_Connection_Purging_Strategy * TAO_Advanced_Resource_Factory::create_purging_strategy | ( | void | ) | [virtual] |
Reimplemented from TAO_Default_Resource_Factory.
Definition at line 603 of file advanced_resource.cpp.
References ACE_ERROR, ACE_NEW_RETURN, ACE_TEXT, TAO_Resource_Factory::FIFO, TAO_Resource_Factory::LFU, TAO_Resource_Factory::LRU, and TAO_Resource_Factory::NOOP.
00604 { 00605 TAO_Connection_Purging_Strategy *strategy = 0; 00606 00607 switch(this->connection_purging_type_) 00608 { 00609 case TAO_Resource_Factory::LFU: 00610 ACE_NEW_RETURN (strategy, 00611 TAO_LFU_Connection_Purging_Strategy ( 00612 this->cache_maximum ()), 00613 0); 00614 break; 00615 case TAO_Resource_Factory::FIFO: 00616 ACE_NEW_RETURN (strategy, 00617 TAO_FIFO_Connection_Purging_Strategy ( 00618 this->cache_maximum ()), 00619 0); 00620 break; 00621 case TAO_Resource_Factory::NOOP: 00622 ACE_NEW_RETURN (strategy, 00623 TAO_NULL_Connection_Purging_Strategy ( 00624 this->cache_maximum ()), 00625 0); 00626 break; 00627 case TAO_Resource_Factory::LRU: 00628 ACE_NEW_RETURN (strategy, 00629 TAO_LRU_Connection_Purging_Strategy ( 00630 this->cache_maximum ()), 00631 0); 00632 break; 00633 default: 00634 ACE_ERROR ((LM_ERROR, 00635 ACE_TEXT("TAO (%P|%t) - ") 00636 ACE_TEXT("Unknown connection purging strategy ") 00637 ACE_TEXT("type was found.\n"))); 00638 } 00639 00640 return strategy; 00641 }
TAO_ProtocolFactorySet * TAO_Advanced_Resource_Factory::get_protocol_factories | ( | void | ) | [virtual] |
Reimplemented from TAO_Default_Resource_Factory.
Definition at line 413 of file advanced_resource.cpp.
References protocol_factories_.
00414 { 00415 return &protocol_factories_; 00416 }
virtual int TAO_Advanced_Resource_Factory::init | ( | int | argc, | |
ACE_TCHAR * | argv[] | |||
) | [virtual] |
int TAO_Advanced_Resource_Factory::init_protocol_factories | ( | void | ) | [virtual] |
Reimplemented from TAO_Default_Resource_Factory.
Definition at line 327 of file advanced_resource.cpp.
References ACE_DEBUG, ACE_ERROR_RETURN, ACE_TEXT, ACE_TEXT_CHAR_TO_TCHAR, ACE_Unbounded_Set_Ex< T, C >::begin(), TAO_Resource_Factory::disable_factory(), ACE_Unbounded_Set_Ex< T, C >::end(), ACE_Dynamic_Service< TYPE >::instance(), load_default_protocols(), protocol_factories_, and TAO_debug_level.
00328 { 00329 // If the default resource factory exists, then disable it. 00330 // This causes any directives for the "Resource_Factory" to 00331 // report warnings. 00332 // This is needed to ensure warnings when no static directive 00333 // for this factory is used (and init() is not called). 00334 TAO_Resource_Factory *default_resource_factory = 00335 ACE_Dynamic_Service<TAO_Resource_Factory>::instance ("Resource_Factory"); 00336 if (default_resource_factory != 0) 00337 { 00338 default_resource_factory->disable_factory(); 00339 } 00340 00341 TAO_ProtocolFactorySetItor end = protocol_factories_.end (); 00342 TAO_ProtocolFactorySetItor factory = protocol_factories_.begin (); 00343 00344 if (factory == end) 00345 { 00346 int const r = this->load_default_protocols (); 00347 00348 if (r == -1) 00349 return -1; 00350 00351 #if TAO_HAS_UIOP == 1 00352 if (TAO::details::load_protocol_factory <TAO_UIOP_Protocol_Factory> ( 00353 this->protocol_factories_, "UIOP_Factory") == -1) 00354 return -1; 00355 #endif /* TAO_HAS_UIOP == 1 */ 00356 00357 #if defined (TAO_HAS_SHMIOP) && (TAO_HAS_SHMIOP != 0) 00358 if (TAO::details::load_protocol_factory <TAO_SHMIOP_Protocol_Factory> ( 00359 this->protocol_factories_, "SHMIOP_Factory") == -1) 00360 return -1; 00361 #endif /* TAO_HAS_SHMIOP && TAO_HAS_SHMIOP != 0 */ 00362 00363 #if defined (TAO_HAS_DIOP) && (TAO_HAS_DIOP != 0) 00364 if (TAO::details::load_protocol_factory <TAO_DIOP_Protocol_Factory> ( 00365 this->protocol_factories_, "DIOP_Factory") == -1) 00366 return -1; 00367 #endif /* TAO_HAS_DIOP && TAO_HAS_DIOP != 0 */ 00368 00369 #if defined (TAO_HAS_SCIOP) && (TAO_HAS_SCIOP != 0) 00370 if (TAO::details::load_protocol_factory <TAO_SCIOP_Protocol_Factory> ( 00371 this->protocol_factories_, "SCIOP_Factory") == -1) 00372 return -1; 00373 #endif /* TAO_HAS_SCIOP && TAO_HAS_SCIOP != 0 */ 00374 00375 #if defined (TAO_HAS_COIOP) && (TAO_HAS_COIOP != 0) 00376 if (TAO::details::load_protocol_factory <TAO_COIOP_Protocol_Factory> ( 00377 this->protocol_factories_, "COIOP_Factory") == -1) 00378 return -1; 00379 #endif /* TAO_HAS_COIOP && TAO_HAS_COIOP != 0 */ 00380 00381 return 0; 00382 00383 } 00384 00385 for (; factory != end; factory++) 00386 { 00387 const ACE_CString &name = (*factory)->protocol_name (); 00388 00389 (*factory)->factory ( 00390 ACE_Dynamic_Service<TAO_Protocol_Factory>::instance (name.c_str ())); 00391 if ((*factory)->factory () == 0) 00392 { 00393 ACE_ERROR_RETURN ((LM_ERROR, 00394 ACE_TEXT("TAO (%P|%t) Unable to load ") 00395 ACE_TEXT("protocol <%s>, %m\n"), 00396 ACE_TEXT_CHAR_TO_TCHAR(name.c_str ())), 00397 -1); 00398 } 00399 00400 if (TAO_debug_level > 0) 00401 { 00402 ACE_DEBUG ((LM_DEBUG, 00403 ACE_TEXT("TAO (%P|%t) Loaded protocol <%s>\n"), 00404 ACE_TEXT_CHAR_TO_TCHAR(name.c_str ()))); 00405 } 00406 } 00407 return 0; 00408 }
int TAO_Advanced_Resource_Factory::input_cdr_allocator_type_locked | ( | void | ) | [virtual] |
Reimplemented from TAO_Default_Resource_Factory.
Definition at line 597 of file advanced_resource.cpp.
References cdr_allocator_type_, and TAO_ALLOCATOR_NULL_LOCK.
00598 { 00599 return this->cdr_allocator_type_ == TAO_ALLOCATOR_NULL_LOCK ? 0 : 1; 00600 }
ACE_Allocator * TAO_Advanced_Resource_Factory::input_cdr_buffer_allocator | ( | void | ) | [virtual] |
Reimplemented from TAO_Default_Resource_Factory.
Definition at line 522 of file advanced_resource.cpp.
References ACE_NEW_RETURN, TAO_Default_Resource_Factory::input_cdr_buffer_allocator(), and TAO_ALLOCATOR_NULL_LOCK.
00523 { 00524 ACE_Allocator *allocator = 0; 00525 switch (this->cdr_allocator_type_) 00526 { 00527 case TAO_ALLOCATOR_NULL_LOCK: 00528 ACE_NEW_RETURN (allocator, 00529 NULL_LOCK_ALLOCATOR, 00530 0); 00531 break; 00532 default: 00533 return 00534 this->TAO_Default_Resource_Factory::input_cdr_buffer_allocator(); 00535 } 00536 return allocator; 00537 }
ACE_Allocator * TAO_Advanced_Resource_Factory::input_cdr_dblock_allocator | ( | void | ) | [virtual] |
Reimplemented from TAO_Default_Resource_Factory.
Definition at line 503 of file advanced_resource.cpp.
References ACE_NEW_RETURN, TAO_Default_Resource_Factory::input_cdr_dblock_allocator(), and TAO_ALLOCATOR_NULL_LOCK.
00504 { 00505 ACE_Allocator *allocator = 0; 00506 switch (this->cdr_allocator_type_) 00507 { 00508 case TAO_ALLOCATOR_NULL_LOCK: 00509 ACE_NEW_RETURN (allocator, 00510 NULL_LOCK_ALLOCATOR, 00511 0); 00512 break; 00513 default: 00514 return 00515 this->TAO_Default_Resource_Factory::input_cdr_dblock_allocator(); 00516 } 00517 00518 return allocator; 00519 }
ACE_Allocator * TAO_Advanced_Resource_Factory::input_cdr_msgblock_allocator | ( | void | ) | [virtual] |
Reimplemented from TAO_Default_Resource_Factory.
Definition at line 540 of file advanced_resource.cpp.
References ACE_NEW_RETURN, TAO_Default_Resource_Factory::input_cdr_msgblock_allocator(), and TAO_ALLOCATOR_NULL_LOCK.
00541 { 00542 ACE_Allocator *allocator = 0; 00543 switch (this->cdr_allocator_type_) 00544 { 00545 case TAO_ALLOCATOR_NULL_LOCK: 00546 ACE_NEW_RETURN (allocator, 00547 NULL_LOCK_ALLOCATOR, 00548 0); 00549 break; 00550 default: 00551 return 00552 this->TAO_Default_Resource_Factory::input_cdr_msgblock_allocator(); 00553 } 00554 00555 return allocator; 00556 }
int TAO_Advanced_Resource_Factory::load_default_protocols | ( | void | ) | [protected, virtual] |
Reimplemented from TAO_Default_Resource_Factory.
Definition at line 308 of file advanced_resource.cpp.
References TAO_Default_Resource_Factory::load_default_protocols(), TAO_Default_Resource_Factory::protocol_factories_, protocol_factories_, and ACE_Unbounded_Set_Ex< T, C >::reset().
Referenced by init_protocol_factories().
00309 { 00310 int const r = 00311 this->TAO_Default_Resource_Factory::load_default_protocols (); 00312 00313 this->protocol_factories_ = 00314 this->TAO_Default_Resource_Factory::protocol_factories_; 00315 00316 this->TAO_Default_Resource_Factory::protocol_factories_.reset (); 00317 00318 if (r == -1) 00319 return -1; 00320 // Load the UIOP and SHMIOP protocols... 00321 00322 return 0; 00323 }
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 664 of file advanced_resource.cpp.
References ACE_DEBUG, and ACE_TEXT.
00667 { 00668 ACE_DEBUG((LM_DEBUG, 00669 ACE_TEXT("Advanced_Resource_Factory - unknown argument") 00670 ACE_TEXT(" <%s> for <%s>\n"), 00671 option_value, 00672 option_name)); 00673 }
void TAO_Advanced_Resource_Factory::report_unsupported_error | ( | const ACE_TCHAR * | option_name | ) | [protected] |
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 132 of file advanced_resource.h.
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 135 of file advanced_resource.h.
The type of CDR allocators.
Definition at line 129 of file advanced_resource.h.
Referenced by input_cdr_allocator_type_locked().
List of loaded protocol factories.
Reimplemented from TAO_Default_Resource_Factory.
Definition at line 116 of file advanced_resource.h.
Referenced by get_protocol_factories(), init_protocol_factories(), load_default_protocols(), and ~TAO_Advanced_Resource_Factory().
int TAO_Advanced_Resource_Factory::reactor_registry_type_ [protected] |
int TAO_Advanced_Resource_Factory::reactor_type_ [protected] |
Flag indicating which kind of reactor we should use.
Definition at line 122 of file advanced_resource.h.
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 126 of file advanced_resource.h.