コード例 #1
0
void
ImR_Locator_i::shutdown
(ImplementationRepository::AMH_AdministrationResponseHandler_ptr _tao_rh,
 CORBA::Boolean activators, CORBA::Boolean servers)
{
  this->pinger_.shutdown ();
  this->aam_active_.reset ();
  this->aam_terminating_.reset ();
  if (servers != 0 && this->repository_->servers ().current_size () > 0)
    {
      // Note : shutdown is oneway, so we can't throw
      ORBSVCS_ERROR ((
        LM_ERROR,
        ACE_TEXT ("(%P|%t) ImR: Shutdown of all servers not implemented.\n")));
    }
  if (activators != 0 && this->repository_->activators ().current_size () > 0)
    {
      ACE_Vector<ImplementationRepository::Activator_var> acts;
      Locator_Repository::AIMap::ENTRY* entry = 0;
      Locator_Repository::AIMap::ITERATOR it (this->repository_->activators ());
      for (;it.next (entry) != 0; it.advance ())
        {
          Activator_Info_Ptr info = entry->int_id_;
          ACE_ASSERT (! info.null ());
          this->connect_activator (*info);
          if (! CORBA::is_nil (info->activator.in ()))
            acts.push_back (info->activator);
        }

      int shutdown_errs = 0;

      for (size_t i = 0; i < acts.size (); ++i)
        {
          try
            {
              acts[i]->shutdown ();
              acts[i] = ImplementationRepository::Activator::_nil ();
            }
          catch (const CORBA::Exception& ex)
            {
              ++shutdown_errs;
              if (debug_ > 1)
                {
                  ex._tao_print_exception (
                    ACE_TEXT ("(%P|%t) ImR: shutdown activator"));
                }
            }
        }
      if (debug_ > 0 && shutdown_errs > 0)
        {
          ORBSVCS_DEBUG (( LM_DEBUG,
                           ACE_TEXT ("(%P|%t) ImR: Some activators could not be shut down.\n")));
        }
    }
  // Technically, we should wait for all the activators to unregister, but
  // ,for now at least, it doesn't seem worth it.
  this->shutdown (false);

  _tao_rh->shutdown ();
}
コード例 #2
0
ファイル: IIOP_Endpoint.cpp プロジェクト: asdlei00/ACE
// local helper function for TAO_IIOP_Endpoint::find_preferred_interfaces
static void
TAO_IIOP_Endpoint_none_duplicate_insert (
  const ACE_CString &value,
  ACE_Vector<ACE_CString> &vector)
{
  bool found= false;
  for (size_t x= 0u; x < vector.size (); ++x)
    if (vector[x] == value)
      {
        found= true;
        break;
      }
  if (!found)
    vector.push_back (value);
}
コード例 #3
0
ファイル: Process.cpp プロジェクト: Bootz/SkyFire_one
wchar_t*
ACE_Process::convert_env_buffer (const char* env) const
{
  // Total starts out at 1 due to the final block nul terminator
  size_t total = 1;

  // Convert each individual character string to the equivalent wide
  // character string.
  ACE_Vector<wchar_t*> buffer;
  size_t start = 0;
  size_t i = 0;
  while (true)
    {
      if (env[i] == '\0')
        {
          // Convert the char string to wchar_t
          wchar_t* str = ACE_Ascii_To_Wide::convert (env + start);

          // Add the length of the string plus the nul terminator
          total += ACE_OS::strlen (str) + 1;

          // Save it and set up for the next string
          buffer.push_back (str);
          start = ++i;
          if (env[start] == '\0')
            break;
        }
      else
        {
          i += ACE_OS::strlen (env + i);
        }
    }

  // Copy each string into the buffer leaving a nul terminator between
  // each string and adding a second nul terminator at the end
  start = 0;
  wchar_t* wenv = new wchar_t[total];
  size_t length = buffer.size ();
  for (i = 0; i < length; ++i)
    {
      ACE_OS::strcpy(wenv + start, buffer[i]);
      start += ACE_OS::strlen (buffer[i]) + 1;
      delete [] buffer[i];
    }
  wenv[start] = 0;
  return wenv;
}
コード例 #4
0
ファイル: IIOP_Endpoint.cpp プロジェクト: asdlei00/ACE
// local helper function for TAO_IIOP_Endpoint::find_preferred_interfaces
static void
TAO_IIOP_Endpoint_get_ip_interfaces (ACE_Vector<ACE_CString> &local_ips)
{
  ACE_INET_Addr* tmp = 0;
  size_t cnt = 0u;
  int err = ACE::get_ip_interfaces (cnt, tmp);
  if (err != 0)
    return;
#if defined (ACE_HAS_IPV6)
  char buf[64];
#else /* ACE_HAS_IPV6 */
  char buf[32];
#endif /* !ACE_HAS_IPV6 */
  for (size_t i = 0u; i < cnt; ++i)
  {
    const char *s_if = tmp[i].get_host_addr (buf, sizeof (buf));
    ACE_ASSERT (s_if != 0);
    ACE_CString tmp (s_if);
    local_ips.push_back (tmp);
  }
  delete[] tmp;
}
コード例 #5
0
ファイル: PG_FactoryRegistry.cpp プロジェクト: binary42/OCI
void TAO::PG_FactoryRegistry::unregister_factory_by_location (
    const PortableGroup::Location & location)
{
  METHOD_ENTRY(TAO::PG_FactoryRegistry::unregister_factory_by_location);

  ////////////////////////////////////////////
  // a vector of roles that need to be deleted.
  ACE_Vector<ACE_CString> emptyRoles;

  // iterate through the registery
  for (RegistryType_Iterator it = this->registry_.begin();
       it != this->registry_.end();
       ++it)
  {
    RegistryType_Entry & entry = *it;
    ACE_CString & role = entry.ext_id_;
    RoleInfo * role_info =  entry.int_id_;

    PortableGroup::FactoryInfos & infos = role_info->infos_;
    // ORBSVCS_ERROR((LM_INFO,  "unregister_factory_by_location: Checking role %s\n", role.c_str()  ));

    int found = 0;
    CORBA::ULong length = infos.length();
    for (CORBA::ULong nInfo = 0u; !found && nInfo < length; ++nInfo)
    {
      PortableGroup::FactoryInfo & info = infos[nInfo];
      if (info.the_location == location)
      {

        ORBSVCS_ERROR((LM_INFO,
          "%s: Unregister_factory_by_location: Removing: [%d] %s@%s\n",
          this->identity_.c_str(),
          static_cast<int> (nInfo),
          role.c_str(),
          static_cast<const char *> (location[0].id)
          ));
        found = 1;
        if (length > 1)
        {
          while (nInfo + 1 < length)
          {
            ORBSVCS_ERROR((LM_INFO,
              "%s: Unregister_factory_by_location: Move: [%d] %s to [%d]\n",
              this->identity_.c_str(),
              (int)nInfo + 1, role.c_str(), (int)nInfo
              ));
            infos[nInfo] = infos[nInfo + 1];
            nInfo += 1;
          }
          ORBSVCS_ERROR((LM_INFO,
            "%s: unregister_factory_by_location: New length [%d] %s\n",
            this->identity_.c_str(),
            (int)nInfo, role.c_str()
            ));
          infos.length(nInfo);
        }
        else
        {
          ORBSVCS_ERROR((LM_INFO,
            "%s: Removed all entries for %s\n",
            this->identity_.c_str(),
            role.c_str()
            ));
          ACE_ASSERT ( length == 1 );
          // remember entries to be deleted
          emptyRoles.push_back(entry.ext_id_);
        }
      }
    }
  }

  // now remove any roles that became empty

  for (size_t nRole = 0; nRole < emptyRoles.size(); ++nRole)
  {
    ORBSVCS_ERROR((LM_INFO,
      "%s: Remove role %s\n",
      this->identity_.c_str(),
      emptyRoles[nRole].c_str()
      ));
    RoleInfo * role_info;
    if (this->registry_.unbind(emptyRoles[nRole], role_info) == 0)
    {
      delete role_info;
    }
    else
    {
      ORBSVCS_ERROR ((LM_ERROR,
        "%s: LOGIC ERROR AT " __FILE__ " (%d): Role to be deleted disappeared\n",
        this->identity_.c_str(),
        __LINE__));
    }
  }
  //////////////////////////
  // If all types are gone...
  if (registry_.current_size() == 0 && quit_state_ == LIVE)
  {
    ORBSVCS_ERROR(( LM_INFO,
      "%s is idle\n",
      identity()
      ));
    if (quit_on_idle_)
    {
        this->poa_->deactivate_object (this->object_id_.in ());
        quit_state_ = DEACTIVATED;
    }
  }

  METHOD_RETURN(TAO::PG_FactoryRegistry::unregister_factory_by_location);
}