Exemplo n.º 1
0
DCPS_IR_Topic::~DCPS_IR_Topic()
{
  // check for remaining publication references
  if (0 != publicationRefs_.size()) {
    DCPS_IR_Publication* pub = 0;
    DCPS_IR_Publication_Set::ITERATOR iter = publicationRefs_.begin();
    DCPS_IR_Publication_Set::ITERATOR end = publicationRefs_.end();

    OpenDDS::DCPS::RepoIdConverter topic_converter(id_);
    ACE_ERROR((LM_ERROR,
               ACE_TEXT("(%P|%t) ERROR: DCPS_IR_Topic::~DCPS_IR_Topic: ")
               ACE_TEXT("id %C has retained publications.\n"),
               std::string(topic_converter).c_str()));

    while (iter != end) {
      pub = *iter;
      ++iter;

      OpenDDS::DCPS::RepoIdConverter pub_converter(pub->get_id());
      ACE_ERROR((LM_ERROR,
                 ACE_TEXT("(%P|%t) ERROR: DCPS_IR_Topic::~DCPS_IR_Topic: ")
                 ACE_TEXT("topic %C retains publication id %C.\n"),
                 std::string(topic_converter).c_str(),
                 std::string(pub_converter).c_str()));
    }
  }

  if (0 != subscriptionRefs_.size()) {
    DCPS_IR_Subscription* sub = 0;
    DCPS_IR_Subscription_Set::ITERATOR iter = subscriptionRefs_.begin();
    DCPS_IR_Subscription_Set::ITERATOR end = subscriptionRefs_.end();

    OpenDDS::DCPS::RepoIdConverter topic_converter(id_);
    ACE_ERROR((LM_ERROR,
               ACE_TEXT("(%P|%t) ERROR: DCPS_IR_Topic::~DCPS_IR_Topic: ")
               ACE_TEXT("id %C has retained subscriptions.\n"),
               std::string(topic_converter).c_str()));

    while (iter != end) {
      sub = *iter;
      ++iter;

      OpenDDS::DCPS::RepoIdConverter sub_converter(sub->get_id());
      ACE_ERROR((LM_ERROR,
                 ACE_TEXT("(%P|%t) ERROR: DCPS_IR_Topic::~DCPS_IR_Topic: ")
                 ACE_TEXT("topic %C retains subscription id %C.\n"),
                 std::string(topic_converter).c_str(),
                 std::string(sub_converter).c_str()));
    }
  }
}
Exemplo n.º 2
0
void
DCPS_IR_Subscription::reevaluate_defunct_associations()
{
  DCPS_IR_Publication_Set::iterator it(this->defunct_.begin());
  while (it != this->defunct_.end()) {
    DCPS_IR_Publication* publication = *it;
    ++it;

    if (reevaluate_association(publication)) {
      this->defunct_.remove(publication); // no longer defunct

    } else {
      OpenDDS::DCPS::RepoIdConverter sub_converter(id_);
      OpenDDS::DCPS::RepoIdConverter pub_converter(publication->get_id());
      ACE_ERROR((LM_ERROR,
                 ACE_TEXT("(%P|%t) ERROR: DCPS_IR_Subscription::reevaluate_defunct_associations: ")
                 ACE_TEXT("subscription %C failed to reassociate publication %C at %x.\n"),
                 std::string(sub_converter).c_str(),
                 std::string(pub_converter).c_str(),
                 publication));
    }
  }
}
Exemplo n.º 3
0
void DCPS_IR_Subscription::disassociate_publication(OpenDDS::DCPS::RepoId id,
                                                    bool reassociate)
{
  DCPS_IR_Publication* pub = 0;
  size_t numAssociations = associations_.size();
  CORBA::Boolean dontSend = 0;
  CORBA::Boolean send = 1;
  long count = 0;

  if (0 < numAssociations) {
    OpenDDS::DCPS::WriterIdSeq idSeq(static_cast<CORBA::ULong>(numAssociations));
    idSeq.length(static_cast<CORBA::ULong>(numAssociations));

    DCPS_IR_Publication_Set::ITERATOR iter = associations_.begin();
    DCPS_IR_Publication_Set::ITERATOR end = associations_.end();

    while (iter != end) {
      pub = *iter;
      ++iter;

      if (OpenDDS::DCPS::DCPS_debug_level > 0) {
        OpenDDS::DCPS::RepoIdConverter sub_converter(id_);
        OpenDDS::DCPS::RepoIdConverter pub_converter(pub->get_id());
        OpenDDS::DCPS::RepoIdConverter sub_pub_converter(id);
        ACE_DEBUG((LM_DEBUG,
                   ACE_TEXT("(%P|%t) DCPS_IR_Subscription::disassociate_publication: ")
                   ACE_TEXT("subscription %C testing if publication %C == %C.\n"),
                   std::string(sub_converter).c_str(),
                   std::string(pub_converter).c_str(),
                   std::string(sub_pub_converter).c_str()));
      }

      if (id == pub->get_id()) {
        CORBA::Boolean dont_notify_lost = 0;
        pub->remove_associated_subscription(this, send, dont_notify_lost);
        remove_associated_publication(pub, dontSend, dont_notify_lost);

        idSeq[count] = pub->get_id();
        ++count;

        if (reassociate && this->defunct_.insert(pub) != 0) {
          OpenDDS::DCPS::RepoIdConverter sub_converter(id_);
          OpenDDS::DCPS::RepoIdConverter pub_converter(pub->get_id());
          ACE_ERROR((LM_ERROR,
                     ACE_TEXT("(%P|%t) ERROR: DCPS_IR_Subscription::disassociate_publication: ")
                     ACE_TEXT("subscription %C failed to reassociate publication %C at %x.\n"),
                     std::string(sub_converter).c_str(),
                     std::string(pub_converter).c_str(),
                     pub));
        }
      }
    }

    if (0 < count) {
      idSeq.length(count);

      if (participant_->is_alive() && this->participant_->isOwner()) {
        try {
          CORBA::Boolean dont_notify_lost = 0;
          reader_->remove_associations(idSeq, dont_notify_lost);

        } catch (const CORBA::Exception& ex) {
          if (OpenDDS::DCPS::DCPS_debug_level > 0) {
            ex._tao_print_exception(
              "(%P|%t) ERROR: Exception caught in DCPS_IR_Subscription::remove_associations:");
          }

          participant_->mark_dead();
        }
      }
    }
  }
}