예제 #1
0
void TIDNaming::ServantManagerNSImpl::etherealize(const PortableServer::ObjectId& oid,
                                                  PortableServer::POA_ptr adapter,
                                                  PortableServer::Servant servant,
                                                  CORBA::Boolean cleanup_in_progress,
                                                  CORBA::Boolean remaining_activations)
  throw (CORBA::SystemException)
{
  char* oid_str = PortableServer::ObjectId_to_string(oid);

  if (m_orb->trace != NULL){
    TIDorb::util::StringBuffer msg;
    msg << "ServantManagerNSImpl::etherealize OID=" << oid_str;
    m_orb->print_trace(TIDorb::util::TR_USER, msg.str().data());
  }

  delete oid_str;
  
  // Servant could be deleted by destroy() because it calls to deactivate_object(oid)
  if (!remaining_activations) {
    try {
      servant->_remove_ref(); 
    } catch (...) {
      if (m_orb->trace != NULL){
        TIDorb::util::StringBuffer msg;
        msg << "ServantManagerNSImpl::etherealize: unknown exception removing servant ";
        m_orb->print_trace(TIDorb::util::TR_ERROR, msg.str().data());
      }
    }
  }

}
예제 #2
0
void
ServantLocator::postinvoke (const PortableServer::ObjectId& oid,
							PortableServer::POA_ptr adapter,
							const char* operation,
							PortableServer::ServantLocator::Cookie the_cookie,
							PortableServer::Servant the_servant )
throw (CORBA::SystemException)
{
	/*
	//
	// call services registered for postinvoke
	//
	if(home_servant_->service_name_.empty())
	{
		std::vector <Qedo::ComponentInstance> ::iterator iter;

		Components::CCMService_ptr service;

		for (iter = home_servant_->container_->services_postinvoke_.begin();
			 iter != home_servant_->container_->services_postinvoke_.end(); iter++)
		{
 			service = dynamic_cast<Components::CCMService_ptr>((*iter).executor_locator_.in());
 			service->postinvoke((*iter).uuid_.c_str(), operation);
		}
	}*/

	the_servant->_remove_ref();
}
    void
    RequestProcessingStrategyAOMOnly::cleanup_servant (
      PortableServer::Servant servant,
      const PortableServer::ObjectId &user_id)
    {
      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);

          try
            {
              servant->_remove_ref ();
            }
          catch (...)
            {
              // Ignore exceptions from servant cleanup.
            }
        }

      // 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 ();
        }
    }
예제 #4
0
void GCServantLocator::postinvoke(const PortableServer::ObjectId& oid,
                                  PortableServer::POA_ptr adapter,
                                  const char* operation,
                                  PortableServer::ServantLocator::Cookie the_cookie,
                                  PortableServer::Servant the_servant)
{
    the_servant->_remove_ref();
}
void
Servant_Activator::etherealize (const PortableServer::ObjectId &,
                                PortableServer::POA_ptr,
                                PortableServer::Servant servant,
                                CORBA::Boolean,
                                CORBA::Boolean)
{
  servant->_remove_ref ();
}
예제 #6
0
void 
ServantLocator::postinvoke (const PortableServer::ObjectId& oid,
							PortableServer::POA_ptr adapter,
							const char* operation,
							PortableServer::ServantLocator::Cookie the_cookie,
							PortableServer::Servant the_servant )
throw (CORBA::SystemException)
{
	the_servant->_remove_ref();
}
예제 #7
0
void ServantActivatorImpl::etherealize(
		const PortableServer::ObjectId&	oid,
		PortableServer::POA_ptr		poa,
		PortableServer::Servant		servant,
		CORBA::Boolean			cleanup_in_progress,
		CORBA::Boolean			remaining_activations)
{
	printf("------- ServantActivator.etherealize() --------\n");
	servant->_remove_ref();
}
예제 #8
0
void ServantLocatorImpl::postinvoke(
		const PortableServer::ObjectId&	oid,
		PortableServer::POA_ptr		poa,
		const char*			operation,
		PortableServer::ServantLocator::Cookie cookie,
		PortableServer::Servant		servant)
{
	printf("------- ServantLocator.postinvoke(.., op='%s', .. ) "
			"--------\n", operation);
	servant->_remove_ref();
}
예제 #9
0
void
Servant_Activator::etherealize (const PortableServer::ObjectId &id,
                                PortableServer::POA_ptr ,
                                PortableServer::Servant servant,
                                CORBA::Boolean,
                                CORBA::Boolean)
{
  CORBA::String_var object_name =
    PortableServer::ObjectId_to_string (id);

  ACE_DEBUG ((LM_DEBUG,
              "Etherealize called with id = \"%C\"\n",
              object_name.in ()));

  if (ACE_OS::strcmp (object_name.in (),
                      "without reference counting") == 0)
    delete servant;
  else
    {
      servant->_remove_ref ();
    }
}
예제 #10
0
void 
TimeServantLocator::postinvoke (const PortableServer::ObjectId & oid, 
                                PortableServer::POA_ptr poa,
                                const char *operation,
                                void *cookie,
                                PortableServer::Servant servant)
  throw (CORBA::SystemException)
{
  // Check to see if the object ID is valid (CORBA)
  CORBA::String_var oidString;
  try 
    {
      oidString = PortableServer::ObjectId_to_string (oid);
    }
  catch (const CORBA::BAD_PARAM&)
    {
      throw CORBA::OBJECT_NOT_EXIST ();
    }

  debug ("TimeServantLocator::%s(%s)", __FUNCTION__, oidString.in());

  // Decrement servant reference count
  servant->_remove_ref ();
}
void
RequestProcessingStrategyServantActivator::cleanup_servant (
    PortableServer::Servant servant,
    const PortableServer::ObjectId &user_id
)
{
    // If a servant manager is associated with the POA,
    // ServantLocator::etherealize will be invoked with the oid and the
    // servant. (The deactivate_object operation does not wait for the
    // etherealize operation to complete before deactivate_object
    // returns.)
    //
    // Note: If the servant associated with the oid is serving multiple
    // Object Ids, ServantLocator::etherealize may be invoked multiple
    // times with the same servant when the other objects are
    // deactivated. It is the responsibility of the object
    // implementation to refrain from destroying the servant while it is
    // active with any Id.

    // If the POA has no ServantActivator associated with it, the POA
    // implementation calls _remove_ref when all operation invocations
    // have completed. If there is a ServantActivator, the Servant is
    // consumed by the call to ServantActivator::etherealize instead.

    // @bala, is this order correct, see 11.3.9.17 of the spec, it
    // says first remove from the map, then etherealize. not the
    // other way around
    // @@ Johnny, you are right! This will not show up until a
    // thread is trying to activate the object in another thread
    // using activate_object_with_id (). A test case is a must for
    // atleast this issue.
    if (servant)
    {
        if (this->etherealize_objects_ &&
                !CORBA::is_nil (this->servant_activator_.in ()))
        {
            this->etherealize_servant (user_id,
                                       servant,
                                       this->poa_->cleanup_in_progress ());
        }
        else
        {
            // ATTENTION: Trick locking here, see class header for details
            Non_Servant_Upcall non_servant_upcall (*this->poa_);
            ACE_UNUSED_ARG (non_servant_upcall);

            try
            {
                servant->_remove_ref ();
            }
            catch (...)
            {
                // Ignore exceptions from servant cleanup.
            }
        }
    }

    // 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 ();
}