diff options
10 files changed, 491 insertions, 278 deletions
diff --git a/CIAO/ChangeLog b/CIAO/ChangeLog index e5bb3dc13d7..e27a1b19268 100644 --- a/CIAO/ChangeLog +++ b/CIAO/ChangeLog @@ -1,3 +1,19 @@ +Mon Feb 8 11:15:00 UTC 2010 Marcel Smit <msmit@remedy.nl> + + + * connectors/dds4ccm/tests/CSLQoS/Receiver/CSL_QoSTest_Receiver_exec.h: + * connectors/dds4ccm/tests/CSLQoS/Receiver/CSL_QoSTest_Receiver_exec.cpp: + * connectors/dds4ccm/tests/CSLUnexpStat/Receiver/CSL_USTest_Receiver_exec.h: + * connectors/dds4ccm/tests/CSLUnexpStat/Receiver/CSL_USTest_Receiver_exec.cpp: + Added test scenario for thread switch. + + * connectors/dds4ccm/tests/CSLDeadline/Receiver/CSL_DeadlineTest_Receiver_exec.cpp: + * connectors/dds4ccm/tests/CSLSampleRejected/Receiver/CSL_SRTest_Receiver_exec.cpp: + * connectors/dds4ccm/tests/ListenOneByOne/Receiver/LOBO_Test_Receiver_exec.cpp: + * connectors/dds4ccm/tests/PSLSampleLost/Receiver/PSL_SampleLost_Receiver_exec.cpp: + * connectors/dds4ccm/tests/SLOneByOne/Receiver/SL_OneByOne_Receiver_exec.cpp: + Optimized logging regarding thread switch test. + Mon Feb 8 10:56:43 UTC 2010 Johnny Willemsen <jwillemsen@remedy.nl> * connectors/ami4ccm/examples/Hello/Sender/Hello_Sender.mpc: diff --git a/CIAO/connectors/dds4ccm/tests/CSLDeadline/Receiver/CSL_DeadlineTest_Receiver_exec.cpp b/CIAO/connectors/dds4ccm/tests/CSLDeadline/Receiver/CSL_DeadlineTest_Receiver_exec.cpp index 887c7d3cf7b..004084982bf 100644 --- a/CIAO/connectors/dds4ccm/tests/CSLDeadline/Receiver/CSL_DeadlineTest_Receiver_exec.cpp +++ b/CIAO/connectors/dds4ccm/tests/CSLDeadline/Receiver/CSL_DeadlineTest_Receiver_exec.cpp @@ -184,30 +184,49 @@ namespace CIAO_CSL_DeadlineTest_Receiver_Impl ACE_TEXT ("'on_offered_deadline_missed' in Receiver\n") )); } + if (this->thread_id_listener_.value () == 0) + { + ACE_ERROR ((LM_ERROR, "ERROR: " + "Thread ID for ConnectorStatusListener not set!\n")); + } #if defined (CIAO_DDS4CCM_CONTEXT_SWITCH) && (CIAO_DDS4CCM_CONTEXT_SWITCH == 1) - if (this->thread_id_listener_.value () == 0) - { - ACE_ERROR ((LM_ERROR, "ERROR: " - "Thread ID for ConnectorStatusListener not set!\n")); - } - else if (ACE_OS::thr_equal (this->thread_id_listener_.value (), - ACE_Thread::self ())) - { - ACE_ERROR ((LM_ERROR, "ERROR: " - "Thread switch for ConnectorStatusListener " - "doesn't seem to work! " - "listener <%u> - component <%u>\n", - this->thread_id_listener_.value (), - ACE_Thread::self ())); - } - else - { - ACE_DEBUG ((LM_DEBUG, "OK : " - "Thread switch for ConnectorStatusListener seems OK. " - "listener <%u> - component <%u>\n", - this->thread_id_listener_.value (), - ACE_Thread::self ())); - } + else if (ACE_OS::thr_equal (this->thread_id_listener_.value (), + ACE_Thread::self ())) + { + ACE_DEBUG ((LM_DEBUG, "OK : " + "Thread switch for ConnectorStatusListener seems OK. " + "(DDS uses the CCM thread for its callback) " + "listener <%u> - component <%u>\n", + this->thread_id_listener_.value (), + ACE_Thread::self ())); + } + else + { + ACE_ERROR ((LM_ERROR, "ERROR: " + "Thread switch for ConnectorStatusListener " + "doesn't seem to work! " + "listener <%u> - component <%u>\n", + this->thread_id_listener_.value (), + ACE_Thread::self ())); + } + #else + else if (ACE_OS::thr_equal (this->thread_id_listener_.value (), + ACE_Thread::self ())) + { + ACE_ERROR ((LM_ERROR, "ERROR: ConnectorStatusListener: " + "DDS seems to use a CCM thread for its callback: " + "listener <%u> - component <%u>\n", + this->thread_id_listener_.value (), + ACE_Thread::self ())); + } + else + { + ACE_DEBUG ((LM_DEBUG, "OK : ConnectorStatusListener: " + "DDS seems to use its own thread for its callback: " + "listener <%u> - component <%u>\n", + this->thread_id_listener_.value (), + ACE_Thread::self ())); + } #endif } diff --git a/CIAO/connectors/dds4ccm/tests/CSLQoS/Receiver/CSL_QoSTest_Receiver_exec.cpp b/CIAO/connectors/dds4ccm/tests/CSLQoS/Receiver/CSL_QoSTest_Receiver_exec.cpp index 84415f26e19..b76005f1dda 100644 --- a/CIAO/connectors/dds4ccm/tests/CSLQoS/Receiver/CSL_QoSTest_Receiver_exec.cpp +++ b/CIAO/connectors/dds4ccm/tests/CSLQoS/Receiver/CSL_QoSTest_Receiver_exec.cpp @@ -11,10 +11,12 @@ namespace CIAO_CSL_QoSTest_Receiver_Impl { //============================================================ - // Facet Executor Implementation Class: ConnectorStatusListener_exec_i + // ConnectorStatusListener_exec_i //============================================================ - ConnectorStatusListener_exec_i::ConnectorStatusListener_exec_i (Atomic_Boolean &incompatible) - : incompatible_ (incompatible) + ConnectorStatusListener_exec_i::ConnectorStatusListener_exec_i (Atomic_Boolean &incompatible, + Atomic_ThreadId &thread_id) + : incompatible_ (incompatible), + thread_id_ (thread_id) { } @@ -24,44 +26,51 @@ namespace CIAO_CSL_QoSTest_Receiver_Impl // Operations from ::CCM_DDS::ConnectorStatusListener void ConnectorStatusListener_exec_i::on_inconsistent_topic( - ::DDS::Topic_ptr /*the_topic*/, - const DDS::InconsistentTopicStatus & /*status*/) - { - } + ::DDS::Topic_ptr /*the_topic*/, + const DDS::InconsistentTopicStatus & /*status*/) + { + } - void ConnectorStatusListener_exec_i::on_requested_incompatible_qos( + void ConnectorStatusListener_exec_i::on_requested_incompatible_qos ( ::DDS::DataReader_ptr the_reader, - const DDS::RequestedIncompatibleQosStatus & /*status*/) { - if(!CORBA::is_nil(the_reader)) - { - this->incompatible_ = true; - } - } - void ConnectorStatusListener_exec_i::on_sample_rejected( - ::DDS::DataReader_ptr /*the_reader*/, - const DDS::SampleRejectedStatus & /*status*/) { - } - - void ConnectorStatusListener_exec_i::on_offered_deadline_missed( - ::DDS::DataWriter_ptr /*the_writer*/, - const DDS::OfferedDeadlineMissedStatus & /*status*/) { - } - - void ConnectorStatusListener_exec_i::on_offered_incompatible_qos( - ::DDS::DataWriter_ptr /*the_writer*/, - const DDS::OfferedIncompatibleQosStatus & /*status*/) { - } - - void ConnectorStatusListener_exec_i::on_unexpected_status( + const DDS::RequestedIncompatibleQosStatus & /*status*/) + { + this->thread_id_ = ACE_Thread::self (); + if(!CORBA::is_nil(the_reader)) + { + this->incompatible_ = true; + } + } + + void ConnectorStatusListener_exec_i::on_sample_rejected ( + ::DDS::DataReader_ptr /*the_reader*/, + const DDS::SampleRejectedStatus & /*status*/) + { + } + + void ConnectorStatusListener_exec_i::on_offered_deadline_missed ( + ::DDS::DataWriter_ptr /*the_writer*/, + const DDS::OfferedDeadlineMissedStatus & /*status*/) + { + } + + void ConnectorStatusListener_exec_i::on_offered_incompatible_qos ( + ::DDS::DataWriter_ptr /*the_writer*/, + const DDS::OfferedIncompatibleQosStatus & /*status*/) + { + } + + void ConnectorStatusListener_exec_i::on_unexpected_status ( ::DDS::Entity_ptr /*the_entity*/, - ::DDS::StatusKind /*status_kind */) { - } + ::DDS::StatusKind /*status_kind */) + { + } //============================================================ - // Facet Executor Implementation Class: TestTopic_RawListener_exec_i + // TestTopic_RawListener_exec_i //============================================================ TestTopic_RawListener_exec_i::TestTopic_RawListener_exec_i (Atomic_ULong &received) - : received_ (received) + : received_ (received) { } @@ -88,40 +97,14 @@ namespace CIAO_CSL_QoSTest_Receiver_Impl const ::CCM_DDS::ReadInfoSeq & /* info */) { } - //============================================================ - // Facet Executor Implementation Class: PortStatusListener_exec_i - //============================================================ - - PortStatusListener_exec_i::PortStatusListener_exec_i (void) - { - } - - PortStatusListener_exec_i::~PortStatusListener_exec_i (void) - { - } - - // Operations from ::CCM_DDS::PortStatusListener - - void - PortStatusListener_exec_i::on_requested_deadline_missed ( - ::DDS::DataReader_ptr /* the_reader */, - const ::DDS::RequestedDeadlineMissedStatus & /* status */) - { - } - - void - PortStatusListener_exec_i::on_sample_lost ( - ::DDS::DataReader_ptr /* the_reader */, - const ::DDS::SampleLostStatus & /* status */) - { - } //============================================================ // Component Executor Implementation Class: Receiver_exec_iTestTopic_RawListener_exec_i (); //============================================================ - Receiver_exec_i::Receiver_exec_i (void) - : incompatible_ (false) + : incompatible_ (false), + received_ (0), + thread_id_listener_ (0) { } @@ -129,9 +112,6 @@ namespace CIAO_CSL_QoSTest_Receiver_Impl { } - // Supported operations and attributes. - // Component attributes. - // Port operations. ::CCM_DDS::TestTopic::CCM_Listener_ptr Receiver_exec_i::get_info_out_data_listener (void) { @@ -143,13 +123,14 @@ namespace CIAO_CSL_QoSTest_Receiver_Impl Receiver_exec_i::get_info_out_status (void) { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("new PortStatuslistener\n"))); - return new PortStatusListener_exec_i (); + return ::CCM_DDS::CCM_PortStatusListener::_nil (); } ::CCM_DDS::CCM_ConnectorStatusListener_ptr Receiver_exec_i::get_info_out_connector_status (void) { - return new ConnectorStatusListener_exec_i (this->incompatible_); + return new ConnectorStatusListener_exec_i (this->incompatible_, + this->thread_id_listener_); } // Operations from Components::SessionComponent. @@ -192,7 +173,7 @@ namespace CIAO_CSL_QoSTest_Receiver_Impl void Receiver_exec_i::ccm_remove (void) { - if(!this->incompatible_.value ()) + if (!this->incompatible_.value ()) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("ERROR: did not receive the expected ") ACE_TEXT ("error 'on_requested_incompatible_Qos' in Receiver\n") @@ -200,10 +181,54 @@ namespace CIAO_CSL_QoSTest_Receiver_Impl } else { - ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("Received the expected ") + ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("OK : Received the expected ") ACE_TEXT ("'on_requested_incompatible_Qos' in Receiver\n") )); } + if (this->thread_id_listener_.value () == 0) + { + ACE_ERROR ((LM_ERROR, "ERROR: " + "Thread ID for ConnectorStatusListener not set!\n")); + } + #if defined (CIAO_DDS4CCM_CONTEXT_SWITCH) && (CIAO_DDS4CCM_CONTEXT_SWITCH == 1) + else if (ACE_OS::thr_equal (this->thread_id_listener_.value (), + ACE_Thread::self ())) + { + ACE_DEBUG ((LM_DEBUG, "OK : " + "Thread switch for ConnectorStatusListener seems OK. " + "(DDS uses the CCM thread for its callback) " + "listener <%u> - component <%u>\n", + this->thread_id_listener_.value (), + ACE_Thread::self ())); + } + else + { + ACE_ERROR ((LM_ERROR, "ERROR: " + "Thread switch for ConnectorStatusListener " + "doesn't seem to work! " + "listener <%u> - component <%u>\n", + this->thread_id_listener_.value (), + ACE_Thread::self ())); + } + #else + else if (ACE_OS::thr_equal (this->thread_id_listener_.value (), + ACE_Thread::self ())) + { + ACE_ERROR ((LM_ERROR, "ERROR: ConnectorStatusListener: " + "DDS seems to use a CCM thread for its callback: " + "listener <%u> - component <%u>\n", + this->thread_id_listener_.value (), + ACE_Thread::self ())); + } + else + { + ACE_DEBUG ((LM_DEBUG, "OK : ConnectorStatusListener: " + "DDS seems to use its own thread for its callback: " + "listener <%u> - component <%u>\n", + this->thread_id_listener_.value (), + ACE_Thread::self ())); + } + #endif } extern "C" RECEIVER_EXEC_Export ::Components::EnterpriseComponent_ptr diff --git a/CIAO/connectors/dds4ccm/tests/CSLQoS/Receiver/CSL_QoSTest_Receiver_exec.h b/CIAO/connectors/dds4ccm/tests/CSLQoS/Receiver/CSL_QoSTest_Receiver_exec.h index d99f0b3df24..c7757593c67 100644 --- a/CIAO/connectors/dds4ccm/tests/CSLQoS/Receiver/CSL_QoSTest_Receiver_exec.h +++ b/CIAO/connectors/dds4ccm/tests/CSLQoS/Receiver/CSL_QoSTest_Receiver_exec.h @@ -13,16 +13,21 @@ #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "tao/LocalObject.h" -#include "ace/Task.h" +#include "ace/OS_NS_Thread.h" #include "ace/Reactor.h" +#include "ace/Task.h" namespace CIAO_CSL_QoSTest_Receiver_Impl { typedef ACE_Atomic_Op <TAO_SYNCH_MUTEX, CORBA::ULong > Atomic_ULong; typedef ACE_Atomic_Op <TAO_SYNCH_MUTEX, CORBA::Boolean > Atomic_Boolean; - + typedef ACE_Atomic_Op <TAO_SYNCH_MUTEX, ACE_thread_t> Atomic_ThreadId; + class Receiver_exec_i; - + + //============================================================ + // TestTopic_RawListener_exec_i + //============================================================ class RECEIVER_EXEC_Export TestTopic_RawListener_exec_i : public virtual ::CCM_DDS::TestTopic::CCM_Listener, public virtual ::CORBA::LocalObject @@ -30,7 +35,7 @@ namespace CIAO_CSL_QoSTest_Receiver_Impl public: TestTopic_RawListener_exec_i (Atomic_ULong &); virtual ~TestTopic_RawListener_exec_i (void); - + virtual void on_one_data ( const TestTopic & an_instance, @@ -39,61 +44,50 @@ namespace CIAO_CSL_QoSTest_Receiver_Impl virtual void on_many_data ( const ::TestTopic_Seq & data, - const ::CCM_DDS::ReadInfoSeq & info ); + const ::CCM_DDS::ReadInfoSeq & info); private: Atomic_ULong &received_; }; - -class RECEIVER_EXEC_Export ConnectorStatusListener_exec_i + + //============================================================ + // ConnectorStatusListener_exec_i + //============================================================ + class RECEIVER_EXEC_Export ConnectorStatusListener_exec_i : public virtual ::CCM_DDS::CCM_ConnectorStatusListener, public virtual ::CORBA::LocalObject { public: - ConnectorStatusListener_exec_i (Atomic_Boolean &); + ConnectorStatusListener_exec_i (Atomic_Boolean &, + Atomic_ThreadId &); virtual ~ConnectorStatusListener_exec_i (void); - + virtual - void on_inconsistent_topic( ::DDS::Topic_ptr the_topic, + void on_inconsistent_topic (::DDS::Topic_ptr the_topic, const DDS::InconsistentTopicStatus & status); virtual - void on_requested_incompatible_qos( ::DDS::DataReader_ptr the_reader, + void on_requested_incompatible_qos (::DDS::DataReader_ptr the_reader, const DDS::RequestedIncompatibleQosStatus & status); virtual - void on_sample_rejected( ::DDS::DataReader_ptr the_reader, + void on_sample_rejected (::DDS::DataReader_ptr the_reader, const DDS::SampleRejectedStatus & status); virtual - void on_offered_deadline_missed( ::DDS::DataWriter_ptr the_writer, + void on_offered_deadline_missed (::DDS::DataWriter_ptr the_writer, const DDS::OfferedDeadlineMissedStatus & status); virtual - void on_offered_incompatible_qos( ::DDS::DataWriter_ptr the_writer, + void on_offered_incompatible_qos (::DDS::DataWriter_ptr the_writer, const DDS::OfferedIncompatibleQosStatus & status); virtual - void on_unexpected_status( ::DDS::Entity_ptr the_entity, + void on_unexpected_status (::DDS::Entity_ptr the_entity, ::DDS::StatusKind status_kind); - private: + private: Atomic_Boolean &incompatible_; - }; - -class RECEIVER_EXEC_Export PortStatusListener_exec_i - : public virtual ::CCM_DDS::CCM_PortStatusListener, - public virtual ::CORBA::LocalObject - { - public: - PortStatusListener_exec_i (void); - virtual ~PortStatusListener_exec_i (void); - - virtual void - on_requested_deadline_missed ( - ::DDS::DataReader_ptr the_reader, - const ::DDS::RequestedDeadlineMissedStatus & status); - - virtual void - on_sample_lost ( - ::DDS::DataReader_ptr the_reader, - const ::DDS::SampleLostStatus & status); + Atomic_ThreadId &thread_id_; }; + //============================================================ + // Receiver_exec_i + //============================================================ class RECEIVER_EXEC_Export Receiver_exec_i : public virtual Receiver_Exec, public virtual ::CORBA::LocalObject @@ -126,6 +120,7 @@ class RECEIVER_EXEC_Export PortStatusListener_exec_i ::CSL_QoSTest::CCM_Receiver_Context_var context_; Atomic_ULong received_; Atomic_Boolean incompatible_; + Atomic_ThreadId thread_id_listener_; }; extern "C" RECEIVER_EXEC_Export ::Components::EnterpriseComponent_ptr diff --git a/CIAO/connectors/dds4ccm/tests/CSLSampleRejected/Receiver/CSL_SRTest_Receiver_exec.cpp b/CIAO/connectors/dds4ccm/tests/CSLSampleRejected/Receiver/CSL_SRTest_Receiver_exec.cpp index 85a6ff92afb..ecc74fd4da5 100644 --- a/CIAO/connectors/dds4ccm/tests/CSLSampleRejected/Receiver/CSL_SRTest_Receiver_exec.cpp +++ b/CIAO/connectors/dds4ccm/tests/CSLSampleRejected/Receiver/CSL_SRTest_Receiver_exec.cpp @@ -308,31 +308,49 @@ namespace CIAO_CSL_SRTest_Receiver_Impl ACE_TEXT ("warning 'on_sample_rejected' in the Receiver\n") )); } - + if (this->thread_id_listener_.value () == 0) + { + ACE_ERROR ((LM_ERROR, "ERROR: " + "Thread ID for ConnectorStatusListener not set!\n")); + } #if defined (CIAO_DDS4CCM_CONTEXT_SWITCH) && (CIAO_DDS4CCM_CONTEXT_SWITCH == 1) - if (this->thread_id_listener_.value () == 0) - { - ACE_ERROR ((LM_ERROR, "ERROR: " - "Thread ID for ConnectorStatusListener not set!\n")); - } - else if (ACE_OS::thr_equal (this->thread_id_listener_.value (), - ACE_Thread::self ())) - { - ACE_ERROR ((LM_ERROR, "ERROR: " - "Thread switch for ConnectorStatusListener " - "doesn't seem to work! " - "listener <%u> - component <%u>\n", - this->thread_id_listener_.value (), - ACE_Thread::self ())); - } - else - { - ACE_DEBUG ((LM_DEBUG, "OK : " - "Thread switch for ConnectorStatusListener seems OK. " - "listener <%u> - component <%u>\n", - this->thread_id_listener_.value (), - ACE_Thread::self ())); - } + else if (ACE_OS::thr_equal (this->thread_id_listener_.value (), + ACE_Thread::self ())) + { + ACE_DEBUG ((LM_DEBUG, "OK : " + "Thread switch for ConnectorStatusListener seems OK. " + "(DDS uses the CCM thread for its callback) " + "listener <%u> - component <%u>\n", + this->thread_id_listener_.value (), + ACE_Thread::self ())); + } + else + { + ACE_ERROR ((LM_ERROR, "ERROR: " + "Thread switch for ConnectorStatusListener " + "doesn't seem to work! " + "listener <%u> - component <%u>\n", + this->thread_id_listener_.value (), + ACE_Thread::self ())); + } + #else + else if (ACE_OS::thr_equal (this->thread_id_listener_.value (), + ACE_Thread::self ())) + { + ACE_ERROR ((LM_ERROR, "ERROR: ConnectorStatusListener: " + "DDS seems to use a CCM thread for its callback: " + "listener <%u> - component <%u>\n", + this->thread_id_listener_.value (), + ACE_Thread::self ())); + } + else + { + ACE_DEBUG ((LM_DEBUG, "OK : ConnectorStatusListener: " + "DDS seems to use its own thread for its callback: " + "listener <%u> - component <%u>\n", + this->thread_id_listener_.value (), + ACE_Thread::self ())); + } #endif } diff --git a/CIAO/connectors/dds4ccm/tests/CSLUnexpStat/Receiver/CSL_USTest_Receiver_exec.cpp b/CIAO/connectors/dds4ccm/tests/CSLUnexpStat/Receiver/CSL_USTest_Receiver_exec.cpp index 5e8879ffd05..c8f47e5d7a1 100644 --- a/CIAO/connectors/dds4ccm/tests/CSLUnexpStat/Receiver/CSL_USTest_Receiver_exec.cpp +++ b/CIAO/connectors/dds4ccm/tests/CSLUnexpStat/Receiver/CSL_USTest_Receiver_exec.cpp @@ -14,11 +14,14 @@ namespace CIAO_CSL_USTest_Receiver_Impl { //============================================================ - // Facet Executor Implementation Class: ConnectorStatusListener_exec_i + // ConnectorStatusListener_exec_i //============================================================ - ConnectorStatusListener_exec_i::ConnectorStatusListener_exec_i (Atomic_Boolean &unexpected_matched,Atomic_Boolean &unexpected_liveliness) + ConnectorStatusListener_exec_i::ConnectorStatusListener_exec_i (Atomic_Boolean &unexpected_matched, + Atomic_Boolean &unexpected_liveliness, + Atomic_ThreadId &thread_id) : unexpected_matched_ (unexpected_matched), - unexpected_liveliness_ (unexpected_liveliness) + unexpected_liveliness_ (unexpected_liveliness), + thread_id_ (thread_id) { } @@ -27,40 +30,41 @@ namespace CIAO_CSL_USTest_Receiver_Impl } // Operations from ::CCM_DDS::ConnectorStatusListener - void ConnectorStatusListener_exec_i::on_inconsistent_topic( - ::DDS::Topic_ptr /*the_topic*/, - const DDS::InconsistentTopicStatus & /*status*/) + void ConnectorStatusListener_exec_i::on_inconsistent_topic ( + ::DDS::Topic_ptr /*the_topic*/, + const DDS::InconsistentTopicStatus & /*status*/) { } - void ConnectorStatusListener_exec_i::on_requested_incompatible_qos( + void ConnectorStatusListener_exec_i::on_requested_incompatible_qos ( ::DDS::DataReader_ptr /*the_reader*/, - const DDS::RequestedIncompatibleQosStatus & /*status*/) + const DDS::RequestedIncompatibleQosStatus & /*status*/) { } - void ConnectorStatusListener_exec_i::on_sample_rejected( - ::DDS::DataReader_ptr /*the_reader*/, - const DDS::SampleRejectedStatus & /*status*/) + void ConnectorStatusListener_exec_i::on_sample_rejected ( + ::DDS::DataReader_ptr /*the_reader*/, + const DDS::SampleRejectedStatus & /*status*/) { } - void ConnectorStatusListener_exec_i::on_offered_deadline_missed( - ::DDS::DataWriter_ptr /*the_writer*/, - const DDS::OfferedDeadlineMissedStatus & /*status*/) + void ConnectorStatusListener_exec_i::on_offered_deadline_missed ( + ::DDS::DataWriter_ptr /*the_writer*/, + const DDS::OfferedDeadlineMissedStatus & /*status*/) { } - void ConnectorStatusListener_exec_i::on_offered_incompatible_qos( - ::DDS::DataWriter_ptr /*the_writer*/, - const DDS::OfferedIncompatibleQosStatus & /*status*/) + void ConnectorStatusListener_exec_i::on_offered_incompatible_qos ( + ::DDS::DataWriter_ptr /*the_writer*/, + const DDS::OfferedIncompatibleQosStatus & /*status*/) { } - void ConnectorStatusListener_exec_i::on_unexpected_status( + void ConnectorStatusListener_exec_i::on_unexpected_status ( ::DDS::Entity_ptr the_entity, ::DDS::StatusKind status_kind) { + this->thread_id_ = ACE_Thread::self (); CORBA::ULong kind = status_kind; if (!CORBA::is_nil (the_entity) && kind == DDS::SUBSCRIPTION_MATCHED_STATUS) { @@ -73,7 +77,7 @@ namespace CIAO_CSL_USTest_Receiver_Impl } //============================================================ - // Facet Executor Implementation Class: TestTopic_RawListener_exec_i + // TestTopic_RawListener_exec_i //============================================================ TestTopic_RawListener_exec_i::TestTopic_RawListener_exec_i (Atomic_ULong &received) : received_ (received) @@ -105,12 +109,13 @@ namespace CIAO_CSL_USTest_Receiver_Impl } //============================================================ - // Component Executor Implementation Class: Receiver_exec_iTestTopic_RawListener_exec_i (); + // Receiver_exec_i //============================================================ Receiver_exec_i::Receiver_exec_i (void) : unexpected_matched_ (false), unexpected_liveliness_ (false), - received_(0) + received_(0), + thread_id_listener_ (0) { } @@ -118,7 +123,6 @@ namespace CIAO_CSL_USTest_Receiver_Impl { } - // Supported operations and attributes. // Port operations. ::CCM_DDS::CCM_PortStatusListener_ptr Receiver_exec_i::get_info_out_status (void) @@ -137,7 +141,9 @@ namespace CIAO_CSL_USTest_Receiver_Impl ::CCM_DDS::CCM_ConnectorStatusListener_ptr Receiver_exec_i::get_info_out_connector_status (void) { - return new ConnectorStatusListener_exec_i (this->unexpected_matched_,this->unexpected_liveliness_); + return new ConnectorStatusListener_exec_i (this->unexpected_matched_, + this->unexpected_liveliness_, + this->thread_id_listener_); } // Operations from Components::SessionComponent. @@ -156,13 +162,7 @@ namespace CIAO_CSL_USTest_Receiver_Impl void Receiver_exec_i::configuration_complete (void) { - this->reader_ = this->context_->get_connection_info_out_data (); - if (CORBA::is_nil (this->reader_)) - { - ACE_ERROR ((LM_INFO, ACE_TEXT ("Error: Reader is null!\n"))); - throw CORBA::INTERNAL (); - } - } + } void Receiver_exec_i::ccm_activate (void) @@ -197,6 +197,50 @@ namespace CIAO_CSL_USTest_Receiver_Impl ACE_TEXT ("'PUBLICATION_MATCHED_STATUS and LIVELINESS_CHANGED_STATUS' in Receiver\n") )); } + if (this->thread_id_listener_.value () == 0) + { + ACE_ERROR ((LM_ERROR, "ERROR: " + "Thread ID for ConnectorStatusListener not set!\n")); + } + #if defined (CIAO_DDS4CCM_CONTEXT_SWITCH) && (CIAO_DDS4CCM_CONTEXT_SWITCH == 1) + else if (ACE_OS::thr_equal (this->thread_id_listener_.value (), + ACE_Thread::self ())) + { + ACE_DEBUG ((LM_DEBUG, "OK : " + "Thread switch for ConnectorStatusListener seems OK. " + "(DDS uses the CCM thread for its callback) " + "listener <%u> - component <%u>\n", + this->thread_id_listener_.value (), + ACE_Thread::self ())); + } + else + { + ACE_ERROR ((LM_ERROR, "ERROR: " + "Thread switch for ConnectorStatusListener " + "doesn't seem to work! " + "listener <%u> - component <%u>\n", + this->thread_id_listener_.value (), + ACE_Thread::self ())); + } + #else + else if (ACE_OS::thr_equal (this->thread_id_listener_.value (), + ACE_Thread::self ())) + { + ACE_ERROR ((LM_ERROR, "ERROR: ConnectorStatusListener: " + "DDS seems to use a CCM thread for its callback: " + "listener <%u> - component <%u>\n", + this->thread_id_listener_.value (), + ACE_Thread::self ())); + } + else + { + ACE_DEBUG ((LM_DEBUG, "OK : ConnectorStatusListener: " + "DDS seems to use its own thread for its callback: " + "listener <%u> - component <%u>\n", + this->thread_id_listener_.value (), + ACE_Thread::self ())); + } + #endif } extern "C" RECEIVER_EXEC_Export ::Components::EnterpriseComponent_ptr diff --git a/CIAO/connectors/dds4ccm/tests/CSLUnexpStat/Receiver/CSL_USTest_Receiver_exec.h b/CIAO/connectors/dds4ccm/tests/CSLUnexpStat/Receiver/CSL_USTest_Receiver_exec.h index cf81e4723cb..89522a574cb 100644 --- a/CIAO/connectors/dds4ccm/tests/CSLUnexpStat/Receiver/CSL_USTest_Receiver_exec.h +++ b/CIAO/connectors/dds4ccm/tests/CSLUnexpStat/Receiver/CSL_USTest_Receiver_exec.h @@ -20,8 +20,13 @@ namespace CIAO_CSL_USTest_Receiver_Impl { typedef ACE_Atomic_Op <TAO_SYNCH_MUTEX, CORBA::ULong > Atomic_ULong; typedef ACE_Atomic_Op <TAO_SYNCH_MUTEX, CORBA::Boolean > Atomic_Boolean; + typedef ACE_Atomic_Op <TAO_SYNCH_MUTEX, ACE_thread_t> Atomic_ThreadId; + class Receiver_exec_i; + //============================================================ + // TestTopic_RawListener_exec_i + //============================================================ class RECEIVER_EXEC_Export TestTopic_RawListener_exec_i : public virtual ::CCM_DDS::TestTopic::CCM_Listener, public virtual ::CORBA::LocalObject @@ -44,12 +49,17 @@ namespace CIAO_CSL_USTest_Receiver_Impl Atomic_ULong &received_; }; -class RECEIVER_EXEC_Export ConnectorStatusListener_exec_i + //============================================================ + // ConnectorStatusListener_exec_i + //============================================================ + class RECEIVER_EXEC_Export ConnectorStatusListener_exec_i : public virtual ::CCM_DDS::CCM_ConnectorStatusListener, public virtual ::CORBA::LocalObject { public: - ConnectorStatusListener_exec_i (Atomic_Boolean &,Atomic_Boolean &); + ConnectorStatusListener_exec_i (Atomic_Boolean &, + Atomic_Boolean &, + Atomic_ThreadId &); virtual ~ConnectorStatusListener_exec_i (void); virtual @@ -74,8 +84,12 @@ class RECEIVER_EXEC_Export ConnectorStatusListener_exec_i private: Atomic_Boolean &unexpected_matched_; Atomic_Boolean &unexpected_liveliness_; + Atomic_ThreadId &thread_id_; }; + //============================================================ + // Receiver_exec_i + //============================================================ class RECEIVER_EXEC_Export Receiver_exec_i : public virtual Receiver_Exec, public virtual ::CORBA::LocalObject @@ -108,10 +122,11 @@ class RECEIVER_EXEC_Export ConnectorStatusListener_exec_i private: ::CSL_USTest::CCM_Receiver_Context_var context_; + Atomic_Boolean unexpected_matched_; Atomic_Boolean unexpected_liveliness_; Atomic_ULong received_; - ::CCM_DDS::TestTopic::Reader_var reader_; + Atomic_ThreadId thread_id_listener_; }; extern "C" RECEIVER_EXEC_Export ::Components::EnterpriseComponent_ptr diff --git a/CIAO/connectors/dds4ccm/tests/ListenOneByOne/Receiver/LOBO_Test_Receiver_exec.cpp b/CIAO/connectors/dds4ccm/tests/ListenOneByOne/Receiver/LOBO_Test_Receiver_exec.cpp index 7cd7a7ef037..f3e9a1429bd 100644 --- a/CIAO/connectors/dds4ccm/tests/ListenOneByOne/Receiver/LOBO_Test_Receiver_exec.cpp +++ b/CIAO/connectors/dds4ccm/tests/ListenOneByOne/Receiver/LOBO_Test_Receiver_exec.cpp @@ -263,31 +263,50 @@ namespace CIAO_LOBO_Test_Receiver_Impl "one_by_one callback. " "Test passed!\n")); } + if (this->thread_id_listener_.value () == 0) + { + ACE_ERROR ((LM_ERROR, "ERROR: " + "Thread ID for ReaderListener not set!\n")); + } #if defined (CIAO_DDS4CCM_CONTEXT_SWITCH) && (CIAO_DDS4CCM_CONTEXT_SWITCH == 1) - if (this->thread_id_listener_.value () == 0) - { - ACE_ERROR ((LM_ERROR, "ERROR: " - "Thread ID for ReaderListener not set!\n")); - } - else if (ACE_OS::thr_equal (this->thread_id_listener_.value (), - ACE_Thread::self ())) - { - ACE_ERROR ((LM_ERROR, "ERROR: ONE_BY_ONE: " - "Thread switch for ReaderListener " - "doesn't seem to work! " - "listener <%u> - component <%u>\n", - this->thread_id_listener_.value (), - ACE_Thread::self ())); - } - else - { - ACE_DEBUG ((LM_DEBUG, "ONE_BY_ONE: " - "Thread switch for ReaderListener seems OK. " - "listener <%u> - component <%u>\n", - this->thread_id_listener_.value (), - ACE_Thread::self ())); - } - #endif + else if (ACE_OS::thr_equal (this->thread_id_listener_.value (), + ACE_Thread::self ())) + { + ACE_DEBUG ((LM_DEBUG, "ONE_BY_ONE: " + "Thread switch for ReaderListener seems OK. " + "(DDS uses the CCM thread for its callback) " + "listener <%u> - component <%u>\n", + this->thread_id_listener_.value (), + ACE_Thread::self ())); + } + else + { + ACE_ERROR ((LM_ERROR, "ERROR: ONE_BY_ONE: " + "Thread switch for ReaderListener " + "doesn't seem to work! " + "listener <%u> - component <%u>\n", + this->thread_id_listener_.value (), + ACE_Thread::self ())); + } + #else + else if (ACE_OS::thr_equal (this->thread_id_listener_.value (), + ACE_Thread::self ())) + { + ACE_ERROR ((LM_ERROR, "ERROR: ONE_BY_ONE: ReaderListener: " + "DDS seems to use a CCM thread for its callback: " + "listener <%u> - component <%u>\n", + this->thread_id_listener_.value (), + ACE_Thread::self ())); + } + else + { + ACE_DEBUG ((LM_DEBUG, "ONE_BY_ONE: ReaderListener: " + "DDS seems to use its own thread for its callback: " + "listener <%u> - component <%u>\n", + this->thread_id_listener_.value (), + ACE_Thread::self ())); + } + #endif } extern "C" RECEIVER_EXEC_Export ::Components::EnterpriseComponent_ptr diff --git a/CIAO/connectors/dds4ccm/tests/PSLSampleLost/Receiver/PSL_SampleLost_Receiver_exec.cpp b/CIAO/connectors/dds4ccm/tests/PSLSampleLost/Receiver/PSL_SampleLost_Receiver_exec.cpp index bd5dfd60294..8472532f2e8 100644 --- a/CIAO/connectors/dds4ccm/tests/PSLSampleLost/Receiver/PSL_SampleLost_Receiver_exec.cpp +++ b/CIAO/connectors/dds4ccm/tests/PSLSampleLost/Receiver/PSL_SampleLost_Receiver_exec.cpp @@ -337,53 +337,96 @@ namespace CIAO_PSL_SampleLost_Receiver_Impl ACE_TEXT ("'on_sample_lost' in on DDS_Listen and DDS_GET port Receiver\n") )); } + //check thread switch for listener 1 + if (this->thread_id_listener_1_.value () == 0) + { + ACE_ERROR ((LM_ERROR, "ERROR: " + "Thread ID for PortStatusListener I not set!\n")); + } #if defined (CIAO_DDS4CCM_CONTEXT_SWITCH) && (CIAO_DDS4CCM_CONTEXT_SWITCH == 1) - if (this->thread_id_listener_1_.value () == 0) - { - ACE_ERROR ((LM_ERROR, "ERROR: " - "Thread ID for PortStatusListener I not set!\n")); - } - else if (ACE_OS::thr_equal (this->thread_id_listener_1_.value (), - ACE_Thread::self ())) - { - ACE_ERROR ((LM_ERROR, "ERROR: " - "Thread switch for PortStatusListener I " - "doesn't seem to work! " - "listener <%u> - component <%u>\n", - this->thread_id_listener_1_.value (), - ACE_Thread::self ())); - } - else - { - ACE_DEBUG ((LM_DEBUG, "OK : " - "Thread switch for PortStatusListener I seems OK. " - "listener <%u> - component <%u>\n", - this->thread_id_listener_1_.value (), - ACE_Thread::self ())); - } - if (this->thread_id_listener_2_.value () == 0) - { - ACE_ERROR ((LM_ERROR, "ERROR: " - "Thread ID for PortStatusListener II not set!\n")); - } - else if (ACE_OS::thr_equal (this->thread_id_listener_2_.value (), - ACE_Thread::self ()) - { - ACE_ERROR ((LM_ERROR, "ERROR: " - "Thread switch for PortStatusListener II " - "doesn't seem to work! " - "listener <%u> - component <%u>\n", - this->thread_id_listener_2_.value (), - ACE_Thread::self ())); - } - else - { - ACE_DEBUG ((LM_DEBUG, "OK : " - "Thread switch for PortStatusListener II seems OK. " - "listener <%u> - component <%u>\n", - this->thread_id_listener_2_.value (), - ACE_Thread::self ())); - } + else if (ACE_OS::thr_equal (this->thread_id_listener_1_.value (), + ACE_Thread::self ())) + { + ACE_DEBUG ((LM_DEBUG, "OK : " + "Thread switch for PortStatusListener I seems OK. " + "(DDS uses the CCM thread for its callback) " + "listener <%u> - component <%u>\n", + this->thread_id_listener_1_.value (), + ACE_Thread::self ())); + } + else + { + ACE_ERROR ((LM_ERROR, "ERROR: " + "Thread switch for PortStatusListener I " + "doesn't seem to work! " + "listener <%u> - component <%u>\n", + this->thread_id_listener_1_.value (), + ACE_Thread::self ())); + } + #else + else if (ACE_OS::thr_equal (this->thread_id_listener_1_.value (), + ACE_Thread::self ())) + { + ACE_ERROR ((LM_ERROR, "ERROR: PortStatusListener I: " + "DDS seems to use a CCM thread for its callback: " + "listener <%u> - component <%u>\n", + this->thread_id_listener_1_.value (), + ACE_Thread::self ())); + } + else + { + ACE_DEBUG ((LM_DEBUG, "OK : PortStatusListener I: " + "DDS seems to use its own thread for its callback: " + "listener <%u> - component <%u>\n", + this->thread_id_listener_1_.value (), + ACE_Thread::self ())); + } + #endif + + //check thread switch for listener 2 + if (this->thread_id_listener_2_.value () == 0) + { + ACE_ERROR ((LM_ERROR, "ERROR: " + "Thread ID for PortStatusListener II not set!\n")); + } + #if defined (CIAO_DDS4CCM_CONTEXT_SWITCH) && (CIAO_DDS4CCM_CONTEXT_SWITCH == 1) + else if (ACE_OS::thr_equal (this->thread_id_listener_2_.value (), + ACE_Thread::self ())) + { + ACE_DEBUG ((LM_DEBUG, "OK : " + "Thread switch for PortStatusListener II seems OK. " + "(DDS uses the CCM thread for its callback) " + "listener <%u> - component <%u>\n", + this->thread_id_listener_2_.value (), + ACE_Thread::self ())); + } + else + { + ACE_ERROR ((LM_ERROR, "ERROR: " + "Thread switch for PortStatusListener II " + "doesn't seem to work! " + "listener <%u> - component <%u>\n", + this->thread_id_listener_2_.value (), + ACE_Thread::self ())); + } + #else + else if (ACE_OS::thr_equal (this->thread_id_listener_2_.value (), + ACE_Thread::self ())) + { + ACE_ERROR ((LM_ERROR, "ERROR: PortStatusListener II: " + "DDS seems to use a CCM thread for its callback: " + "listener <%u> - component <%u>\n", + this->thread_id_listener_2_.value (), + ACE_Thread::self ())); + } + else + { + ACE_DEBUG ((LM_DEBUG, "OK : PortStatusListener II: " + "DDS seems to use its own thread for its callback: " + "listener <%u> - component <%u>\n", + this->thread_id_listener_2_.value (), + ACE_Thread::self ())); + } #endif } diff --git a/CIAO/connectors/dds4ccm/tests/SLOneByOne/Receiver/SL_OneByOne_Receiver_exec.cpp b/CIAO/connectors/dds4ccm/tests/SLOneByOne/Receiver/SL_OneByOne_Receiver_exec.cpp index 415f2e4f0d4..06e5b301e0b 100644 --- a/CIAO/connectors/dds4ccm/tests/SLOneByOne/Receiver/SL_OneByOne_Receiver_exec.cpp +++ b/CIAO/connectors/dds4ccm/tests/SLOneByOne/Receiver/SL_OneByOne_Receiver_exec.cpp @@ -281,30 +281,49 @@ namespace CIAO_SL_OneByOne_Receiver_Impl ACE_TEXT (" operations for ONE_BY_ONE from StateListener in Receiver\n") )); } + if (this->thread_id_listener_.value () == 0) + { + ACE_ERROR ((LM_ERROR, "ERROR: " + "Thread ID for StatusListener not set!\n")); + } #if defined (CIAO_DDS4CCM_CONTEXT_SWITCH) && (CIAO_DDS4CCM_CONTEXT_SWITCH == 1) - if (this->thread_id_listener_.value () == 0) - { - ACE_ERROR ((LM_ERROR, "ERROR: " - "Thread ID for StatusListener not set!\n")); - } - else if (ACE_OS::thr_equal (this->thread_id_listener_.value (), - ACE_Thread::self ())) - { - ACE_ERROR ((LM_ERROR, "ERROR: " - "Thread switch for StatusListener " - "doesn't seem to work! " - "listener <%u> - component <%u>\n", - this->thread_id_listener_.value (), - ACE_Thread::self ())); - } - else - { - ACE_DEBUG ((LM_DEBUG, "OK : " - "Thread switch for StatusListener seems OK. " - "listener <%u> - component <%u>\n", - this->thread_id_listener_.value (), - ACE_Thread::self ())); - } + else if (ACE_OS::thr_equal (this->thread_id_listener_.value (), + ACE_Thread::self ())) + { + ACE_DEBUG ((LM_DEBUG, "OK : " + "Thread switch for StatusListener seems OK. " + "(DDS uses the CCM thread for its callback) " + "listener <%u> - component <%u>\n", + this->thread_id_listener_.value (), + ACE_Thread::self ())); + } + else + { + ACE_ERROR ((LM_ERROR, "ERROR: " + "Thread switch for StatusListener " + "doesn't seem to work! " + "listener <%u> - component <%u>\n", + this->thread_id_listener_.value (), + ACE_Thread::self ())); + } + #else + else if (ACE_OS::thr_equal (this->thread_id_listener_.value (), + ACE_Thread::self ())) + { + ACE_ERROR ((LM_ERROR, "ERROR: StatusListener: " + "DDS seems to use a CCM thread for its callback: " + "listener <%u> - component <%u>\n", + this->thread_id_listener_.value (), + ACE_Thread::self ())); + } + else + { + ACE_DEBUG ((LM_DEBUG, "OK : StatusListener: " + "DDS seems to use its own thread for its callback: " + "listener <%u> - component <%u>\n", + this->thread_id_listener_.value (), + ACE_Thread::self ())); + } #endif } |