Proxy class for the Custom Servant Dispatching Strategy. More...
#include <CSD_Strategy_Proxy.h>
Public Member Functions | |
Strategy_Proxy () | |
Default Constructor. | |
~Strategy_Proxy () | |
Destructor. | |
bool | custom_strategy (CSD_Framework::Strategy_ptr strategy) |
void | dispatch_request (TAO_ServerRequest &server_request, TAO::Portable_Server::Servant_Upcall &upcall) |
bool | poa_activated_event (TAO_ORB_Core &orb_core) |
Event - The POA has been (or is being) activated. | |
void | poa_deactivated_event () |
Event - The POA has been deactivated. | |
void | servant_activated_event (PortableServer::Servant servant, const PortableServer::ObjectId &oid) |
Event - A servant has been activated. | |
void | servant_deactivated_event (PortableServer::Servant servant, const PortableServer::ObjectId &oid) |
Event - A servant has been deactivated. | |
Private Attributes | |
CSD_Framework::Strategy_var | strategy_ |
TAO::CSD::Strategy_Base * | strategy_impl_ |
Proxy class for the Custom Servant Dispatching Strategy.
If no custom servant dispatching strategy is provided to the proxy, then the "default servant dispatching strategy" logic is used.
Definition at line 46 of file CSD_Strategy_Proxy.h.
TAO::CSD::Strategy_Proxy::Strategy_Proxy | ( | ) |
TAO::CSD::Strategy_Proxy::~Strategy_Proxy | ( | ) |
Destructor.
Definition at line 14 of file CSD_Strategy_Proxy.inl.
{ strategy_impl_ = 0; // don't delete it! The var will do it for us. }
bool TAO::CSD::Strategy_Proxy::custom_strategy | ( | CSD_Framework::Strategy_ptr | strategy | ) |
Mutator to provide the proxy with a CSD Strategy object. A return value of true indicates success, and false indicates failure to set the custom strategy on the proxy object.
Definition at line 20 of file CSD_Strategy_Proxy.cpp.
{ if (this->strategy_impl_) { if (TAO_debug_level > 0) ACE_ERROR((LM_ERROR, ACE_TEXT("(%P|%t) Error - TAO::CSD::Strategy_Proxy ") ACE_TEXT("object already has a custom strategy.\n"))); return false; } if (CORBA::is_nil(strategy)) { if (TAO_debug_level > 0) ACE_ERROR((LM_ERROR, ACE_TEXT("(%P|%t) Error - TAO::CSD::Strategy_Proxy ") ACE_TEXT("supplied with a NIL custom strategy.\n"))); return false; } // We need to bump up the reference count of the strategy before saving // it off into our handle (smart pointer) data member. this->strategy_ = CSD_Framework::Strategy::_duplicate(strategy); this->strategy_impl_ = dynamic_cast <TAO::CSD::Strategy_Base*> (strategy); return true; }
void TAO::CSD::Strategy_Proxy::dispatch_request | ( | TAO_ServerRequest & | server_request, | |
TAO::Portable_Server::Servant_Upcall & | upcall | |||
) |
Invoked by the Object_Adapter using an ORB thread.
If the proxy object holds a custom strategy object, then this method will simply delegate to the custom strategy object. Otherwise, this method will perform the "default servant dispatching strategy" logic, preserving the original logic path as it was prior to the introduction of the Custom Servant Dispatching feature.
This method will be inlined (if inlining is turned on during the build).
The added cost to the original logic path will be this method invocation + one conditional (an is_nil() call/comparison for truth on the smart pointer to the custom dispatching strategy object).
Definition at line 22 of file CSD_Strategy_Proxy.inl.
{ if (this->strategy_impl_ == 0) { // This is the "default" strategy implementation. upcall.servant()->_dispatch(server_request, (void*)&upcall); } else { // Delegate to the custom strategy object. this->strategy_impl_->dispatch_request(server_request, upcall); } }
bool TAO::CSD::Strategy_Proxy::poa_activated_event | ( | TAO_ORB_Core & | orb_core | ) |
Event - The POA has been (or is being) activated.
Definition at line 40 of file CSD_Strategy_Proxy.inl.
{ // Delegate to the custom strategy object (or return true if this proxy // is not holding a custom strategy). return (this->strategy_impl_ == 0) ? true : this->strategy_impl_->poa_activated_event(orb_core); }
void TAO::CSD::Strategy_Proxy::poa_deactivated_event | ( | ) |
Event - The POA has been deactivated.
Definition at line 51 of file CSD_Strategy_Proxy.inl.
{ // We only need to do something if this proxy holds a custom strategy. if (this->strategy_impl_) { // Delegate to the custom strategy object. this->strategy_impl_->poa_deactivated_event(); } }
void TAO::CSD::Strategy_Proxy::servant_activated_event | ( | PortableServer::Servant | servant, | |
const PortableServer::ObjectId & | oid | |||
) |
Event - A servant has been activated.
Definition at line 64 of file CSD_Strategy_Proxy.inl.
{ // We only need to do something if this proxy holds a custom strategy. if (this->strategy_impl_) { // Delegate to the custom strategy object. this->strategy_impl_->servant_activated_event(servant, oid); } }
void TAO::CSD::Strategy_Proxy::servant_deactivated_event | ( | PortableServer::Servant | servant, | |
const PortableServer::ObjectId & | oid | |||
) |
Event - A servant has been deactivated.
Definition at line 78 of file CSD_Strategy_Proxy.inl.
{ // We only need to do something if this proxy holds a custom strategy. if (this->strategy_impl_) { // Delegate to the custom strategy object. this->strategy_impl_->servant_deactivated_event(servant, oid); } }
CSD_Framework::Strategy_var TAO::CSD::Strategy_Proxy::strategy_ [private] |
Smart Pointer to a custom servant dispatching strategy object. This smart pointer will be in the "nil" state when the "default" strategy is to be applied.
Definition at line 97 of file CSD_Strategy_Proxy.h.
TAO::CSD::Strategy_Base* TAO::CSD::Strategy_Proxy::strategy_impl_ [private] |
Definition at line 98 of file CSD_Strategy_Proxy.h.