diff options
Diffstat (limited to 'TAO/orbsvcs/tests/Notify/lib')
17 files changed, 115 insertions, 46 deletions
diff --git a/TAO/orbsvcs/tests/Notify/lib/Command.cpp b/TAO/orbsvcs/tests/Notify/lib/Command.cpp index a8028672539..f220c45d691 100644 --- a/TAO/orbsvcs/tests/Notify/lib/Command.cpp +++ b/TAO/orbsvcs/tests/Notify/lib/Command.cpp @@ -49,7 +49,7 @@ TAO_Notify_Tests_Command::execute (ACE_ENV_SINGLE_ARG_DECL) ACE_CATCHANY { ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, - ACE_LIB_TEXT("Exception running command\n")); + ACE_LIB_TEXT("Error: Exception running command\n")); } ACE_ENDTRY; } diff --git a/TAO/orbsvcs/tests/Notify/lib/Driver.cpp b/TAO/orbsvcs/tests/Notify/lib/Driver.cpp index f2451726531..8d035608147 100644 --- a/TAO/orbsvcs/tests/Notify/lib/Driver.cpp +++ b/TAO/orbsvcs/tests/Notify/lib/Driver.cpp @@ -98,7 +98,7 @@ TAO_Notify_Tests_Worker::svc (void) } ACE_CATCHANY { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "ORB run error\n"); + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Error: ORB run error\n"); } ACE_ENDTRY; diff --git a/TAO/orbsvcs/tests/Notify/lib/Driver.h b/TAO/orbsvcs/tests/Notify/lib/Driver.h index 1f927ae6927..610e6b02e79 100644 --- a/TAO/orbsvcs/tests/Notify/lib/Driver.h +++ b/TAO/orbsvcs/tests/Notify/lib/Driver.h @@ -19,14 +19,12 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#include "Driver_Base.h" - -#include "tao/ORB.h" - #include "ace/Service_Config.h" #include "ace/Task.h" -#include "ace/SString.h" +#include "tao/ORB.h" + +#include "Driver_Base.h" class TAO_Notify_Tests_Command_Builder; class TAO_Notify_Tests_Activation_Manager; diff --git a/TAO/orbsvcs/tests/Notify/lib/EventChannel_Command.cpp b/TAO/orbsvcs/tests/Notify/lib/EventChannel_Command.cpp index 48933533b09..d1c9c08b71a 100644 --- a/TAO/orbsvcs/tests/Notify/lib/EventChannel_Command.cpp +++ b/TAO/orbsvcs/tests/Notify/lib/EventChannel_Command.cpp @@ -119,7 +119,7 @@ TAO_Notify_Tests_EventChannel_Command::create_collocated_ecf (ACE_ENV_SINGLE_ARG LOOKUP_MANAGER->resolve (naming); - notify_service->init (orb.in () ACE_ENV_ARG_PARAMETER); + notify_service->init_service (orb.in () ACE_ENV_ARG_PARAMETER); ACE_CHECK; // Activate the factory diff --git a/TAO/orbsvcs/tests/Notify/lib/Notify_Test_Client.cpp b/TAO/orbsvcs/tests/Notify/lib/Notify_Test_Client.cpp index 51eee525b4c..c8534f9dfd7 100644 --- a/TAO/orbsvcs/tests/Notify/lib/Notify_Test_Client.cpp +++ b/TAO/orbsvcs/tests/Notify/lib/Notify_Test_Client.cpp @@ -10,7 +10,8 @@ ACE_RCSID (lib, #define NAMING_SERVICE_NAME "NameService" Notify_Test_Client::Notify_Test_Client (void) - : done_ (false) +: num_clients_( 0 ) +, done_( false ) { // @@ Later: accept the inter filter operator as a param. ifgop_ = CosNotifyChannelAdmin::OR_OP; @@ -18,6 +19,10 @@ Notify_Test_Client::Notify_Test_Client (void) Notify_Test_Client::~Notify_Test_Client () { + root_poa_->destroy(1, 1 ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + orb_->destroy(ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; } int @@ -122,19 +127,43 @@ Notify_Test_Client::resolve_Notify_factory (ACE_ENV_SINGLE_ARG_DECL) } int -Notify_Test_Client::ORB_run (void) +Notify_Test_Client::ORB_run (ACE_ENV_SINGLE_ARG_DECL) { - while (!this->done_) - if (this->orb_->work_pending ()) - this->orb_->perform_work (); + while (! is_done()) + { + ACE_Time_Value tv(0, 10 * 1000); + orb_->run(tv ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + } + + ACE_DEBUG((LM_DEBUG, "\nWaiting for stray events...\n")); + + ACE_Time_Value tv(2); + orb_->run(tv ACE_ENV_ARG_PARAMETER); + ACE_CHECK; return 0; } +void Notify_Test_Client::consumer_start (TAO_Notify_Tests_Peer*) +{ + num_clients_++; +} + void -Notify_Test_Client::shutdown (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) +Notify_Test_Client::consumer_done (TAO_Notify_Tests_Peer*) { - this->done_ = true; + int value = --num_clients_; + if ( value == 0 ) + { + this->done_ = true; + } +} + +bool +Notify_Test_Client::is_done (void) const +{ + return this->done_; } CORBA::ORB_ptr @@ -203,10 +232,3 @@ Notify_Test_Client::create_event_channel (const char* cname, return ec._retn (); } - - -CORBA::Boolean& -Notify_Test_Client::done (void) -{ - return this->done_; -} diff --git a/TAO/orbsvcs/tests/Notify/lib/Notify_Test_Client.h b/TAO/orbsvcs/tests/Notify/lib/Notify_Test_Client.h index 60a1e436d08..a5c22670efc 100644 --- a/TAO/orbsvcs/tests/Notify/lib/Notify_Test_Client.h +++ b/TAO/orbsvcs/tests/Notify/lib/Notify_Test_Client.h @@ -16,11 +16,15 @@ #ifndef NOTIFY_TEST_CLIENT_H #define NOTIFY_TEST_CLIENT_H +#include "ace/Atomic_Op_T.h" +#include "ace/Thread_Mutex.h" #include "orbsvcs/CosNotifyChannelAdminS.h" #include "orbsvcs/CosNotifyCommC.h" #include "orbsvcs/CosNamingC.h" #include "notify_test_export.h" +class TAO_Notify_Tests_Peer; + class TAO_NOTIFY_TEST_Export Notify_Test_Client { // = TITLE @@ -39,13 +43,16 @@ public: virtual int parse_args (int argc, char* argv[]); // Allow the user to override this empty method - int ORB_run (void); + int ORB_run (ACE_ENV_SINGLE_ARG_DECL); // Call ORB::run to accept requests. - void shutdown (ACE_ENV_SINGLE_ARG_DECL); - // Shutdown the ORB + void consumer_start (TAO_Notify_Tests_Peer*); + // How many clients will call consumer_done. + + void consumer_done (TAO_Notify_Tests_Peer*); + // Callback for clients to unregister themselves. - CORBA::Boolean& done (void); + bool is_done (void) const; // Access the done boolean. CORBA::ORB_ptr orb (void); @@ -101,8 +108,9 @@ protected: CosNotification::AdminProperties initial_admin_; // Initial admin props specified to the factory when creating the EC. - CORBA::Boolean done_; - // Set when we should shutdown. +private: + ACE_Atomic_Op< ACE_Thread_Mutex, int > num_clients_; + bool done_; }; #endif /* NOTIFY_TEST_CLIENT_H */ diff --git a/TAO/orbsvcs/tests/Notify/lib/Options_Parser.cpp b/TAO/orbsvcs/tests/Notify/lib/Options_Parser.cpp index 0710a60cf9e..86df51f8a20 100644 --- a/TAO/orbsvcs/tests/Notify/lib/Options_Parser.cpp +++ b/TAO/orbsvcs/tests/Notify/lib/Options_Parser.cpp @@ -1,7 +1,6 @@ // $Id$ #include "Options_Parser.h" -#include "ace/Log_Msg.h" ACE_RCSID (lib, TAO_Options_Parser, @@ -104,7 +103,7 @@ TAO_Notify_Tests_Options_Parser::execute (CosNotification::QoSProperties& qos, A NotifyExt::ThreadPoolLanesParams tpl_params; tpl_params.priority_model = NotifyExt::CLIENT_PROPAGATED; - tpl_params.server_priority = default_priority, + tpl_params.server_priority = default_priority; tpl_params.stacksize = 0; tpl_params.lanes.length (lanecount); tpl_params.allow_borrowing = 0; diff --git a/TAO/orbsvcs/tests/Notify/lib/Peer_T.cpp b/TAO/orbsvcs/tests/Notify/lib/Peer_T.cpp index c078bdc6c35..e013bd44de0 100644 --- a/TAO/orbsvcs/tests/Notify/lib/Peer_T.cpp +++ b/TAO/orbsvcs/tests/Notify/lib/Peer_T.cpp @@ -46,6 +46,8 @@ TAO_Notify_Tests_Peer_T<Peer_Traits>::connect (Proxy_Traits_PTR proxy, Proxy_Traits_ID proxy_id ACE_ENV_ARG_DECL) { + // This will decr the ref count on exit. + // Clients of this class should use raw pointers, not vars. PortableServer::ServantBase_var servant_var (this); ACE_TYPENAME Peer_Traits::VAR peer_var = @@ -53,6 +55,7 @@ TAO_Notify_Tests_Peer_T<Peer_Traits>::connect (Proxy_Traits_PTR proxy, ACE_CHECK; this->connect_to_peer (proxy, peer_var.in () ACE_ENV_ARG_PARAMETER); + ACE_CHECK; // save the proxy this->proxy_ = Proxy_Traits_INTERFACE::_duplicate (proxy); @@ -64,7 +67,6 @@ TAO_Notify_Tests_Peer_T<Peer_Traits>::connect (Proxy_Traits_PTR proxy, LOOKUP_MANAGER->_register (this->proxy_.in (), this->proxy_name_.c_str () ACE_ENV_ARG_PARAMETER); - ACE_CHECK; } } @@ -84,6 +86,7 @@ TAO_Notify_Tests_Peer_T<Peer_Traits>::connect (Admin_Traits_PTR admin_ptr this->connect (proxy_var.in (), this->proxy_id_ ACE_ENV_ARG_PARAMETER); + ACE_CHECK; } @@ -169,14 +172,14 @@ TAO_Notify_Tests_Peer_T<Peer_Traits>::status (ACE_ENV_SINGLE_ARG_DECL) } ACE_CATCH(CORBA::TRANSIENT, ex) { - ACE_PRINT_EXCEPTION (ex, ""); + ACE_PRINT_EXCEPTION (ex, "Error: "); ACE_DEBUG ((LM_DEBUG, "Peer %s is_equivalent transient exception.", this->name_.c_str ())); } ACE_CATCHANY { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, ""); + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Error: "); ACE_DEBUG ((LM_DEBUG, "Peer %s is_equivanent other exception.", this->name_.c_str ())); @@ -193,10 +196,31 @@ TAO_Notify_Tests_Peer_T<Peer_Traits>::disconnect (ACE_ENV_SINGLE_ARG_DECL) { ACE_ASSERT (!CORBA::is_nil (this->proxy_.in ())); - this->disconnect_from_proxy (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; + ACE_TRY + { + this->disconnect_from_proxy (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + } + ACE_CATCHANY + { + ACE_DEBUG ((LM_DEBUG, + "Peer %s failed to disconnect from proxy.", + this->name_.c_str ())); + } + ACE_ENDTRY; - this->deactivate (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY + { + this->deactivate (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + } + ACE_CATCHANY + { + ACE_DEBUG ((LM_DEBUG, + "Peer %s failed to deactivate.", + this->name_.c_str ())); + } + ACE_ENDTRY; } template <class Peer_Traits> diff --git a/TAO/orbsvcs/tests/Notify/lib/Periodic_Supplier.cpp b/TAO/orbsvcs/tests/Notify/lib/Periodic_Supplier.cpp index fbefb088c45..88674c5d26d 100644 --- a/TAO/orbsvcs/tests/Notify/lib/Periodic_Supplier.cpp +++ b/TAO/orbsvcs/tests/Notify/lib/Periodic_Supplier.cpp @@ -327,12 +327,12 @@ TAO_Notify_Tests_Periodic_Supplier::svc (void) ACE_CATCH (CORBA::UserException, ue) { ACE_PRINT_EXCEPTION (ue, - "Periodic supplier: error sending event. "); + "Error: Periodic supplier: error sending event. "); } ACE_CATCH (CORBA::SystemException, se) { ACE_PRINT_EXCEPTION (se, - "Periodic supplier: error sending event. "); + "Error: Periodic supplier: error sending event. "); } ACE_ENDTRY; diff --git a/TAO/orbsvcs/tests/Notify/lib/PushConsumer.cpp b/TAO/orbsvcs/tests/Notify/lib/PushConsumer.cpp index 5446630cc11..eb8655d9f84 100644 --- a/TAO/orbsvcs/tests/Notify/lib/PushConsumer.cpp +++ b/TAO/orbsvcs/tests/Notify/lib/PushConsumer.cpp @@ -32,6 +32,7 @@ TAO_Notify_Tests_PushConsumer::connect_to_peer (Proxy_Traits::PTR proxy_ptr, Pee void TAO_Notify_Tests_PushConsumer::disconnect_from_proxy (ACE_ENV_SINGLE_ARG_DECL) { + ACE_DEBUG((LM_DEBUG, "\nPush Consumer disconnecting from supplier.\n")); this->proxy_->disconnect_push_supplier (ACE_ENV_SINGLE_ARG_PARAMETER); } @@ -39,7 +40,9 @@ void TAO_Notify_Tests_PushConsumer::disconnect_push_consumer (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { - this->deactivate (ACE_ENV_SINGLE_ARG_PARAMETER); + bool this_method_used_only_by_notify_service = false; + ACE_ASSERT(this_method_used_only_by_notify_service); + ACE_UNUSED_ARG(this_method_used_only_by_notify_service); } void diff --git a/TAO/orbsvcs/tests/Notify/lib/PushSupplier.cpp b/TAO/orbsvcs/tests/Notify/lib/PushSupplier.cpp index 94be0657439..eae01f04313 100644 --- a/TAO/orbsvcs/tests/Notify/lib/PushSupplier.cpp +++ b/TAO/orbsvcs/tests/Notify/lib/PushSupplier.cpp @@ -41,6 +41,7 @@ TAO_Notify_Tests_PushSupplier::connect_to_peer (Proxy_Traits::PTR proxy_ptr, Pee void TAO_Notify_Tests_PushSupplier::disconnect_from_proxy (ACE_ENV_SINGLE_ARG_DECL) { + ACE_DEBUG((LM_DEBUG, "\nPush Supplier disconnecting from consumer.\n")); this->proxy_->disconnect_push_consumer (ACE_ENV_SINGLE_ARG_PARAMETER); } @@ -48,7 +49,9 @@ void TAO_Notify_Tests_PushSupplier::disconnect_push_supplier (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { - this->deactivate (ACE_ENV_SINGLE_ARG_PARAMETER); + bool this_method_used_only_by_notify_service = false; + ACE_ASSERT(this_method_used_only_by_notify_service); + ACE_UNUSED_ARG(this_method_used_only_by_notify_service); } #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) diff --git a/TAO/orbsvcs/tests/Notify/lib/SequencePushConsumer.cpp b/TAO/orbsvcs/tests/Notify/lib/SequencePushConsumer.cpp index e8fc625a688..4b7cc341eaf 100644 --- a/TAO/orbsvcs/tests/Notify/lib/SequencePushConsumer.cpp +++ b/TAO/orbsvcs/tests/Notify/lib/SequencePushConsumer.cpp @@ -33,6 +33,7 @@ TAO_Notify_Tests_SequencePushConsumer::connect_to_peer (Proxy_Traits::PTR proxy_ void TAO_Notify_Tests_SequencePushConsumer::disconnect_from_proxy (ACE_ENV_SINGLE_ARG_DECL) { + ACE_DEBUG((LM_DEBUG, "\nPush Consumer disconnecting from supplier.\n")); this->proxy_->disconnect_sequence_push_supplier (ACE_ENV_SINGLE_ARG_PARAMETER); } @@ -40,7 +41,9 @@ void TAO_Notify_Tests_SequencePushConsumer::disconnect_sequence_push_consumer (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { - this->deactivate (ACE_ENV_SINGLE_ARG_PARAMETER); + bool this_method_used_only_by_notify_service = false; + ACE_ASSERT(this_method_used_only_by_notify_service); + ACE_UNUSED_ARG(this_method_used_only_by_notify_service); } void diff --git a/TAO/orbsvcs/tests/Notify/lib/SequencePushSupplier.cpp b/TAO/orbsvcs/tests/Notify/lib/SequencePushSupplier.cpp index 5cf499aea62..a86df08fa35 100644 --- a/TAO/orbsvcs/tests/Notify/lib/SequencePushSupplier.cpp +++ b/TAO/orbsvcs/tests/Notify/lib/SequencePushSupplier.cpp @@ -43,6 +43,7 @@ TAO_Notify_Tests_SequencePushSupplier::connect_to_peer (Proxy_Traits::PTR proxy_ void TAO_Notify_Tests_SequencePushSupplier::disconnect_from_proxy (ACE_ENV_SINGLE_ARG_DECL) { + ACE_DEBUG((LM_DEBUG, "\nPush Supplier disconnecting from consumer.\n")); this->proxy_->disconnect_sequence_push_consumer (ACE_ENV_SINGLE_ARG_PARAMETER); } @@ -50,7 +51,9 @@ void TAO_Notify_Tests_SequencePushSupplier::disconnect_sequence_push_supplier (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { - this->deactivate (ACE_ENV_SINGLE_ARG_PARAMETER); + bool this_method_used_only_by_notify_service = false; + ACE_ASSERT(this_method_used_only_by_notify_service); + ACE_UNUSED_ARG(this_method_used_only_by_notify_service); } diff --git a/TAO/orbsvcs/tests/Notify/lib/StructuredPushConsumer.cpp b/TAO/orbsvcs/tests/Notify/lib/StructuredPushConsumer.cpp index 38eaa5b62ad..540ff8474f0 100644 --- a/TAO/orbsvcs/tests/Notify/lib/StructuredPushConsumer.cpp +++ b/TAO/orbsvcs/tests/Notify/lib/StructuredPushConsumer.cpp @@ -33,6 +33,7 @@ TAO_Notify_Tests_StructuredPushConsumer::connect_to_peer (Proxy_Traits::PTR prox void TAO_Notify_Tests_StructuredPushConsumer::disconnect_from_proxy (ACE_ENV_SINGLE_ARG_DECL) { + ACE_DEBUG((LM_DEBUG, "\nPush Consumer disconnecting from supplier.\n")); this->proxy_->disconnect_structured_push_supplier (ACE_ENV_SINGLE_ARG_PARAMETER); } @@ -40,7 +41,9 @@ void TAO_Notify_Tests_StructuredPushConsumer::disconnect_structured_push_consumer (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { - this->deactivate (ACE_ENV_SINGLE_ARG_PARAMETER); + bool this_method_used_only_by_notify_service = false; + ACE_ASSERT(this_method_used_only_by_notify_service); + ACE_UNUSED_ARG(this_method_used_only_by_notify_service); } void diff --git a/TAO/orbsvcs/tests/Notify/lib/StructuredPushSupplier.cpp b/TAO/orbsvcs/tests/Notify/lib/StructuredPushSupplier.cpp index 69108f5a51a..a6f3f9e8a71 100644 --- a/TAO/orbsvcs/tests/Notify/lib/StructuredPushSupplier.cpp +++ b/TAO/orbsvcs/tests/Notify/lib/StructuredPushSupplier.cpp @@ -44,6 +44,7 @@ TAO_Notify_Tests_StructuredPushSupplier::connect_to_peer (Proxy_Traits::PTR prox void TAO_Notify_Tests_StructuredPushSupplier::disconnect_from_proxy (ACE_ENV_SINGLE_ARG_DECL) { + ACE_DEBUG((LM_DEBUG, "\nPush Supplier disconnecting from consumer.\n")); this->proxy_->disconnect_structured_push_consumer (ACE_ENV_SINGLE_ARG_PARAMETER); } @@ -51,7 +52,9 @@ void TAO_Notify_Tests_StructuredPushSupplier::disconnect_structured_push_supplier (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { - this->deactivate (ACE_ENV_SINGLE_ARG_PARAMETER); + bool this_method_used_only_by_notify_service = false; + ACE_ASSERT(this_method_used_only_by_notify_service); + ACE_UNUSED_ARG(this_method_used_only_by_notify_service); } #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) diff --git a/TAO/orbsvcs/tests/Notify/lib/Task_Callback.h b/TAO/orbsvcs/tests/Notify/lib/Task_Callback.h index f494b02ef16..5cef5b953b6 100644 --- a/TAO/orbsvcs/tests/Notify/lib/Task_Callback.h +++ b/TAO/orbsvcs/tests/Notify/lib/Task_Callback.h @@ -31,7 +31,6 @@ class TAO_Notify_Tests_Periodic_Consumer; class TAO_NOTIFY_TEST_Export TAO_Notify_Tests_Task_Callback { public: - virtual ~TAO_Notify_Tests_Task_Callback (void) {} virtual void done (TAO_Notify_Tests_Periodic_Supplier* supplier) = 0; virtual void done (TAO_Notify_Tests_Periodic_Consumer* consumer) = 0; }; diff --git a/TAO/orbsvcs/tests/Notify/lib/Task_Stats.inl b/TAO/orbsvcs/tests/Notify/lib/Task_Stats.inl index 3be923f7f73..1f1fd62aed5 100644 --- a/TAO/orbsvcs/tests/Notify/lib/Task_Stats.inl +++ b/TAO/orbsvcs/tests/Notify/lib/Task_Stats.inl @@ -9,7 +9,8 @@ Task_Stats::diff_sec (ACE_UINT64 before, ACE_UINT64 after) #if defined ACE_LACKS_LONGLONG_T (after - before) / gsf_; #else /* ! ACE_LACKS_LONGLONG_T */ - static_cast<double> (ACE_UINT64_DBLCAST_ADAPTER((after - before) / gsf_)); + ACE_static_cast (double, + ACE_UINT64_DBLCAST_ADAPTER((after - before) / gsf_)); #endif /* ! ACE_LACKS_LONGLONG_T */ seconds /= ACE_HR_SCALE_CONVERSION; |