#include <RequestProcessingStrategyServantLocator.h>


Public Member Functions | |
| RequestProcessingStrategyServantLocator (void) | |
| virtual void | strategy_cleanup (void) |
| PortableServer::ServantManager_ptr | get_servant_manager (void) |
| void | set_servant_manager (PortableServer::ServantManager_ptr imgr) |
| virtual TAO_SERVANT_LOCATION | locate_servant (const PortableServer::ObjectId &system_id, PortableServer::Servant &servant) |
| virtual void | post_invoke_servant_cleanup (const PortableServer::ObjectId &system_id, const TAO::Portable_Server::Servant_Upcall &servant_upcall) |
| virtual PortableServer::Servant | locate_servant (const char *operation, const PortableServer::ObjectId &system_id, TAO::Portable_Server::Servant_Upcall &servant_upcall, TAO::Portable_Server::POA_Current_Impl &poa_current_impl, bool &wait_occurred_restart_call) |
| virtual void | cleanup_servant (PortableServer::Servant servant, const PortableServer::ObjectId &user_id) |
| virtual void | etherealize_objects (CORBA::Boolean etherealize_objects) |
Private Attributes | |
| PortableServer::ServantLocator_var | servant_locator_ |
Definition at line 35 of file RequestProcessingStrategyServantLocator.h.
| TAO::Portable_Server::RequestProcessingStrategyServantLocator::RequestProcessingStrategyServantLocator | ( | void | ) |
Definition at line 24 of file RequestProcessingStrategyServantLocator.cpp.
{
}
| void TAO::Portable_Server::RequestProcessingStrategyServantLocator::cleanup_servant | ( | PortableServer::Servant | servant, | |
| const PortableServer::ObjectId & | user_id | |||
| ) | [virtual] |
Implements TAO::Portable_Server::RequestProcessingStrategy.
Definition at line 167 of file RequestProcessingStrategyServantLocator.cpp.
{
if (servant)
{
// ATTENTION: Trick locking here, see class header for details
Non_Servant_Upcall non_servant_upcall (*this->poa_);
ACE_UNUSED_ARG (non_servant_upcall);
servant->_remove_ref ();
}
// This operation causes the association of the Object Id specified
// by the oid parameter and its servant to be removed from the
// Active Object Map.
if (this->poa_->unbind_using_user_id (user_id) != 0)
{
throw ::CORBA::OBJ_ADAPTER ();
}
}
| void TAO::Portable_Server::RequestProcessingStrategyServantLocator::etherealize_objects | ( | CORBA::Boolean | etherealize_objects | ) | [virtual] |
Implements TAO::Portable_Server::RequestProcessingStrategy.
Definition at line 190 of file RequestProcessingStrategyServantLocator.cpp.
{
}
| PortableServer::ServantManager_ptr TAO::Portable_Server::RequestProcessingStrategyServantLocator::get_servant_manager | ( | void | ) | [virtual] |
Implements TAO::Portable_Server::RequestProcessingStrategy.
Definition at line 42 of file RequestProcessingStrategyServantLocator.cpp.
{
return PortableServer::ServantManager::_duplicate (this->servant_locator_.in ());
}
| TAO_SERVANT_LOCATION TAO::Portable_Server::RequestProcessingStrategyServantLocator::locate_servant | ( | const PortableServer::ObjectId & | system_id, | |
| PortableServer::Servant & | servant | |||
| ) | [virtual] |
Implements TAO::Portable_Server::RequestProcessingStrategy.
Definition at line 68 of file RequestProcessingStrategyServantLocator.cpp.
{
TAO_SERVANT_LOCATION location =
this->poa_->servant_present (system_id, servant);
if (location == TAO_SERVANT_NOT_FOUND)
{
if (!CORBA::is_nil (this->servant_locator_.in ()))
{
location = TAO_SERVANT_MANAGER;
}
}
return location;
}
| PortableServer::Servant TAO::Portable_Server::RequestProcessingStrategyServantLocator::locate_servant | ( | const char * | operation, | |
| const PortableServer::ObjectId & | system_id, | |||
| TAO::Portable_Server::Servant_Upcall & | servant_upcall, | |||
| TAO::Portable_Server::POA_Current_Impl & | poa_current_impl, | |||
| bool & | wait_occurred_restart_call | |||
| ) | [virtual] |
Implements TAO::Portable_Server::RequestProcessingStrategy.
Definition at line 87 of file RequestProcessingStrategyServantLocator.cpp.
{
PortableServer::Servant servant = this->poa_->find_servant (system_id,
servant_upcall,
poa_current_impl);
if (servant != 0)
{
return servant;
}
// If the POA has the USE_SERVANT_MANAGER policy, a servant manager
// has been associated with the POA so the POA will invoke incarnate
// or preinvoke on it to find a servant that may handle the
// request. (The choice of method depends on the NON_RETAIN or
// RETAIN policy of the POA.) If no servant manager has been
// associated with the POA, the POA raises the OBJ_ADAPTER system
// exception.
//
// If a servant manager is located and invoked, but the servant
// manager is not directly capable of incarnating the object, it
// (the servant manager) may deal with the circumstance in a variety
// of ways, all of which are the application's responsibility. Any
// system exception raised by the servant manager will be returned
// to the client in the reply. In addition to standard CORBA
// exceptions, a servant manager is capable of raising a
// ForwardRequest exception. This exception includes an object
// reference.
//
this->validate_servant_manager (this->servant_locator_.in ());
// No serialization of invocations of preinvoke or
// postinvoke may be assumed; there may be multiple
// concurrent invocations of preinvoke for the same
// ObjectId.
//
// The same thread will be used to preinvoke the object,
// process the request, and postinvoke the object.
// @@ Note that it is possible for some other thread to
// reset the servant locator once the lock is released.
// However, this possiblility also exists for postinvoke()
// which is also called outside the lock.
// Release the object adapter lock.
this->poa_->object_adapter().lock ().release ();
// We have released the object adapter lock. Record this
// for later use.
servant_upcall.state (TAO::Portable_Server::Servant_Upcall::OBJECT_ADAPTER_LOCK_RELEASED);
PortableServer::ServantLocator::Cookie cookie = 0;
servant =
this->servant_locator_->preinvoke (poa_current_impl.object_id (),
this->poa_,
operation,
cookie);
if (servant == 0)
{
throw ::CORBA::OBJ_ADAPTER (CORBA::OMGVMCID | 7, CORBA::COMPLETED_NO);
}
// Remember the cookie
servant_upcall.locator_cookie (cookie);
// Remember operation name.
servant_upcall.operation (operation);
// Success
return servant;
}
| void TAO::Portable_Server::RequestProcessingStrategyServantLocator::post_invoke_servant_cleanup | ( | const PortableServer::ObjectId & | system_id, | |
| const TAO::Portable_Server::Servant_Upcall & | servant_upcall | |||
| ) | [virtual] |
Implements TAO::Portable_Server::RequestProcessingStrategy.
Definition at line 196 of file RequestProcessingStrategyServantLocator.cpp.
{
// @todo This method seems to misbehave according to the corba spec, see
// section 11.3.7.2. It says that when postinvoke raises an system
// exception the methods normal return is overrriden, the request completes
// with the exception
if (!CORBA::is_nil (this->servant_locator_.in ()) &&
servant_upcall.servant())
{
try
{
servant_locator_->postinvoke (system_id,
this->poa_,
servant_upcall.operation (),
servant_upcall.locator_cookie (),
servant_upcall.servant ());
}
catch (const ::CORBA::Exception&)
{
// Ignore errors from servant locator ....
}
}
}
| void TAO::Portable_Server::RequestProcessingStrategyServantLocator::set_servant_manager | ( | PortableServer::ServantManager_ptr | imgr | ) | [virtual] |
Implements TAO::Portable_Server::RequestProcessingStrategy.
Definition at line 48 of file RequestProcessingStrategyServantLocator.cpp.
{
// This operation sets the default servant manager associated with the
// POA. This operation may only be invoked once after a POA has been
// created. Attempting to set the servant manager after one has already
// been set will result in the BAD_INV_ORDER system exception with
// standard minor code 6 being raised (see 11.3.9.12 of the corba spec)
if (!CORBA::is_nil (this->servant_locator_.in ()))
{
throw ::CORBA::BAD_INV_ORDER (CORBA::OMGVMCID | 6,
CORBA::COMPLETED_NO);
}
this->servant_locator_ = PortableServer::ServantLocator::_narrow (imgr);
this->validate_servant_manager (this->servant_locator_.in ());
}
| void TAO::Portable_Server::RequestProcessingStrategyServantLocator::strategy_cleanup | ( | void | ) | [virtual] |
Reimplemented from TAO::Portable_Server::RequestProcessingStrategy.
Definition at line 29 of file RequestProcessingStrategyServantLocator.cpp.
{
{
Non_Servant_Upcall non_servant_upcall (*this->poa_);
ACE_UNUSED_ARG (non_servant_upcall);
this->servant_locator_ = PortableServer::ServantLocator::_nil ();
}
RequestProcessingStrategy::strategy_cleanup ();
}
PortableServer::ServantLocator_var TAO::Portable_Server::RequestProcessingStrategyServantLocator::servant_locator_ [private] |
Definition at line 69 of file RequestProcessingStrategyServantLocator.h.
1.7.0