void
AsyncListManager::init_list (void)
{
  CORBA::ULong len =
    static_cast<CORBA::ULong> (this->repo_->servers ().current_size ());
  Locator_Repository::SIMap::ENTRY* entry = 0;
  Locator_Repository::SIMap::CONST_ITERATOR it (this->repo_->servers ());
  this->server_list_.length (len);
  this->waiters_ = 0;
  for (CORBA::ULong i = 0; i < len; i++)
    {
      it.next (entry);
      it.advance ();

      Server_Info_Ptr info = entry->int_id_;
      info->setImRInfo (&this->server_list_[i]);
      if (this->pinger_ != 0)
        {
          ListLiveListener *l = 0;
          ACE_NEW (l, ListLiveListener (info->ping_id (),
                                        info->pid,
                                        i,
                                        this,
                                        *this->pinger_));

          LiveListener_ptr llp (l);
          if (!l->start ())
            {
              this->server_list_[i].activeStatus =
                ImplementationRepository::ACTIVE_NO;
              l->cancel ();
            }
          else
            {
              if (!evaluate_status (i, l->status(), info->pid))
                {
                  this->waiters_++;
                }
              else
                {
                  l->cancel ();
                }
            }
        }
     }

  if (ImR_Locator_i::debug() > 4)
    {
      ORBSVCS_DEBUG ((LM_DEBUG,
                      ACE_TEXT ("(%P|%t) AsyncListManager(%@)::init_list, %d waiters")
                      ACE_TEXT (" out of %d regsitered servers\n"),
                      this, this->waiters_, len));
    }
}
void
ImR_Locator_i::server_is_running
(ImplementationRepository::AMH_AdministrationResponseHandler_ptr _tao_rh,
 const char* id,
 const char* partial_ior,
 ImplementationRepository::ServerObject_ptr server_object)
{
  if (debug_ > 0)
    {
      ORBSVCS_DEBUG ((LM_DEBUG,
                      ACE_TEXT ("(%P|%t) ImR: Server %C is running at %C.\n"),
                      id, partial_ior));
    }
  CORBA::String_var sior = orb_->object_to_string (server_object);

  if (debug_ > 1)
    {
      ORBSVCS_DEBUG ((LM_DEBUG,
                      ACE_TEXT ("(%P|%t) ImR: Server %C callback at %C.\n"),
                      id, sior.in ()));
    }

  if (this->opts_->unregister_if_address_reused ())
    this->repository_->unregister_if_address_reused (id, partial_ior, this);

  CORBA::Object_var obj = this->set_timeout_policy (server_object, this->opts_->ping_timeout ());
  ImplementationRepository::ServerObject_var srvobj =
    ImplementationRepository::ServerObject::_narrow (obj.in());

  UpdateableServerInfo info (this->repository_, id);
  if (info.null ())
    {
      if (debug_ > 0)
        {
          ORBSVCS_DEBUG ((LM_DEBUG,
                      ACE_TEXT ("(%P|%t) ImR: Auto adding NORMAL server <%C>.\n"),
                          id));
        }

      Server_Info_Ptr si;
      if (this->repository_->add_server (id, partial_ior, sior.in (), srvobj.in ()) == 0)
        {
          si = this->repository_->get_active_server (id);
        }

      if (si.null ())
        {
          if (debug_ > 0)
            {
              ORBSVCS_DEBUG ((LM_DEBUG,
                              ACE_TEXT ("(%P|%t) ImR: Auto adding failed, giving up <%C>\n"),
                              id));
            }
          CORBA::NO_MEMORY ex;
          ImplementationRepository::AMH_AdministrationExceptionHolder h (ex._tao_duplicate());
          _tao_rh->server_is_running_excep (&h);
          return;
        }
      info.server_info (si);
      this->pinger_.add_server (si->ping_id (), this->opts_->ping_external (), srvobj.in());

      ACE_GUARD (TAO_SYNCH_MUTEX, mon, this->lock_);
      AsyncAccessManager_ptr aam (this->create_aam (info, true));
    }
  else
    {
      if (!info->is_mode(ImplementationRepository::PER_CLIENT))
        {
          info.edit ()->set_contact (partial_ior, sior.in(), srvobj.in());

          info.update_repo();
          this->pinger_.add_server (info->ping_id(), true, srvobj.in());
        }

      AsyncAccessManager_ptr aam(this->find_aam (info->ping_id ()));
      if (!aam.is_nil())
        {
          if (ImR_Locator_i::debug () > 4)
            {
              ORBSVCS_DEBUG ((LM_DEBUG,
                              ACE_TEXT ("(%P|%t) ImR_Locator_i::server_is_running aam is not nil\n")));
            }
          aam->server_is_running (partial_ior, srvobj.in());
        }
      else
        {
          if (ImR_Locator_i::debug () > 4)
            {
              ORBSVCS_DEBUG ((LM_DEBUG,
                              ACE_TEXT ("(%P|%t) ImR_Locator_i::server_is_running aam is nil\n")));
            }
          if (!info->is_mode(ImplementationRepository::PER_CLIENT))
            {
              ACE_GUARD (TAO_SYNCH_MUTEX, mon, this->lock_);
              aam = this->create_aam (info, true);
            }
        }
    }
  _tao_rh->server_is_running ();
}