diff options
Diffstat (limited to 'CIAO/connectors/dds4ccm')
4 files changed, 53 insertions, 26 deletions
diff --git a/CIAO/connectors/dds4ccm/tests/CoherentWriter/Receiver/CoherentWrite_Test_Receiver_exec.cpp b/CIAO/connectors/dds4ccm/tests/CoherentWriter/Receiver/CoherentWrite_Test_Receiver_exec.cpp index 7ed95179b1c..0138aa5483a 100644 --- a/CIAO/connectors/dds4ccm/tests/CoherentWriter/Receiver/CoherentWrite_Test_Receiver_exec.cpp +++ b/CIAO/connectors/dds4ccm/tests/CoherentWriter/Receiver/CoherentWrite_Test_Receiver_exec.cpp @@ -9,6 +9,8 @@ #include "ace/Reactor.h" #include "ace/Log_Msg.h" +// ::CoherentWriteTestConnector::Reader_var reader_; +// CoherentWriteRestarter_var restarter_; namespace CIAO_CoherentWrite_Test_Receiver_Impl { //============================================================ @@ -81,10 +83,12 @@ namespace CIAO_CoherentWrite_Test_Receiver_Impl { try { + ::CoherentWriteTestConnector::Reader_var reader = + this->context_->get_connection_info_out_data (); CoherentWriteTest coherentwrite_info; ::CCM_DDS::ReadInfo readinfo; coherentwrite_info.symbol = CORBA::string_dup ("KEY_1"); - this->reader_->read_one_last ( + reader->read_one_last ( coherentwrite_info, readinfo, ::DDS::HANDLE_NIL); @@ -109,9 +113,23 @@ namespace CIAO_CoherentWrite_Test_Receiver_Impl { try { + ::CoherentWriteTestConnector::Reader_var reader = + this->context_->get_connection_info_out_data (); + CoherentWriteRestarter_var restarter = + this->context_->get_connection_writer_restart (); + + if (::CORBA::is_nil (reader.in ()) || + ::CORBA::is_nil (restarter.in ())) + { + ACE_ERROR ((LM_ERROR, "Receiver_exec_i::read_all - " + "Unable to read since reader or " + "restarter is nil.\n")); + return; + } + CoherentWriteTestSeq coherentwrite_info_seq; ::CCM_DDS::ReadInfoSeq readinfo_seq; - this->reader_->read_all (coherentwrite_info_seq, readinfo_seq); + reader->read_all (coherentwrite_info_seq, readinfo_seq); for (CORBA::ULong it = 0; it < coherentwrite_info_seq.length (); ++it) { @@ -133,7 +151,7 @@ namespace CIAO_CoherentWrite_Test_Receiver_Impl } if (this->run_ < this->nr_runs () + 1) { - this->restarter_->restart_write (); + restarter->restart_write (); } else { @@ -166,7 +184,9 @@ namespace CIAO_CoherentWrite_Test_Receiver_Impl void Receiver_exec_i::start_read (CORBA::UShort run) { - this->ticker_ = new read_action_Generator (*this, run); + ACE_NEW_THROW_EX (this->ticker_, + read_action_Generator (*this, run), + ::CORBA::INTERNAL ()); if (this->context_->get_CCM_object()->_get_orb ()->orb_core ()->reactor ()->schedule_timer ( this->ticker_, 0, @@ -257,9 +277,7 @@ namespace CIAO_CoherentWrite_Test_Receiver_Impl void Receiver_exec_i::ccm_activate (void) { - this->reader_ = this->context_->get_connection_info_out_data(); - this->restarter_ = this->context_->get_connection_writer_restart (); -} + } void Receiver_exec_i::ccm_passivate (void) diff --git a/CIAO/connectors/dds4ccm/tests/CoherentWriter/Receiver/CoherentWrite_Test_Receiver_exec.h b/CIAO/connectors/dds4ccm/tests/CoherentWriter/Receiver/CoherentWrite_Test_Receiver_exec.h index 116d946f4a5..bcc88af5f8b 100644 --- a/CIAO/connectors/dds4ccm/tests/CoherentWriter/Receiver/CoherentWrite_Test_Receiver_exec.h +++ b/CIAO/connectors/dds4ccm/tests/CoherentWriter/Receiver/CoherentWrite_Test_Receiver_exec.h @@ -104,8 +104,7 @@ namespace CIAO_CoherentWrite_Test_Receiver_Impl private: ::CoherentWrite_Test::CCM_Receiver_Context_var context_; - ::CoherentWriteTestConnector::Reader_var reader_; - CoherentWriteRestarter_var restarter_; + CORBA::UShort iterations_; CORBA::UShort run_; CORBA::UShort nr_runs_; @@ -114,6 +113,7 @@ namespace CIAO_CoherentWrite_Test_Receiver_Impl read_action_Generator *ticker_; void read_all (void); + }; extern "C" RECEIVER_EXEC_Export ::Components::EnterpriseComponent_ptr diff --git a/CIAO/connectors/dds4ccm/tests/CoherentWriter/Sender/CoherentWrite_Test_Sender_exec.cpp b/CIAO/connectors/dds4ccm/tests/CoherentWriter/Sender/CoherentWrite_Test_Sender_exec.cpp index 0c3a464c95d..a26103fac6a 100644 --- a/CIAO/connectors/dds4ccm/tests/CoherentWriter/Sender/CoherentWrite_Test_Sender_exec.cpp +++ b/CIAO/connectors/dds4ccm/tests/CoherentWriter/Sender/CoherentWrite_Test_Sender_exec.cpp @@ -47,7 +47,8 @@ namespace CIAO_CoherentWrite_Test_Sender_Impl Sender_exec_i::Sender_exec_i (void) : iterations_ (3), run_ (1), - total_iter (0) + total_iter (0), + wh_ (0) { } @@ -59,22 +60,31 @@ namespace CIAO_CoherentWrite_Test_Sender_Impl Sender_exec_i::restart (void) { ++this->run_; - WriteHandler *wh = new WriteHandler (*this); - this->context_->get_CCM_object()->_get_orb ()->orb_core ()->reactor ()->notify (wh); + delete this->wh_; + ACE_NEW_THROW_EX (this->wh_, + WriteHandler (*this), + ::CORBA::INTERNAL ()); + this->context_->get_CCM_object()->_get_orb ()->orb_core ()->reactor ()->notify (this->wh_); } void Sender_exec_i::start (void) { - if (! ::CORBA::is_nil (this->starter_)) - { - this->starter_->set_reader_properties (this->iterations_); - } - else + ::CoherentWriteTestConnector::Writer_var writer = + this->context_->get_connection_info_write_data (); + + CoherentWriteStarter_var starter = + this->context_->get_connection_start_reader (); + if (::CORBA::is_nil (starter.in ()) || + ::CORBA::is_nil (writer.in ())) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("ERROR: Unable to start the reader\n"))); + return; } + writer->is_coherent_write (true); + starter->set_reader_properties (this->iterations_); + ACE_DEBUG ((LM_DEBUG, "Start run <%d> with <%u> iterations\n", this->run_, this->iterations ())); @@ -88,11 +98,11 @@ namespace CIAO_CoherentWrite_Test_Sender_Impl new_key.iteration = ++total_iter; write_many_seq[i-1] = new_key; } - this->writer_->write_many (write_many_seq); + writer->write_many (write_many_seq); ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Written <%u> keys uptil now\n"), total_iter)); ACE_OS::sleep (2); - this->starter_->start_read (this->run_); + starter->start_read (this->run_); } ::CORBA::UShort @@ -135,11 +145,10 @@ namespace CIAO_CoherentWrite_Test_Sender_Impl { try { - this->writer_ = this->context_->get_connection_info_write_data (); - this->writer_->is_coherent_write (true); - this->starter_ = this->context_->get_connection_start_reader (); - WriteHandler *wh = new WriteHandler (*this); - this->context_->get_CCM_object()->_get_orb ()->orb_core ()->reactor ()->notify (wh); + ACE_NEW_THROW_EX (this->wh_, + WriteHandler (*this), + ::CORBA::INTERNAL ()); + this->context_->get_CCM_object()->_get_orb ()->orb_core ()->reactor ()->notify (this->wh_); } catch (const CORBA::Exception& ex) { diff --git a/CIAO/connectors/dds4ccm/tests/CoherentWriter/Sender/CoherentWrite_Test_Sender_exec.h b/CIAO/connectors/dds4ccm/tests/CoherentWriter/Sender/CoherentWrite_Test_Sender_exec.h index edef4add79a..00c228b78c6 100644 --- a/CIAO/connectors/dds4ccm/tests/CoherentWriter/Sender/CoherentWrite_Test_Sender_exec.h +++ b/CIAO/connectors/dds4ccm/tests/CoherentWriter/Sender/CoherentWrite_Test_Sender_exec.h @@ -79,12 +79,12 @@ namespace CIAO_CoherentWrite_Test_Sender_Impl private: ::CoherentWrite_Test::CCM_Sender_Context_var context_; - CoherentWriteTestConnector::Writer_var writer_; - CoherentWriteStarter_var starter_; CORBA::UShort iterations_; CORBA::UShort run_; CORBA::ULong total_iter; + + WriteHandler *wh_; }; extern "C" SENDER_EXEC_Export ::Components::EnterpriseComponent_ptr |