void
  StructuredPushSupplier::disconnect() 
  {
    DBG(cout << "Disconnecting StructuredPushSupplier." << endl);

    Guard guard(connectedMutex_);
    if (connected_) {
      proxyConsumer_->disconnect_structured_push_consumer();
      supplierAdmin_->destroy();

      // Get reference to Root POA.
      PortableServer::POA_var poa = _default_POA();

      // Deactivate.
      PortableServer::ObjectId_var oid =
	poa->reference_to_id (objref_);

      CORBA::release(objref_);
    
      // deactivate from the poa.
      poa->deactivate_object (oid.in ());

      connected_ = false;
    }
  }
  void
  StructuredPushConsumer::disconnect()
  {
    Guard guard(connectedMutex_);
    if (connected_ == 1) {
      MIRO_DBG(MIRO, LL_NOTICE, "Disconnecting StructuredPushConsumer.\n");
      connected_ = -1;
      try {
        proxySupplier_->disconnect_structured_push_supplier();

        // Get reference to Root POA.
        PortableServer::POA_var poa = _default_POA();

        // Deactivate.
        PortableServer::ObjectId_var oid =
          poa->reference_to_id(objref_);

        CORBA::release(objref_);

        // deactivate from the poa.
        poa->deactivate_object(oid.in());
      }
      catch (const CORBA::Exception & e) {
        MIRO_LOG_OSTR(LL_ERROR, "StructuredPushConsumer::disconnect() CORBA exception on: " << std::endl
                      << e << std::endl);
      }
    }
  }
Esempio n. 3
0
void
Home_Servant_Impl<BASE_SKEL,
                  EXEC,
                  COMP_SVNT,
                  CONTAINER>::remove_component (
                      ::Components::CCMObject_ptr comp)
{
    CIAO_TRACE ("Home_Servant_Impl<>::remove_component");

    typename CONTAINER::_var_type cnt_safe =
        CONTAINER::_duplicate (this->container_.in());
    PortableServer::POA_var poa = cnt_safe->the_POA ();
    PortableServer::ObjectId_var oid = poa->reference_to_id (comp);

    Components::CCMObject_var ccm_obj_var;
    if (objref_map_.find (oid.in (), ccm_obj_var) != 0)
    {
        CIAO_ERROR (1, (LM_WARNING, CLINFO
                        "Home_Servant_Impl<>::remove_component - "
                        "Invalid component object reference\n"));
        throw Components::RemoveFailure ();
    }

    typedef typename COMP_SVNT::_stub_type stub_type;
    typename COMP_SVNT::_stub_var_type _ciao_comp =
        stub_type::_narrow (ccm_obj_var.in ());

    if (::CORBA::is_nil (_ciao_comp.in ()))
    {
        throw Components::RemoveFailure ();
    }
    else
    {
        _ciao_comp->remove ();
    }

    CIAO_DEBUG (6, (LM_INFO, CLINFO
                    "Home_Servant_Impl<>::remove_component - "
                    "Removed the component\n"));
}