From 993ff1e0a7f1b391dc714eda5d570404a20560ad Mon Sep 17 00:00:00 2001 From: dai_y Date: Wed, 28 Oct 2009 23:29:32 +0000 Subject: Wed Oct 28 23:27:02 UTC 2009 Yan Dai --- TAO/ChangeLog | 72 +++++ TAO/MPC/config/negotiate_codesets.mpb | 1 + TAO/MPC/config/notify_monitor_control.mpb | 8 + TAO/MPC/config/tao_notify_service.mpb | 2 +- TAO/docs/notification/monitor.html | 49 +++- TAO/interop-tests/wchar/Client.java | 13 +- TAO/interop-tests/wchar/interop_wchar.mpc | 2 +- TAO/interop-tests/wchar/server.cpp | 21 +- TAO/orbsvcs/Notify_Service/Notify_Service.cpp | 20 ++ TAO/orbsvcs/Notify_Service/Notify_Service.mpc | 6 +- .../orbsvcs/Notify/Any/CosEC_ProxyPushConsumer.cpp | 10 + .../orbsvcs/Notify/Any/CosEC_ProxyPushConsumer.h | 1 + .../orbsvcs/Notify/Any/CosEC_ProxyPushSupplier.cpp | 11 +- .../orbsvcs/Notify/Any/CosEC_ProxyPushSupplier.h | 1 + .../orbsvcs/Notify/Any/ProxyPushConsumer.cpp | 10 + TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushConsumer.h | 2 + .../orbsvcs/Notify/Any/ProxyPushSupplier.cpp | 11 + TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushSupplier.h | 1 + TAO/orbsvcs/orbsvcs/Notify/Buffering_Strategy.cpp | 59 ++++- TAO/orbsvcs/orbsvcs/Notify/Buffering_Strategy.h | 6 + TAO/orbsvcs/orbsvcs/Notify/Builder.cpp | 5 +- TAO/orbsvcs/orbsvcs/Notify/Consumer.h | 11 +- TAO/orbsvcs/orbsvcs/Notify/Consumer.inl | 7 + .../Notify/MonitorControl/MonitorManager.cpp | 24 +- .../orbsvcs/Notify/MonitorControl/MonitorManager.h | 2 + .../NotificationServiceMonitor_i.cpp | 6 + .../MonitorControlExt/MC_Default_Factory.cpp | 26 ++ .../Notify/MonitorControlExt/MC_Default_Factory.h | 11 + .../Notify/MonitorControlExt/MC_Notify_Service.cpp | 6 + .../Notify/MonitorControlExt/MC_Notify_Service.h | 8 + .../MonitorControlExt/MonitorConsumerAdmin.cpp | 117 +++++--- .../MonitorControlExt/MonitorConsumerAdmin.h | 18 +- .../MonitorControlExt/MonitorEventChannel.cpp | 54 ++-- .../MonitorControlExt/MonitorProxyPushSupplier.h | 27 ++ .../MonitorControlExt/MonitorProxySupplier_T.cpp | 164 ++++++++++++ .../MonitorControlExt/MonitorProxySupplier_T.h | 89 +++++++ .../MonitorSequenceProxyPushSupplier.h | 27 ++ .../MonitorStructuredProxyPushSupplier.h | 30 +++ .../MonitorControlExt/NotifyMonitoringExt.idl | 10 +- .../Notify/Sequence/SequenceProxyPushConsumer.cpp | 10 + .../Notify/Sequence/SequenceProxyPushConsumer.h | 1 + .../Notify/Sequence/SequenceProxyPushSupplier.cpp | 9 + .../Notify/Sequence/SequenceProxyPushSupplier.h | 2 + .../Structured/StructuredProxyPushConsumer.cpp | 11 + .../Structured/StructuredProxyPushConsumer.h | 2 + .../Structured/StructuredProxyPushSupplier.cpp | 9 + .../Structured/StructuredProxyPushSupplier.h | 2 + .../Notify/MC/Notify_Structured_Push_Consumer.cpp | 28 ++ .../Notify/MC/Notify_Structured_Push_Consumer.h | 3 + .../tests/Notify/MC/Structured_Consumer.cpp | 30 ++- .../tests/Notify/MC/Structured_Supplier.cpp | 8 +- TAO/orbsvcs/tests/Notify/MC/notify.conf | 1 + TAO/orbsvcs/tests/Notify/MC/run_test.pl | 46 +++- TAO/orbsvcs/tests/Notify/MC/test_monitor.cpp | 294 +++++++++++++++------ .../Notify_Structured_Push_Consumer.cpp | 14 + .../Notify_Structured_Push_Consumer.h | 5 + .../tests/unit/Notify/MC/Statistic/Statistic.cpp | 4 +- TAO/tao/Monitor/Monitor_Types.pidl | 1 + 58 files changed, 1246 insertions(+), 182 deletions(-) create mode 100644 TAO/MPC/config/notify_monitor_control.mpb create mode 100644 TAO/orbsvcs/orbsvcs/Notify/MonitorControlExt/MonitorProxyPushSupplier.h create mode 100644 TAO/orbsvcs/orbsvcs/Notify/MonitorControlExt/MonitorProxySupplier_T.cpp create mode 100644 TAO/orbsvcs/orbsvcs/Notify/MonitorControlExt/MonitorProxySupplier_T.h create mode 100644 TAO/orbsvcs/orbsvcs/Notify/MonitorControlExt/MonitorSequenceProxyPushSupplier.h create mode 100644 TAO/orbsvcs/orbsvcs/Notify/MonitorControlExt/MonitorStructuredProxyPushSupplier.h diff --git a/TAO/ChangeLog b/TAO/ChangeLog index 232e5c9b75f..1d4f8069085 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,75 @@ +Wed Oct 28 23:27:02 UTC 2009 Yan Dai + + * MPC/config/negotiate_codesets.mpb: + * MPC/config/notify_monitor_control.mpb: + * MPC/config/tao_notify_service.mpb: + * docs/notification/monitor.html: + * interop-tests/wchar/Client.java: + * interop-tests/wchar/interop_wchar.mpc: + * interop-tests/wchar/server.cpp: + * orbsvcs/Notify_Service/Notify_Service.cpp: + * orbsvcs/Notify_Service/Notify_Service.mpc: + * orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushConsumer.h: + * orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushConsumer.cpp: + * orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushSupplier.h: + * orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushSupplier.cpp: + * orbsvcs/orbsvcs/Notify/Any/ProxyPushConsumer.h: + * orbsvcs/orbsvcs/Notify/Any/ProxyPushConsumer.cpp: + * orbsvcs/orbsvcs/Notify/Any/ProxyPushSupplier.h: + * orbsvcs/orbsvcs/Notify/Any/ProxyPushSupplier.cpp: + * orbsvcs/orbsvcs/Notify/Buffering_Strategy.h: + * orbsvcs/orbsvcs/Notify/Buffering_Strategy.cpp: + * orbsvcs/orbsvcs/Notify/Builder.cpp: + * orbsvcs/orbsvcs/Notify/Consumer.h: + * orbsvcs/orbsvcs/Notify/Consumer.inl: + * orbsvcs/orbsvcs/Notify/MonitorControl/MonitorManager.h: + * orbsvcs/orbsvcs/Notify/MonitorControl/MonitorManager.cpp: + * orbsvcs/orbsvcs/Notify/MonitorControl/NotificationServiceMonitor_i.cpp: + * orbsvcs/orbsvcs/Notify/MonitorControlExt/MC_Default_Factory.h: + * orbsvcs/orbsvcs/Notify/MonitorControlExt/MC_Default_Factory.cpp: + * orbsvcs/orbsvcs/Notify/MonitorControlExt/MC_Notify_Service.h: + * orbsvcs/orbsvcs/Notify/MonitorControlExt/MC_Notify_Service.cpp: + * orbsvcs/orbsvcs/Notify/MonitorControlExt/MonitorConsumerAdmin.h: + * orbsvcs/orbsvcs/Notify/MonitorControlExt/MonitorConsumerAdmin.cpp: + * orbsvcs/orbsvcs/Notify/MonitorControlExt/MonitorEventChannel.cpp: + * orbsvcs/orbsvcs/Notify/MonitorControlExt/MonitorProxyPushSupplier.h: + * orbsvcs/orbsvcs/Notify/MonitorControlExt/MonitorProxySupplier_T.h: + * orbsvcs/orbsvcs/Notify/MonitorControlExt/MonitorProxySupplier_T.cpp: + * orbsvcs/orbsvcs/Notify/MonitorControlExt/MonitorSequenceProxyPushSupplier.h: + * orbsvcs/orbsvcs/Notify/MonitorControlExt/MonitorStructuredProxyPushSupplier.h: + * orbsvcs/orbsvcs/Notify/MonitorControlExt/NotifyMonitoringExt.idl: + * orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushConsumer.h: + * orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushConsumer.cpp: + * orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushSupplier.h: + * orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushSupplier.cpp: + * orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushConsumer.h: + * orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushConsumer.cpp: + * orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier.h: + * orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier.cpp: + * orbsvcs/tests/Notify/MC/Notify_Structured_Push_Consumer.h: + * orbsvcs/tests/Notify/MC/Notify_Structured_Push_Consumer.cpp: + * orbsvcs/tests/Notify/MC/Structured_Consumer.cpp: + * orbsvcs/tests/Notify/MC/Structured_Supplier.cpp: + * orbsvcs/tests/Notify/MC/notify.conf: + * orbsvcs/tests/Notify/MC/run_test.pl: + * orbsvcs/tests/Notify/MC/test_monitor.cpp: + * orbsvcs/tests/Notify/MT_Dispatching/Notify_Structured_Push_Consumer.h: + * orbsvcs/tests/Notify/MT_Dispatching/Notify_Structured_Push_Consumer.cpp: + * orbsvcs/tests/unit/Notify/MC/Statistic/Statistic.cpp: + * tao/Monitor/Monitor_Types.pidl: + + Merged following changes from OCI made between 1.5a p15 and p16 releases. + + - Added consumer-level queueing statistics to the Notification Service MC. + - Added queue-overflow statistics to the Notification Service MC. + - Modified Notification Service MC to work in static builds. + - Corrected an error that caused Notification Service MC statistics to fail + when -AllocateTaskPerProxy is used. + - QueueDepth have been changed to measure the number of entries rather than + attempting unsuccessfully to estimate the amount of memory used by the queue. + - Added TAO_EXPLICIT_NEGOTIATE_CODESETS macro to improve the ease of including + optional codeset support to Notify_Service in static builds. + Wed Oct 28 06:09:33 UTC 2009 Johnny Willemsen * bin/tao_other_tests.lst: diff --git a/TAO/MPC/config/negotiate_codesets.mpb b/TAO/MPC/config/negotiate_codesets.mpb index 52e80a81b22..fedc567d674 100644 --- a/TAO/MPC/config/negotiate_codesets.mpb +++ b/TAO/MPC/config/negotiate_codesets.mpb @@ -4,4 +4,5 @@ feature(negotiate_codesets) { after += Codeset libs += TAO_Codeset + macros += TAO_EXPLICIT_NEGOTIATE_CODESETS } diff --git a/TAO/MPC/config/notify_monitor_control.mpb b/TAO/MPC/config/notify_monitor_control.mpb new file mode 100644 index 00000000000..acb24642eff --- /dev/null +++ b/TAO/MPC/config/notify_monitor_control.mpb @@ -0,0 +1,8 @@ +// -*- MPC -*- +// $Id$ + +feature(notify_monitor_control) { + after += TAO_Monitor CosNotification_MC CosNotification_MC_Ext + libs += TAO_CosNotification_MC_Ext TAO_CosNotification_MC TAO_Monitor + macros += TAO_HAS_NOTIFICATION_MONITOR_CONTROL +} diff --git a/TAO/MPC/config/tao_notify_service.mpb b/TAO/MPC/config/tao_notify_service.mpb index 5c9809baa80..8facd4907bc 100644 --- a/TAO/MPC/config/tao_notify_service.mpb +++ b/TAO/MPC/config/tao_notify_service.mpb @@ -1,7 +1,7 @@ // -*- MPC -*- // $Id$ -project : orbsvcslib, notification_serv, notification_serv, naming, iortable, messaging_optional, valuetype, svc_utils { +project : orbsvcslib, notification_serv, notification_serv, naming, iortable, messaging_optional, valuetype, svc_utils, notify_monitor_control{ after += TAO_Notify_Service libs += TAO_Notify_Service tagchecks += Notify diff --git a/TAO/docs/notification/monitor.html b/TAO/docs/notification/monitor.html index 7d47bc3ae94..9c302c23f26 100644 --- a/TAO/docs/notification/monitor.html +++ b/TAO/docs/notification/monitor.html @@ -19,7 +19,12 @@ and Control is configured.

Using the Notification Service Monitor

Configuration

-The monitor is enabled via the Service Configurator. The following +The monitor is enabled via the Service Configurator. These instructions +assume that ACE and TAO are built as dynamic libraries. If you are using +static libraries, read these instructions first, then refer to the +special procedures for static libraries section below. + +The following Service Configurator commands will enable the monitor:

   dynamic TAO_MonitorAndControl Service_Object * TAO_CosNotification_MC:_make_TAO_MonitorAndControl () ""
@@ -131,4 +136,46 @@ combination of get_statistics() and clear_statistics().
 not correspond to an event channel, the InvalidName exception will be
 thrown.
 

+ +

Special Procedures for Static Libraries

+If ACE and TAO are built as static libraries, follow the instructions above +with these modifications: +
    +
  • On the mwc.pl command used to generate the build files, add the +-features -features "notify_monitor_control=1" option. For example +to build for VC9, the mwc commmand would look like: +
    • +mwc.pl -type vc9 -static -features "notify_monitor_control=1" TAO_ACE.mwc
      +
    +
  • +
  • Replace the "dynamic" service configuration commands with a "static" +commands. Note that these commands have different syntaxes. +
    For example if +the service configuration commands for a dynamic build are (Lines wrapped +for illustrative purposes. In the service conf file the following should +appear on two lines): +
    • +  dynamic TAO_MonitorAndControl Service_Object * 
      +    TAO_CosNotification_MC:_make_TAO_MonitorAndControl () 
      +    "-o monitor.ior 
      +    -ORBArg \"-ORBInitRef -ORBArg NameService=corbaloc:iiop:localhost:10637/NameService\""
      +    
      +  dynamic TAO_MC_Notify_Service Service_Object * 
      +    TAO_CosNotification_MC_Ext:_make_TAO_MC_Notify_Service () 
      +    "-DispatchingThreads 1"
      +    
      +
    you should replace them with +
    • +  static TAO_MonitorAndControl 
      +    "-o monitor.ior 
      +    -ORBArg -ORBInitRef 
      +      -ORBArg NameService=corbaloc:iiop:localhost:10637/NameService"
      +  
      +  static TAO_MC_Notify_Service "-DispatchingThreads 1"
      +
    +Please note that the parser for the static service configuration directives +does not honor escaped quotes, so the -ORBArg option must appear separately for +each argument to the Notification Service MC's ORB. +
  • +
diff --git a/TAO/interop-tests/wchar/Client.java b/TAO/interop-tests/wchar/Client.java index 73bb469660e..84a3b2c2971 100644 --- a/TAO/interop-tests/wchar/Client.java +++ b/TAO/interop-tests/wchar/Client.java @@ -151,9 +151,17 @@ public class Client } case 0x00000800: // ANY_WSTRING_ECHO: { + char[] h = {'\u05D1', '\u05D2', '\u05D3'}; + String test = "\u05D1\u05D2\u05D3"; if (verbose) - System.out.println (" not yet implemented"); - return true; + System.out.println ("Test string = " + test); + Any a = orb.create_any(); + a.insert_string (test); + a = server.any_echo (a); + String echo = a.extract_string (); + if (verbose) + System.out.println ("Echo string = " + echo); + return test.equals(echo); } case 0x00001000: // WSTRUCTSEQ_FROM_SERVER { @@ -182,7 +190,6 @@ public class Client { return server.wstring_to_server ("", (short)-1); } - default: { if (verbose) diff --git a/TAO/interop-tests/wchar/interop_wchar.mpc b/TAO/interop-tests/wchar/interop_wchar.mpc index 1e82e0edc94..e256622242d 100644 --- a/TAO/interop-tests/wchar/interop_wchar.mpc +++ b/TAO/interop-tests/wchar/interop_wchar.mpc @@ -8,7 +8,7 @@ project(*IDL): taoidldefaults, anytypecode { custom_only = 1 } -project(*Server): taoserver { +project(*Server): taoserver, negotiate_codesets { after += *IDL Source_Files { interop_wchar_i.cpp diff --git a/TAO/interop-tests/wchar/server.cpp b/TAO/interop-tests/wchar/server.cpp index cb325b47325..e0830b030b1 100644 --- a/TAO/interop-tests/wchar/server.cpp +++ b/TAO/interop-tests/wchar/server.cpp @@ -19,6 +19,9 @@ #include "interop_wchar_i.h" #include "ace/Get_Opt.h" #include "ace/Argv_Type_Converter.h" +#if defined (TAO_EXPLICIT_NEGOTIATE_CODESETS) +#include "tao/Codeset/Codeset.h" +#endif /* TAO_EXPLICIT_NEGOTIATE_CODESETS */ const ACE_TCHAR *ior_output_file = ACE_TEXT("IOR"); int verbose = 0; @@ -58,13 +61,6 @@ ACE_TMAIN( int argc, ACE_TCHAR *argv[] ) { ACE_Argv_Type_Converter command_line(argc, argv); - if (parse_args(command_line.get_argc(), command_line.get_TCHAR_argv())) - { - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("failed to parse args")), - 1); - } - #if (!defined ACE_HAS_WCHAR) && (!defined ACE_HAS_XPG4_MULTIBYTE_CHAR) // the run_test script looks for the ior file. By touching it here, the // script can run at full speed, rather than timing out waiting for a @@ -83,7 +79,16 @@ ACE_TMAIN( int argc, ACE_TCHAR *argv[] ) try { // Initialize orb - CORBA::ORB_var orb = CORBA::ORB_init( command_line.get_argc(), command_line.get_ASCII_argv() ); + CORBA::ORB_var orb = + CORBA::ORB_init( command_line.get_argc(), + command_line.get_ASCII_argv() ); + if (parse_args(command_line.get_argc(), + command_line.get_TCHAR_argv())) + { + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("failed to parse args")), + 1); + } //Get reference to Root POA CORBA::Object_var obj = diff --git a/TAO/orbsvcs/Notify_Service/Notify_Service.cpp b/TAO/orbsvcs/Notify_Service/Notify_Service.cpp index 6f77b68d55b..df28a43f8eb 100644 --- a/TAO/orbsvcs/Notify_Service/Notify_Service.cpp +++ b/TAO/orbsvcs/Notify_Service/Notify_Service.cpp @@ -11,6 +11,16 @@ #include "tao/IORTable/IORTable.h" #include "tao/ORB_Core.h" +#if defined (TAO_HAS_NOTIFICATION_MONITOR_CONTROL) && defined (TAO_AS_STATIC_LIBS) +// for static builds, be sure the library is included +#include "orbsvcs/orbsvcs/Notify/MonitorControlExt/MC_Notify_Service.h" +#include "orbsvcs/orbsvcs/Notify/MonitorControl/MonitorManager.h" +#endif + +#if defined (TAO_EXPLICIT_NEGOTIATE_CODESETS) +#include "tao/Codeset/Codeset.h" +#endif /* TAO_EXPLICIT_NEGOTIATE_CODESETS */ + #if defined (TAO_HAS_CORBA_MESSAGING) && TAO_HAS_CORBA_MESSAGING != 0 #include "tao/Messaging/Messaging.h" #endif /* TAO_HAS_CORBA_MESSAGING != 0 */ @@ -47,6 +57,9 @@ TAO_Notify_Service_Driver::init_ORB (int& argc, ACE_TCHAR *argv []) { this->orb_ = CORBA::ORB_init (argc, argv); + ACE_LOG_MSG->open + (argv[0], ACE_Log_Msg::SYSLOG, ACE_TEXT ("TAO Notify")); + this->apply_timeout (this->orb_.in ()); CORBA::Object_var object = @@ -759,3 +772,10 @@ ACE_STATIC_SVC_DEFINE (TAO_Notify_Service_Driver, ACE_FACTORY_DEFINE (TAO_Notify_Service, TAO_Notify_Service_Driver) + + +#if defined (TAO_HAS_NOTIFICATION_MONITOR_CONTROL) && defined (TAO_AS_STATIC_LIBS) +ACE_STATIC_SVC_REQUIRE(TAO_MC_Notify_Service) +ACE_STATIC_SVC_REQUIRE(TAO_MonitorAndControl) +#endif + diff --git a/TAO/orbsvcs/Notify_Service/Notify_Service.mpc b/TAO/orbsvcs/Notify_Service/Notify_Service.mpc index c22d4bc70fb..0cb1b793e04 100644 --- a/TAO/orbsvcs/Notify_Service/Notify_Service.mpc +++ b/TAO/orbsvcs/Notify_Service/Notify_Service.mpc @@ -1,7 +1,7 @@ // -*- MPC -*- // $Id$ -project(TAO_Notify_Service) : orbsvcslib, orbsvcs_output, install, valuetype, orbsvcsexe, install, notification_serv, naming, iortable, messaging_optional, svc_utils { +project(TAO_Notify_Service) : orbsvcslib, orbsvcs_output, install, valuetype, orbsvcsexe, install, notification_serv, naming, iortable, messaging_optional, svc_utils, notify_monitor_control { sharedname = TAO_Notify_Service dynamicflags = TAO_NOTIFY_SERVICE_BUILD_DLL Source_Files { @@ -13,14 +13,14 @@ project(TAO_Notify_Service) : orbsvcslib, orbsvcs_output, install, valuetype, or } } -project(Notify_Service) : orbsvcsexe, install, tao_notify_service { +project(Notify_Service) : orbsvcsexe, install, tao_notify_service, notify_monitor_control { exename = Notify_Service Source_Files { Notify_Server.cpp } } -project(NT_Notify_Service) : orbsvcsexe, install, tao_notify_service { +project(NT_Notify_Service) : orbsvcsexe, install, tao_notify_service, notify_monitor_control { avoids += ace_for_tao requires += winnt exename = NT_Notify_Service diff --git a/TAO/orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushConsumer.cpp b/TAO/orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushConsumer.cpp index bc2f3b9dca9..1e89277bde1 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushConsumer.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushConsumer.cpp @@ -92,4 +92,14 @@ TAO_Notify_CosEC_ProxyPushConsumer::validate () } } +void +TAO_Notify_CosEC_ProxyPushConsumer::configure( + TAO_Notify_SupplierAdmin & /*admin*/, + CosNotifyChannelAdmin::ProxyID_out /*proxy_id*/) +{ + // Nothing to do. + // This virtual method was added to support Notification MC +} + + TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushConsumer.h b/TAO/orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushConsumer.h index 709814adafc..34ff80241f3 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushConsumer.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushConsumer.h @@ -51,6 +51,7 @@ public: virtual const char * get_proxy_type_name (void) const; virtual void validate (); + virtual void configure(TAO_Notify_SupplierAdmin & admin, CosNotifyChannelAdmin::ProxyID_out proxy_id); protected: ///= CosNotifyChannelAdmin::ProxyPushConsumer methods diff --git a/TAO/orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushSupplier.cpp b/TAO/orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushSupplier.cpp index 9d5a71b02ee..176300553e5 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushSupplier.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushSupplier.cpp @@ -52,7 +52,7 @@ TAO_Notify_CosEC_ProxyPushSupplier::get_proxy_type_name (void) const return "ec_proxy_push_supplier"; } -void +void TAO_Notify_CosEC_ProxyPushSupplier::validate () { TAO_Notify_Consumer* con = this->consumer (); @@ -68,4 +68,13 @@ TAO_Notify_CosEC_ProxyPushSupplier::validate () } } +void +TAO_Notify_CosEC_ProxyPushSupplier::configure( + TAO_Notify_ConsumerAdmin & /*admin*/, + CosNotifyChannelAdmin::ProxyID_out /*proxy_id*/) +{ + // Nothing to do. + // This virtual method was added to support Notification MC +} + TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushSupplier.h b/TAO/orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushSupplier.h index 3c3126755f3..dba2823bfd6 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushSupplier.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushSupplier.h @@ -64,6 +64,7 @@ public: ); virtual void validate (); + virtual void configure(TAO_Notify_ConsumerAdmin & admin, CosNotifyChannelAdmin::ProxyID_out proxy_id); private: /// Release diff --git a/TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushConsumer.cpp b/TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushConsumer.cpp index 71ea3de5a78..ae52b9b62e4 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushConsumer.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushConsumer.cpp @@ -125,4 +125,14 @@ TAO_Notify_ProxyPushConsumer::load_attrs (const TAO_Notify::NVPList& attrs) } } +void +TAO_Notify_ProxyPushConsumer::configure( + TAO_Notify_SupplierAdmin & /*admin*/, + CosNotifyChannelAdmin::ProxyID_out /*proxy_id*/) +{ + // presently nothing to do here. + // this method was added to support NotificationMC +} + + TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushConsumer.h b/TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushConsumer.h index 107abc5326d..3d41ad30596 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushConsumer.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushConsumer.h @@ -57,6 +57,8 @@ public: virtual void load_attrs (const TAO_Notify::NVPList& attrs); virtual void validate (); + virtual void configure(TAO_Notify_SupplierAdmin & admin, CosNotifyChannelAdmin::ProxyID_out proxy_id); + protected: ///= CosNotifyChannelAdmin::ProxyPushConsumer methods diff --git a/TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushSupplier.cpp b/TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushSupplier.cpp index 3f2686319fa..ecd4ae32f88 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushSupplier.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushSupplier.cpp @@ -104,4 +104,15 @@ TAO_Notify_ProxyPushSupplier::load_attrs (const TAO_Notify::NVPList& attrs) } } +void +TAO_Notify_ProxyPushSupplier::configure( + TAO_Notify_ConsumerAdmin & /*admin*/, + CosNotifyChannelAdmin::ProxyID_out /*proxy_id*/) +{ + // presently nothing to do here. + // this method was added to support NotificationMC +} + + + TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushSupplier.h b/TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushSupplier.h index 87bea7a33b6..90edad36a72 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushSupplier.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushSupplier.h @@ -59,6 +59,7 @@ public: virtual void load_attrs (const TAO_Notify::NVPList& attrs); virtual void validate (); + virtual void configure(TAO_Notify_ConsumerAdmin & admin, CosNotifyChannelAdmin::ProxyID_out proxy_id); // = Interface methods virtual CosNotifyChannelAdmin::ProxyType MyType (void); diff --git a/TAO/orbsvcs/orbsvcs/Notify/Buffering_Strategy.cpp b/TAO/orbsvcs/orbsvcs/Notify/Buffering_Strategy.cpp index 8f979d25bb0..d21469c2806 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Buffering_Strategy.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Buffering_Strategy.cpp @@ -94,10 +94,46 @@ TAO_Notify_Buffering_Strategy::oldest_event (void) return tv; } + +TAO_Notify_Buffering_Strategy::Tracker::Tracker (void) + : child_ (0) +{ +} + + TAO_Notify_Buffering_Strategy::Tracker::~Tracker (void) { } + +void +TAO_Notify_Buffering_Strategy::Tracker::register_child (TAO_Notify_Buffering_Strategy::Tracker * child) +{ + if (this->child_ == 0) + { + this->child_ = child; + } + else if (this->child_ != child) + { + this->child_->register_child (child); + } + // we simply ignore duplicate registrations. +} + +void +TAO_Notify_Buffering_Strategy::Tracker::unregister_child (TAO_Notify_Buffering_Strategy::Tracker * child) +{ + if (this->child_ == child) + { + this->child_ = this->child_->child_; + } + else if (this->child_ != 0) + { + this->child_->unregister_child (child); + } +} + + int TAO_Notify_Buffering_Strategy::enqueue (TAO_Notify_Method_Request_Queueable* method_request) { @@ -141,6 +177,10 @@ TAO_Notify_Buffering_Strategy::enqueue (TAO_Notify_Method_Request_Queueable* met continue; } } + if (tracker_ != 0) + { + tracker_->count_queue_overflow (local_overflow, global_overflow); + } discarded_existing = this->discard(method_request); if (discarded_existing) @@ -174,7 +214,9 @@ TAO_Notify_Buffering_Strategy::enqueue (TAO_Notify_Method_Request_Queueable* met size_t count = this->msg_queue_.message_count (); if (this->tracker_ != 0) - this->tracker_->update_queue_count (count); + { + this->tracker_->update_queue_count (count); + } return ACE_Utils::truncate_cast (count); } @@ -204,7 +246,9 @@ TAO_Notify_Buffering_Strategy::dequeue (TAO_Notify_Method_Request_Queueable* &me return -1; if (this->tracker_ != 0) - this->tracker_->update_queue_count (this->msg_queue_.message_count ()); + { + this->tracker_->update_queue_count (this->msg_queue_.message_count ()); + } method_request = dynamic_cast(mb); @@ -222,7 +266,14 @@ void TAO_Notify_Buffering_Strategy::set_tracker ( TAO_Notify_Buffering_Strategy::Tracker* tracker) { - this->tracker_ = tracker; + if (this->tracker_ == 0) + { + this->tracker_ = tracker; + } + else if (this->tracker_ != tracker) + { + this->tracker_->register_child (tracker); + } } int @@ -313,4 +364,6 @@ TAO_Notify_Buffering_Strategy::discard (TAO_Notify_Method_Request_Queueable* met return false; } + + TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Notify/Buffering_Strategy.h b/TAO/orbsvcs/orbsvcs/Notify/Buffering_Strategy.h index 52badbee8a3..be59b04ba40 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Buffering_Strategy.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Buffering_Strategy.h @@ -76,8 +76,14 @@ public: class TAO_Notify_Serv_Export Tracker { public: + Tracker (void); virtual ~Tracker (void); virtual void update_queue_count (size_t count) = 0; + virtual void count_queue_overflow (bool local_overflow, bool global_overflow) = 0; + void register_child (Tracker * child); + void unregister_child (Tracker * child); + protected: + Tracker * child_; }; /// Set the tracker object. This strategy does not own the tracker. diff --git a/TAO/orbsvcs/orbsvcs/Notify/Builder.cpp b/TAO/orbsvcs/orbsvcs/Notify/Builder.cpp index 1f4f9076557..c070f593e15 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Builder.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Builder.cpp @@ -67,11 +67,12 @@ public: proxy_id = proxy->id (); - proxy_ret = PROXY::_narrow (obj.in()); - // insert proxy in admin container. parent->insert (proxy); + proxy->configure (*parent, proxy_id); + + proxy_ret = PROXY::_narrow (obj.in()); return proxy_ret._retn (); } diff --git a/TAO/orbsvcs/orbsvcs/Notify/Consumer.h b/TAO/orbsvcs/orbsvcs/Notify/Consumer.h index 154303efacb..ec4ddbc956a 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Consumer.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Consumer.h @@ -117,10 +117,15 @@ typedef TAO_Notify_Refcountable_Guard_T< TAO_Notify_Consumer > Ptr; /// schedule our timer. The caller should have locked the proxy lock /// before calling this method. void assume_pending_events (TAO_Notify_Consumer& rhs); - + /// Is the connected consumer still around? bool is_alive (bool allow_nil_consumer); - + + /// Estimate how many events are pending delivery for this consumer + /// + /// The estimate does not include events queued at the admin level which + /// have not been passed to this consumer for delivery yet. + size_t pending_count (void); protected: @@ -198,7 +203,7 @@ protected: /// The Timer Manager that we use. TAO_Notify_Timer::Ptr timer_; - /// Last time either push an event or validate connection + /// Last time either push an event or validate connection /// via _non_exist call. ACE_Atomic_Op last_ping_; diff --git a/TAO/orbsvcs/orbsvcs/Notify/Consumer.inl b/TAO/orbsvcs/orbsvcs/Notify/Consumer.inl index bc0be7f45e8..7770744c722 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Consumer.inl +++ b/TAO/orbsvcs/orbsvcs/Notify/Consumer.inl @@ -24,4 +24,11 @@ TAO_Notify_Consumer::suspend (void) this->is_suspended_ = 1; } +ACE_INLINE size_t +TAO_Notify_Consumer::pending_count (void) +{ + return this->pending_events_->size(); +} + + TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Notify/MonitorControl/MonitorManager.cpp b/TAO/orbsvcs/orbsvcs/Notify/MonitorControl/MonitorManager.cpp index 29dbc31d745..a18cadbde94 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/MonitorControl/MonitorManager.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/MonitorControl/MonitorManager.cpp @@ -47,22 +47,40 @@ TAO_MonitorManager::init (int argc, ACE_TCHAR* argv[]) { case 'o': this->task_.ior_output_ = opts.opt_arg (); + if (TAO_debug_level > 7) + { + ACE_DEBUG((LM_INFO, + ACE_TEXT("(%P|%t) TAO_MonitorManager: Setting IOR output file to: %s"), + this->task_.ior_output_.c_str ())); + } break; case 0: if (ACE_OS::strcmp (opts.long_option (), orbarg) == 0) { - this->task_.argv_.add (opts.opt_arg ()); + ACE_TCHAR * orbArgs = opts.opt_arg (); + if (TAO_debug_level > 7) + { + ACE_DEBUG((LM_INFO, + ACE_TEXT("(%P|%t) TAO_MonitorManager: Setting Orb arguments to: %s"), + orbArgs)); + } + this->task_.argv_.add (ACE_TEXT_ALWAYS_CHAR (orbArgs)); } else if (ACE_OS::strcmp (opts.long_option (), nonamesvc) == 0) { + if (TAO_debug_level > 7) + { + ACE_DEBUG((LM_INFO, + ACE_TEXT("(%P|%t) TAO_MonitorManager: Not using naming service"))); + } this->task_.use_name_svc_ = false; } break; case ':': ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("%s requires an argument\n"), + ACE_TEXT ("(%P|%t) TAO_MonitorManager: %s requires an argument\n"), opts.last_option ()), - -1); + -1); } // Force the ARGV_T to copy the elements added by the add() method diff --git a/TAO/orbsvcs/orbsvcs/Notify/MonitorControl/MonitorManager.h b/TAO/orbsvcs/orbsvcs/Notify/MonitorControl/MonitorManager.h index 28f99f26b9b..d1e6696553b 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/MonitorControl/MonitorManager.h +++ b/TAO/orbsvcs/orbsvcs/Notify/MonitorControl/MonitorManager.h @@ -10,6 +10,7 @@ #include "ace/ARGV.h" #include "ace/Atomic_Op.h" #include "ace/Barrier.h" +#include "ace/Service_Config.h" #include "tao/ORB.h" @@ -67,6 +68,7 @@ TAO_END_VERSIONED_NAMESPACE_DECL ACE_STATIC_SVC_DECLARE_EXPORT(TAO_Notify_MC, TAO_MonitorAndControl) ACE_FACTORY_DECLARE(TAO_Notify_MC, TAO_MonitorAndControl) + #endif /* TAO_HAS_MONITOR_FRAMEWORK==1 */ #include /**/ "ace/post.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/MonitorControl/NotificationServiceMonitor_i.cpp b/TAO/orbsvcs/orbsvcs/Notify/MonitorControl/NotificationServiceMonitor_i.cpp index 3acadfe6b5c..8edea85d8e2 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/MonitorControl/NotificationServiceMonitor_i.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/MonitorControl/NotificationServiceMonitor_i.cpp @@ -259,6 +259,12 @@ NotificationServiceMonitor_i::get_invalid_names ( { if (registry->get (names[i].in ()) == 0) { + if (TAO_debug_level > 7) + { + ACE_DEBUG((LM_INFO, + ACE_TEXT("(%P|%t) TAO_NotificationServiceMonitor: Client requested invalid statistic name: %s"), + names[i].in ())); + } invalid.length (ilength + 1); invalid[ilength++] = CORBA::string_dup (names[i]); } diff --git a/TAO/orbsvcs/orbsvcs/Notify/MonitorControlExt/MC_Default_Factory.cpp b/TAO/orbsvcs/orbsvcs/Notify/MonitorControlExt/MC_Default_Factory.cpp index 342b25306bd..dc9f518bbdf 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/MonitorControlExt/MC_Default_Factory.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/MonitorControlExt/MC_Default_Factory.cpp @@ -5,6 +5,9 @@ #include "orbsvcs/Notify/MonitorControlExt/MonitorEventChannelFactory.h" #include "orbsvcs/Notify/MonitorControlExt/MonitorSupplierAdmin.h" #include "orbsvcs/Notify/MonitorControlExt/MonitorConsumerAdmin.h" +#include "orbsvcs/Notify/MonitorControlExt/MonitorProxyPushSupplier.h" +#include "orbsvcs/Notify/MonitorControlExt/MonitorStructuredProxyPushSupplier.h" +#include "orbsvcs/Notify/MonitorControlExt/MonitorSequenceProxyPushSupplier.h" #if defined (TAO_HAS_MONITOR_FRAMEWORK) && (TAO_HAS_MONITOR_FRAMEWORK == 1) @@ -44,6 +47,29 @@ TAO_MC_Default_Factory::create (TAO_Notify_ConsumerAdmin*& admin) CORBA::NO_MEMORY ()); } +void +TAO_MC_Default_Factory::create (TAO_Notify_ProxyPushSupplier*& proxy) +{ + ACE_NEW_THROW_EX (proxy, + TAO_MonitorProxyPushSupplier, + CORBA::NO_MEMORY ()); +} + +void +TAO_MC_Default_Factory::create (TAO_Notify_StructuredProxyPushSupplier*& proxy) +{ + ACE_NEW_THROW_EX (proxy, + TAO_MonitorStructuredProxyPushSupplier, + CORBA::NO_MEMORY ()); +} + +void +TAO_MC_Default_Factory::create (TAO_Notify_SequenceProxyPushSupplier*& proxy) +{ + ACE_NEW_THROW_EX (proxy, + TAO_MonitorSequenceProxyPushSupplier, + CORBA::NO_MEMORY ()); +} TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Notify/MonitorControlExt/MC_Default_Factory.h b/TAO/orbsvcs/orbsvcs/Notify/MonitorControlExt/MC_Default_Factory.h index c4c7be76e36..48cbed03c9f 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/MonitorControlExt/MC_Default_Factory.h +++ b/TAO/orbsvcs/orbsvcs/Notify/MonitorControlExt/MC_Default_Factory.h @@ -54,6 +54,17 @@ public: /// Create the consumer admin virtual void create (TAO_Notify_ConsumerAdmin*& admin); + + /// Create ProxyPushSupplier + virtual void create (TAO_Notify_ProxyPushSupplier*& proxy); +// /// Create CosEC_ProxyPushSupplier +// virtual void create (TAO_Notify_CosEC_ProxyPushSupplier*& proxy); + + /// Create StructuredProxyPushSupplier + virtual void create (TAO_Notify_StructuredProxyPushSupplier*& proxy); + + /// Create SequenceProxyPushSupplier + virtual void create (TAO_Notify_SequenceProxyPushSupplier*& proxy); }; TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Notify/MonitorControlExt/MC_Notify_Service.cpp b/TAO/orbsvcs/orbsvcs/Notify/MonitorControlExt/MC_Notify_Service.cpp index 41365e30ec7..8ea167e6983 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/MonitorControlExt/MC_Notify_Service.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/MonitorControlExt/MC_Notify_Service.cpp @@ -80,6 +80,12 @@ TAO_MC_Notify_Service::finalize_service ( TAO_END_VERSIONED_NAMESPACE_DECL +ACE_STATIC_SVC_DEFINE (TAO_MC_Notify_Service, + ACE_TEXT (TAO_NOTIFY_MONITOR_CONTROL_EXTENSION), + ACE_Service_Type::SERVICE_OBJECT, + &ACE_SVC_NAME (TAO_MC_Notify_Service), + ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ, + 0) ACE_FACTORY_DEFINE (TAO_Notify_MC_Ext, TAO_MC_Notify_Service) #endif /* TAO_HAS_MONITOR_FRAMEWORK==1 */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/MonitorControlExt/MC_Notify_Service.h b/TAO/orbsvcs/orbsvcs/Notify/MonitorControlExt/MC_Notify_Service.h index 34383650839..a253e5a8cb6 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/MonitorControlExt/MC_Notify_Service.h +++ b/TAO/orbsvcs/orbsvcs/Notify/MonitorControlExt/MC_Notify_Service.h @@ -46,8 +46,16 @@ private: TAO_END_VERSIONED_NAMESPACE_DECL +#define TAO_NOTIFY_MONITOR_CONTROL_EXTENSION "TAO_MC_Notify_Service" ACE_FACTORY_DECLARE (TAO_Notify_MC_Ext, TAO_MC_Notify_Service) +#if defined(TAO_AS_STATIC_LIBS) + +ACE_STATIC_SVC_DECLARE (TAO_MC_Notify_Service) + +#endif + + #endif /* TAO_HAS_MONITOR_FRAMEWORK==1 */ #include /**/ "ace/post.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/MonitorControlExt/MonitorConsumerAdmin.cpp b/TAO/orbsvcs/orbsvcs/Notify/MonitorControlExt/MonitorConsumerAdmin.cpp index 1ae7f3f7538..309e82806a7 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/MonitorControlExt/MonitorConsumerAdmin.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/MonitorControlExt/MonitorConsumerAdmin.cpp @@ -3,12 +3,12 @@ #include "orbsvcs/Notify/MonitorControlExt/MonitorConsumerAdmin.h" #include "ace/Monitor_Size.h" +#include "ace/Monitor_Base.h" #include "orbsvcs/Notify/MonitorControlExt/MonitorEventChannel.h" #include "orbsvcs/Notify/MonitorControl/Control_Registry.h" #include "orbsvcs/Notify/MonitorControl/Control.h" #include "orbsvcs/Notify/Buffering_Strategy.h" -#include "orbsvcs/Notify/ThreadPool_Task.h" #if defined (TAO_HAS_MONITOR_FRAMEWORK) && (TAO_HAS_MONITOR_FRAMEWORK == 1) @@ -45,7 +45,7 @@ public: return true; } - + private: TAO_MonitorEventChannel* ec_; CosNotifyChannelAdmin::AdminID id_; @@ -60,18 +60,7 @@ TAO_MonitorConsumerAdmin::TAO_MonitorConsumerAdmin (void) TAO_MonitorConsumerAdmin::~TAO_MonitorConsumerAdmin (void) { - // First, make sure we can get down to the real ec type. - TAO_MonitorEventChannel* ec = - dynamic_cast (this->ec_.get ()); - - if (ec != 0) - { - ec->unregister_statistic (this->stat_name_.c_str ()); - ec->remove_consumeradmin (this->id ()); - TAO_Control_Registry* cinstance = TAO_Control_Registry::instance (); - cinstance->remove (this->control_name_); - } - + this->remove (); // The registry also manages this refcount. The pointer itself // should never be 0 since we throw an exception if anything // fails in allocation or registration. @@ -85,13 +74,14 @@ TAO_MonitorConsumerAdmin::register_stats_controls ( { // Set up the statistic name, create it and register it this->stat_name_ = base + "/"; - this->stat_name_ += NotifyMonitoringExt::EventChannelQueueSize; - + this->queue_size_stat_name_ = stat_name_ + + NotifyMonitoringExt::EventChannelQueueSize; ACE_NEW_THROW_EX (this->queue_size_, - Size_Monitor (this->stat_name_.c_str ()), + Monitor_Base (this->queue_size_stat_name_.c_str (), + Monitor_Control_Types::MC_NUMBER), CORBA::NO_MEMORY ()); - if (!mec->register_statistic (this->stat_name_, this->queue_size_)) + if (!mec->register_statistic (this->queue_size_stat_name_, this->queue_size_)) { // The constructor sets the refcount to 1 so this call will // delete the pointer. @@ -100,15 +90,17 @@ TAO_MonitorConsumerAdmin::register_stats_controls ( throw NotifyMonitoringExt::NameAlreadyUsed (); } - // If we've successfully registered the statistic, hook us into the - // buffering strategy so it can let us know when the queue changes. - TAO_Notify_ThreadPool_Task* tpt = - dynamic_cast (this->get_worker_task ()); - - if (tpt != 0) + this->overflow_stat_name_ = stat_name_ + + NotifyMonitoringExt::EventChannelQueueOverflows; + ACE_NEW_THROW_EX (this->overflows_, + Monitor_Base (this->overflow_stat_name_.c_str (), + Monitor_Control_Types::MC_COUNTER), + CORBA::NO_MEMORY ()); + if (!mec->register_statistic (this->overflow_stat_name_, this->overflows_)) { - TAO_Notify_Buffering_Strategy* bs = tpt->buffering_strategy (); - bs->set_tracker (this); + delete this->overflows_; + this->overflows_ = 0; + throw NotifyMonitoringExt::NameAlreadyUsed (); } this->control_name_ = base; @@ -185,17 +177,76 @@ TAO_MonitorConsumerAdmin::obtain_notification_push_supplier ( void TAO_MonitorConsumerAdmin::update_queue_count (size_t count) { - if (this->queue_size_ != 0) + // NOTE: Formerly this code multiplied the count by an arbitrary and meaningless + // constant, and only updated the statistic when the count was non-zero. + this->queue_size_->receive (count); + + if (this->child_ != 0) + { + this->child_->update_queue_count (count); + } +} + + +void +TAO_MonitorConsumerAdmin::count_queue_overflow ( + bool local_overflow, + bool global_overflow) +{ + // note that someday we may wish to distinguish between + // local and global overflows + this->overflows_->receive ((size_t)1); + + if (this->child_ != 0) + { + this->child_->count_queue_overflow (local_overflow, global_overflow); + } +} + +TAO_MonitorEventChannel * +TAO_MonitorConsumerAdmin::get_ec (void) const +{ + TAO_MonitorEventChannel* ec = dynamic_cast (this->ec_.get ()); + if (ec == 0) + throw CORBA::INTERNAL (); + return ec; +} + +const ACE_CString & +TAO_MonitorConsumerAdmin::stat_name (void)const +{ + return stat_name_; +} + + +void +TAO_MonitorConsumerAdmin::destroy (void) +{ + this->remove (); + this->TAO_Notify_ConsumerAdmin::destroy (); +} + +void +TAO_MonitorConsumerAdmin::remove (void) +{ + // First, make sure we can get down to the real ec type + TAO_MonitorEventChannel* ec = + dynamic_cast (this->ec_.get ()); + if (ec != 0) { - // The message blocks stored in this queue are of size - // zero. However, each message block is a - // TAO_Notify_Event which has an associated set of data - // which can be used to estimate the amount of memory - // allocated to the message queue - this->queue_size_->receive (count * sizeof (TAO_Notify_Event)); + ec->unregister_statistic (this->queue_size_stat_name_); + ec->unregister_statistic (this->overflow_stat_name_); + ec->unregister_statistic (this->stat_name_); + ec->remove_consumeradmin (this->id ()); + TAO_Control_Registry* cinstance = TAO_Control_Registry::instance (); + cinstance->remove (this->control_name_); } + + // We don't own queue_size_, so we must not delete it } + + TAO_END_VERSIONED_NAMESPACE_DECL #endif /* TAO_HAS_MONITOR_FRAMEWORK==1 */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/MonitorControlExt/MonitorConsumerAdmin.h b/TAO/orbsvcs/orbsvcs/Notify/MonitorControlExt/MonitorConsumerAdmin.h index ecaddb656cd..69784a93035 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/MonitorControlExt/MonitorConsumerAdmin.h +++ b/TAO/orbsvcs/orbsvcs/Notify/MonitorControlExt/MonitorConsumerAdmin.h @@ -62,14 +62,30 @@ public: CosNotifyChannelAdmin::ClientType ctype, CosNotifyChannelAdmin::ProxyID_out proxy_id); + + TAO_MonitorEventChannel* get_ec (void) const; + + const ACE_CString & stat_name (void)const; + + /// Receive the queue count and store the approximated queue size in /// our statistic object. virtual void update_queue_count (size_t count); + virtual void count_queue_overflow (bool local_overflow, bool global_overflow); + + virtual void destroy (void); + private: + + virtual void remove (void); + ACE_CString stat_name_; + ACE_CString queue_size_stat_name_; + ACE_CString overflow_stat_name_; ACE_CString control_name_; - Monitor_Base* queue_size_; + Monitor_Base * queue_size_; + Monitor_Base * overflows_; }; TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Notify/MonitorControlExt/MonitorEventChannel.cpp b/TAO/orbsvcs/orbsvcs/Notify/MonitorControlExt/MonitorEventChannel.cpp index 9c2b4bf81c5..c2c6bf79371 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/MonitorControlExt/MonitorEventChannel.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/MonitorControlExt/MonitorEventChannel.cpp @@ -39,33 +39,22 @@ public: { } - virtual void update (void) - { + virtual void update (void) { if (this->type () == Monitor_Control_Types::MC_LIST) { Monitor_Control_Types::NameList list; - - if (this->is_supplier_) - { - this->interf_->get_suppliers (&list); - } + if (this->is_supplier_) + this->interf_->get_suppliers (&list); else - { - this->interf_->get_consumers (&list); - } - + this->interf_->get_consumers (&list); this->receive (list); } else - { + { if (this->is_supplier_) - { - this->receive (this->interf_->get_suppliers (0)); - } + this->receive (this->interf_->get_suppliers (0)); else - { - this->receive (this->interf_->get_consumers (0)); - } + this->receive (this->interf_->get_consumers (0)); } } @@ -86,8 +75,7 @@ public: { } - virtual void update (void) - { + virtual void update (void) { Monitor_Control_Types::NameList list; this->interf_->get_timedout_consumers (&list); this->receive (list); @@ -207,6 +195,17 @@ public: } }; +class QueueOverflows: + public Monitor_Base +{ +public: + QueueOverflows (const ACE_CString& name) + : Monitor_Base ( + name.c_str (), + Monitor_Control_Types::MC_COUNTER) { + } +}; + class ShutdownControl : public TAO_NS_Control { public: @@ -806,6 +805,19 @@ TAO_MonitorEventChannel::add_stats (const char* name) // Registry manages refcount, so we do this regardless. slowest->remove_ref (); + stat_name = dir_name + + NotifyMonitoringExt::EventChannelQueueOverflows; + QueueOverflows* overflows = 0; + ACE_NEW_THROW_EX (overflows, + QueueOverflows (stat_name.c_str ()), + CORBA::NO_MEMORY ()); + if (!this->register_statistic (stat_name, overflows)) + { + delete overflows; + ACE_ERROR ((LM_ERROR, "Unable to add statistic: %s\n", + stat_name.c_str ())); + } + TAO_Control_Registry* cinstance = TAO_Control_Registry::instance (); @@ -1207,7 +1219,7 @@ TAO_MonitorEventChannel::calculate_queue_size (bool count) // TAO_Notify_Event which has an associated set of data // which can be used to estimate the amount of memory // allocated to the message queue - size += (queue->message_count () * sizeof (TAO_Notify_Event)); + size += (queue->message_count () /* * sizeof (TAO_Notify_Event) */); } } } diff --git a/TAO/orbsvcs/orbsvcs/Notify/MonitorControlExt/MonitorProxyPushSupplier.h b/TAO/orbsvcs/orbsvcs/Notify/MonitorControlExt/MonitorProxyPushSupplier.h new file mode 100644 index 00000000000..8f5bf01b700 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/MonitorControlExt/MonitorProxyPushSupplier.h @@ -0,0 +1,27 @@ +// $Id$ +#ifndef MONITORPROXYPUSHSUPPLIER_H +#define MONITORPROXYPUSHSUPPLIER_H + +#include /**/ "ace/pre.h" +#include "orbsvcs/Notify/MonitorControlExt/notify_mc_ext_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/SString.h" +#include "orbsvcs/Notify/Any/ProxyPushSupplier.h" +#include "orbsvcs/Notify/MonitorControlExt/MonitorProxySupplier_T.h" + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +class TAO_Notify_MC_Ext_Export TAO_MonitorProxyPushSupplier + : public TAO_MonitorProxySupplier_T +{ + // No implementation needed at this level + // we're just mixing in the MonitorProxySupplier +}; +TAO_END_VERSIONED_NAMESPACE_DECL + +#include /**/ "ace/post.h" +#endif /* MONITORPROXYPUSHSUPPLIER_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/MonitorControlExt/MonitorProxySupplier_T.cpp b/TAO/orbsvcs/orbsvcs/Notify/MonitorControlExt/MonitorProxySupplier_T.cpp new file mode 100644 index 00000000000..3d4ad770521 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/MonitorControlExt/MonitorProxySupplier_T.cpp @@ -0,0 +1,164 @@ +// $Id$ + +#ifndef MONITORPROXYSUPPLIER_T_CPP +#define MONITORPROXYSUPPLIER_T_CPP + +#include "orbsvcs/Notify/MonitorControlExt/MonitorProxySupplier_T.h" +#include "orbsvcs/Notify/MonitorControlExt/MonitorConsumerAdmin.h" +#include "orbsvcs/Notify/MonitorControlExt/MonitorEventChannel.h" +#include "orbsvcs/Notify/ThreadPool_Task.h" +#include "ace/Monitor_Base.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +#pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +template +TAO_MonitorProxySupplier_T::TAO_MonitorProxySupplier_T (void) + : queue_item_stat_name_ () + , overflow_stat_name_ () + , queue_item_count_ (0) + , overflows_ (0) + , event_channel_ (0) + , admin_ (0) +{ +} + +template +TAO_MonitorProxySupplier_T::~TAO_MonitorProxySupplier_T (void) +{ + if (this->admin_ != 0) + { + this->admin_->unregister_child (this); + } + if (this->event_channel_ != 0) + { + this->event_channel_->unregister_statistic (this->queue_item_stat_name_); + } +} + +template +void +TAO_MonitorProxySupplier_T::update_queue_count (size_t count) +{ + if (this->queue_item_count_ != 0) + { + // get a count of events that are being held at the consumer level. + size_t pending = + this-> + //typename ProxyPushSupplier:: + TAO_Notify_ProxySupplier::consumer()-> + pending_count(); + this->queue_item_count_->receive (count + pending); + } + if (this->child_ != 0) + { + this->child_->update_queue_count (count); + } +} + +template +void +TAO_MonitorProxySupplier_T::count_queue_overflow ( + bool local_overflow, + bool global_overflow) +{ + // note that someday we may wish to distinguish between + // local and global overflows + if (this->overflows_ != 0) + { + this->overflows_->receive ((size_t)1); + } + if (this->child_ != 0) + { + this->child_->count_queue_overflow (local_overflow, global_overflow); + } +} + +template +void +TAO_MonitorProxySupplier_T::configure( + TAO_Notify_ConsumerAdmin & admin, + CosNotifyChannelAdmin::ProxyID_out proxy_id) +{ + admin_ = dynamic_cast (& admin); + if (admin_ == 0) + { + throw CORBA::INTERNAL(); + } + event_channel_ = admin_->get_ec (); + + TAO_Notify_Buffering_Strategy* bs = 0; + TAO_Notify_Worker_Task * worker_task = this->TAO_Notify_Object::get_worker_task (); + TAO_Notify_ThreadPool_Task* tpt = + dynamic_cast (worker_task); + if (tpt != 0) + { + bs = tpt->buffering_strategy (); + } + if (bs != 0) + { + bs->set_tracker (admin_); + } + else + { + ACE_DEBUG ((LM_DEBUG, "Warning MC cannot enable statistics for buffering strategy.\n")); + } + + this->base_stat_name_ = admin_->stat_name (); + char name[64]; + ACE_OS::sprintf(name, "%d", proxy_id); + this->base_stat_name_ += name; + this->base_stat_name_ += "/"; + + this->queue_item_stat_name_ = base_stat_name_; + this->queue_item_stat_name_ += NotifyMonitoringExt::EventChannelQueueElementCount; + ACE_NEW_THROW_EX (this->queue_item_count_, + Monitor_Base (this->queue_item_stat_name_.c_str (), + Monitor_Control_Types::MC_NUMBER), + CORBA::NO_MEMORY ()); + if (!event_channel_->register_statistic (this->queue_item_stat_name_, this->queue_item_count_)) + { + delete this->queue_item_count_; + this->queue_item_count_ = 0; + throw NotifyMonitoringExt::NameAlreadyUsed (); + } + + this->overflow_stat_name_ = base_stat_name_; + this->overflow_stat_name_ += NotifyMonitoringExt::EventChannelQueueOverflows; + ACE_NEW_THROW_EX (this->overflows_, + Monitor_Base (this->overflow_stat_name_.c_str (), + Monitor_Control_Types::MC_COUNTER), + CORBA::NO_MEMORY ()); + if (!event_channel_->register_statistic (this->overflow_stat_name_, this->overflows_)) + { + delete this->overflows_; + this->overflows_ = 0; + throw NotifyMonitoringExt::NameAlreadyUsed (); + } + + admin_->register_child (this); +} + + +template +ACE_CString & +TAO_MonitorProxySupplier_T::queue_item_stat_name(void) +{ + return this->queue_item_stat_name_; +} + + +template +ACE_CString & +TAO_MonitorProxySupplier_T::overflow_stat_name(void) +{ + return this->overflow_stat_name_; +} + + +TAO_END_VERSIONED_NAMESPACE_DECL + +#endif // MONITORPROXYSUPPLIER_T_CPP diff --git a/TAO/orbsvcs/orbsvcs/Notify/MonitorControlExt/MonitorProxySupplier_T.h b/TAO/orbsvcs/orbsvcs/Notify/MonitorControlExt/MonitorProxySupplier_T.h new file mode 100644 index 00000000000..6b48b66d9b3 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/MonitorControlExt/MonitorProxySupplier_T.h @@ -0,0 +1,89 @@ +// $Id$ +#ifndef MONITORPROXYSUPPLIER_H +#define MONITORPROXYSUPPLIER_H + +#include /**/ "ace/pre.h" +#include "orbsvcs/Notify/MonitorControlExt/notify_mc_ext_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/SString.h" +#include "orbsvcs/Notify/MonitorControlExt/NotifyMonitoringExtS.h" +#include "orbsvcs/Notify/Buffering_Strategy.h" +#include "orbsvcs/Notify/SupplierAdmin.h" + +ACE_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace ACE +{ + namespace Monitor_Control + { + class Monitor_Base; + } +} + +ACE_END_VERSIONED_NAMESPACE_DECL + +using namespace ACE_VERSIONED_NAMESPACE_NAME::ACE::Monitor_Control; + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +class TAO_MonitorEventChannel; +class TAO_MonitorConsumerAdmin; + +template +class TAO_MonitorProxySupplier_T + : public TAO_Notify_Buffering_Strategy::Tracker + , public ProxyPushSupplier +{ +public: + /// Construct a monitor supplier admin + TAO_MonitorProxySupplier_T (void); + + /// Remove the statistics for this event channel + virtual ~TAO_MonitorProxySupplier_T (void); + + /// Configure the statistics after construction + /// @param admin the parent admin for this proxy + /// @proxy_id the ID assigned to this proxy + virtual void configure( + TAO_Notify_ConsumerAdmin & admin, + CosNotifyChannelAdmin::ProxyID_out proxy_id); + + // Implement Tracer interface + virtual void update_queue_count (size_t count); + virtual void count_queue_overflow (bool local_overflow, bool global_overflow); + + /// Access to Statistics Name + ACE_CString & queue_item_stat_name (void); + + /// Access to Statistics Name + ACE_CString & overflow_stat_name (void); + +private: + ACE_CString base_stat_name_; + ACE_CString queue_item_stat_name_; + ACE_CString overflow_stat_name_; + + Monitor_Base * queue_item_count_; + Monitor_Base * overflows_; + + TAO_MonitorEventChannel* event_channel_; + TAO_MonitorConsumerAdmin * admin_; +}; + +TAO_END_VERSIONED_NAMESPACE_DECL + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "orbsvcs/Notify/MonitorControlExt/MonitorProxySupplier_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#include "orbsvcs/Notify/MonitorControlExt/MonitorProxySupplier_T.cpp" +#pragma implementation ("MonitorProxySupplier_T.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include /**/ "ace/post.h" +#endif /* MONITORPROXYSUPPLIER_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/MonitorControlExt/MonitorSequenceProxyPushSupplier.h b/TAO/orbsvcs/orbsvcs/Notify/MonitorControlExt/MonitorSequenceProxyPushSupplier.h new file mode 100644 index 00000000000..651252392d4 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/MonitorControlExt/MonitorSequenceProxyPushSupplier.h @@ -0,0 +1,27 @@ +// $Id$ +#ifndef MONITORSEQUENCEPROXYPUSHSUPPLIER_H +#define MONITORSEQUENCEPROXYPUSHSUPPLIER_H + +#include /**/ "ace/pre.h" +#include "orbsvcs/Notify/MonitorControlExt/notify_mc_ext_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ace/SString.h" +#include "orbsvcs/Notify/Sequence/SequenceProxyPushSupplier.h" +#include "orbsvcs/Notify/MonitorControlExt/MonitorProxySupplier_T.h" + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +class TAO_Notify_MC_Ext_Export TAO_MonitorSequenceProxyPushSupplier + : public TAO_MonitorProxySupplier_T +{ + // No implementation needed at this level + // we're just mixing in the MonitorProxySupplier +}; +TAO_END_VERSIONED_NAMESPACE_DECL + +#include /**/ "ace/post.h" +#endif /* MONITORSEQUENCEPROXYPUSHSUPPLIER_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/MonitorControlExt/MonitorStructuredProxyPushSupplier.h b/TAO/orbsvcs/orbsvcs/Notify/MonitorControlExt/MonitorStructuredProxyPushSupplier.h new file mode 100644 index 00000000000..a1b9135dec7 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/MonitorControlExt/MonitorStructuredProxyPushSupplier.h @@ -0,0 +1,30 @@ +// $Id$ +#ifndef MONITORSTRUCTUREDPROXYPUSHSUPPLIER_H +#define MONITORSTRUCTUREDPROXYPUSHSUPPLIER_H + +#include /**/ "ace/pre.h" +#include "orbsvcs/Notify/MonitorControlExt/notify_mc_ext_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "orbsvcs/Notify/Structured/StructuredProxyPushSupplier.h" +#include "orbsvcs/Notify/MonitorControlExt/MonitorProxySupplier_T.h" + + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +typedef TAO_MonitorProxySupplier_T TAO_MonitorStructuredProxyPushSupplier; +#if 0 +class TAO_Notify_MC_Ext_Export TAO_MonitorStructuredProxyPushSupplier + : public TAO_MonitorProxySupplier_T +{ + // Consider making this a typedef +}; +#endif + +TAO_END_VERSIONED_NAMESPACE_DECL + +#include /**/ "ace/post.h" +#endif /* MONITORSTRUCTUREDPROXYPUSHSUPPLIER_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/MonitorControlExt/NotifyMonitoringExt.idl b/TAO/orbsvcs/orbsvcs/Notify/MonitorControlExt/NotifyMonitoringExt.idl index 811e0a8390e..ffc05f477e0 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/MonitorControlExt/NotifyMonitoringExt.idl +++ b/TAO/orbsvcs/orbsvcs/Notify/MonitorControlExt/NotifyMonitoringExt.idl @@ -59,10 +59,11 @@ module NotifyMonitoringExt /// This corresponds to the EventChannel supplier admin names const string EventChannelSupplierAdminNames = "SupplierAdminNames"; - /// This corresponds to the EventChannel queue size + /// This corresponds to the queue size: Deprecated. Use QueueElementCount const string EventChannelQueueSize = "QueueSize"; - /// This corresponds to the EventChannel queue count + /// This corresponds to the queue count + /// Available at both the ConsumerAdmin level and the individual consumer level const string EventChannelQueueElementCount = "QueueElementCount"; /// This corresponds to the EventChannel's oldest event @@ -74,6 +75,11 @@ module NotifyMonitoringExt /// This corresponds to the EventChannelFactory names const string EventChannelFactoryNames = "FactoryNames"; + /// This corresponds to the EventChannelQueueOverflows names + /// Events were discarded because QoS limits were exceeded + /// Available at both the ConsumerAdmin level and the individual consumer level + const string EventChannelQueueOverflows = "QueueOverflows"; + exception NameAlreadyUsed {}; exception NameMapError {}; diff --git a/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushConsumer.cpp b/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushConsumer.cpp index 23a129e0553..94a211a19fb 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushConsumer.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushConsumer.cpp @@ -130,4 +130,14 @@ TAO_Notify_SequenceProxyPushConsumer::load_attrs (const TAO_Notify::NVPList& att } } +void +TAO_Notify_SequenceProxyPushConsumer::configure( + TAO_Notify_SupplierAdmin & /*admin*/, + CosNotifyChannelAdmin::ProxyID_out /*proxy_id*/) +{ + // Nothing to do. + // This virtual method was added to support Notification MC +} + + TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushConsumer.h b/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushConsumer.h index a20b5fa7c35..34a526c3f12 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushConsumer.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushConsumer.h @@ -53,6 +53,7 @@ public: virtual void load_attrs (const TAO_Notify::NVPList& attrs); virtual void validate (); + virtual void configure(TAO_Notify_SupplierAdmin & admin, CosNotifyChannelAdmin::ProxyID_out proxy_id); protected: ///= Data Members diff --git a/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushSupplier.cpp b/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushSupplier.cpp index fb2ee51346f..ee4f19c74db 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushSupplier.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushSupplier.cpp @@ -104,4 +104,13 @@ TAO_Notify_SequenceProxyPushSupplier::load_attrs (const TAO_Notify::NVPList& att } } +void +TAO_Notify_SequenceProxyPushSupplier::configure( + TAO_Notify_ConsumerAdmin & /*admin*/, + CosNotifyChannelAdmin::ProxyID_out /*proxy_id*/) +{ + // Nothing to do. + // This virtual method was added to support Notification MC +} + TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushSupplier.h b/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushSupplier.h index 241e6f4eb9b..66dcf19dbc6 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushSupplier.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushSupplier.h @@ -62,6 +62,8 @@ public: virtual void load_attrs (const TAO_Notify::NVPList& attrs); virtual void validate (); + virtual void configure(TAO_Notify_ConsumerAdmin & admin, CosNotifyChannelAdmin::ProxyID_out proxy_id); + /// = Servant methods virtual CosNotifyChannelAdmin::ProxyType MyType (void); diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushConsumer.cpp b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushConsumer.cpp index ae85ddadb88..7612a072d1f 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushConsumer.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushConsumer.cpp @@ -126,4 +126,15 @@ TAO_Notify_StructuredProxyPushConsumer::load_attrs (const TAO_Notify::NVPList& a } } +void +TAO_Notify_StructuredProxyPushConsumer::configure( + TAO_Notify_SupplierAdmin & /*admin*/, + CosNotifyChannelAdmin::ProxyID_out /*proxy_id*/) +{ + // Nothing to do. + // This virtual method was added to support Notification MC +} + + + TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushConsumer.h b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushConsumer.h index 97d71e73760..e6095949e76 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushConsumer.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushConsumer.h @@ -53,6 +53,7 @@ public: virtual void load_attrs (const TAO_Notify::NVPList& attrs); virtual void validate (); + virtual void configure(TAO_Notify_SupplierAdmin & admin, CosNotifyChannelAdmin::ProxyID_out proxy_id); protected: @@ -72,6 +73,7 @@ protected: virtual const char * get_proxy_type_name (void) const; + private: /// Release diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier.cpp b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier.cpp index e3497094153..d3f32c65017 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier.cpp @@ -106,4 +106,13 @@ TAO_Notify_StructuredProxyPushSupplier::load_attrs (const TAO_Notify::NVPList& a } } +void +TAO_Notify_StructuredProxyPushSupplier::configure( + TAO_Notify_ConsumerAdmin & /*admin*/, + CosNotifyChannelAdmin::ProxyID_out /*proxy_id*/) +{ + // Nothing to do. + // This virtual method was added to support Notification MC +} + TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier.h b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier.h index 920318640c2..d63f8e8ec0a 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier.h @@ -74,6 +74,8 @@ public: virtual const char * get_proxy_type_name (void) const; + virtual void configure(TAO_Notify_ConsumerAdmin & admin, CosNotifyChannelAdmin::ProxyID_out proxy_id); + private: /// Release diff --git a/TAO/orbsvcs/tests/Notify/MC/Notify_Structured_Push_Consumer.cpp b/TAO/orbsvcs/tests/Notify/MC/Notify_Structured_Push_Consumer.cpp index 6d3ab9ea8f1..e379acc6e91 100644 --- a/TAO/orbsvcs/tests/Notify/MC/Notify_Structured_Push_Consumer.cpp +++ b/TAO/orbsvcs/tests/Notify/MC/Notify_Structured_Push_Consumer.cpp @@ -21,16 +21,38 @@ Notify_Structured_Push_Consumer::Notify_Structured_Push_Consumer ( : name_ (name), expected_ (expected), count_ (0), + delay_count_ (0), + delay_period_ (5), client_ (client) { this->client_.consumer_start (this); } +void +Notify_Structured_Push_Consumer::set_delay_parameters (unsigned int delay_count, unsigned long delay_period) +{ + this->delay_count_ = delay_count; + this->delay_period_ = delay_period; +} void Notify_Structured_Push_Consumer::_connect ( CosNotifyChannelAdmin::ConsumerAdmin_ptr consumer_admin) { +#ifdef TEST_QOS_MAX_EVENTS_PER_CONSUMER + CosNotification::QoSProperties properties (8); + properties.length (2); + CORBA::ULong idx = 0; + properties[idx].name = CORBA::string_dup (CosNotification::DiscardPolicy); + properties[idx].value <<= this->CosNotification::FifoOrder; + idx += 1; + properties[idx].name = CORBA::string_dup (CosNotification::MaxEventsPerConsumer); + properties[idx].value <<= 500; + idx += 1; + ACE_OS::printf("Setting %d::%d QoS properties in Admin.\n", (int)idx, (int)properties.length()); + consumer_admin->set_qos (properties); +#endif // TEST_QOS_MAX_EVENTS_PER_CONSUMER + CosNotifyComm::StructuredPushConsumer_var objref = this->_this (); CosNotifyChannelAdmin::ProxySupplier_var proxysupplier = @@ -70,6 +92,12 @@ Notify_Structured_Push_Consumer::push_structured_event ( static const ACE_Time_Value sl (0, 2000); this->count_++; + + if (this->delay_count_ != 0 && this->count_ % this->delay_count_ == 0) + { + ACE_OS::sleep (this->delay_period_); + } + if (this->count_ > this->expected_) { ACE_ERROR ((LM_ERROR, diff --git a/TAO/orbsvcs/tests/Notify/MC/Notify_Structured_Push_Consumer.h b/TAO/orbsvcs/tests/Notify/MC/Notify_Structured_Push_Consumer.h index 0341ce0cb28..ee846c0e447 100644 --- a/TAO/orbsvcs/tests/Notify/MC/Notify_Structured_Push_Consumer.h +++ b/TAO/orbsvcs/tests/Notify/MC/Notify_Structured_Push_Consumer.h @@ -28,6 +28,7 @@ public: Notify_Test_Client& client); void _connect (CosNotifyChannelAdmin::ConsumerAdmin_ptr consumer_admin); + void set_delay_parameters (unsigned int delayCount_, unsigned long delayPeriod_); protected: void push_structured_event (const CosNotification::StructuredEvent&); @@ -35,6 +36,8 @@ protected: ACE_CString name_; unsigned int expected_; unsigned int count_; + unsigned int delay_count_; + unsigned long delay_period_; Notify_Test_Client& client_; }; diff --git a/TAO/orbsvcs/tests/Notify/MC/Structured_Consumer.cpp b/TAO/orbsvcs/tests/Notify/MC/Structured_Consumer.cpp index 1df0032fdbb..ecd0ee491f1 100644 --- a/TAO/orbsvcs/tests/Notify/MC/Structured_Consumer.cpp +++ b/TAO/orbsvcs/tests/Notify/MC/Structured_Consumer.cpp @@ -20,6 +20,8 @@ static const ACE_TCHAR *ior = ACE_TEXT ("file://test_monitor.ior"); static const char* ready = "ready.txt"; static unsigned int expected = 2000; +static unsigned int delay_period = 5; +static unsigned int delay_count = 0; static Notify_Structured_Push_Consumer* consumer_1 = 0; class Consumer_Client : public Notify_Test_Client @@ -32,7 +34,7 @@ public: int Consumer_Client::parse_args (int argc, ACE_TCHAR *argv[]) { - ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:e:")); + ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("k:e:p:d:")); int c; while ((c = get_opts ()) != -1) @@ -46,11 +48,21 @@ Consumer_Client::parse_args (int argc, ACE_TCHAR *argv[]) expected = ACE_OS::atoi (get_opts.optarg); break; + case 'p': + delay_period = ACE_OS::atoi (get_opts.optarg); + break; + + case 'd': + delay_count = ACE_OS::atoi (get_opts.optarg); + break; + default: ACE_ERROR_RETURN ((LM_ERROR, "usage: %s " "-k " "-e " + "-d " + "-p " "\n", argv [0]), -1); @@ -81,6 +93,7 @@ create_consumers (CosNotifyChannelAdmin::ConsumerAdmin_ptr admin, expected, *client), CORBA::NO_MEMORY ()); + consumer_1->set_delay_parameters (delay_count, delay_period); consumer_1->init (client->root_poa ()); consumer_1->_connect (admin); } @@ -108,6 +121,15 @@ int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) CosNotifyChannelAdmin::EventChannel_var ec = client.create_event_channel ("MyEventChannel", 0); +#ifdef TEST_QOS_MAX_QUEUE_LENGTH + ACE_OS::printf ("%s: setting max queue length to 1000\n", argv[0]); + CosNotification::AdminProperties properties(1); + properties.length(1); + properties[0].name = CORBA::string_dup (CosNotification::MaxQueueLength); + properties[0].value <<= 1000; + ec->set_admin(properties); +#endif //TEST_QOS_MAX_QUEUE_LENGTH + CORBA::ORB_ptr orb = client.orb (); CORBA::Object_var object = orb->string_to_object (ior); @@ -151,7 +173,11 @@ int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) ACE_OS::fclose (ready_file); client.ORB_run (); - +#ifdef PAUSE_ON_EXIT + _cputs( "All events received. Still connected.\n"); + _cputs( "Hit a key to exit consumer: " ); + _getch(); +#endif // PAUSE_ON_EXIT ACE_DEBUG ((LM_DEBUG, "Consumer done.\n")); consumer_1->disconnect (); diff --git a/TAO/orbsvcs/tests/Notify/MC/Structured_Supplier.cpp b/TAO/orbsvcs/tests/Notify/MC/Structured_Supplier.cpp index b4825f1c110..b0a04708c27 100644 --- a/TAO/orbsvcs/tests/Notify/MC/Structured_Supplier.cpp +++ b/TAO/orbsvcs/tests/Notify/MC/Structured_Supplier.cpp @@ -52,7 +52,7 @@ Supplier_Client::parse_args (int argc, ACE_TCHAR *argv[]) default: ACE_ERROR_RETURN ((LM_ERROR, "usage: %s " - "-o -e <# of events> -d" + "-o -e <# of events> " "\n", argv [0]), -1); @@ -147,8 +147,7 @@ int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) MonitorTestInterface::_narrow (object.in ()); if (CORBA::is_nil (sig.in ())) - ACE_ERROR_RETURN ((LM_ERROR, "Error: Narrow failed.\n"),1); - + ACE_ERROR_RETURN ((LM_ERROR, "Error: Structured Supplier: Narrow to MonitorTestInterface failed.\n"),1); CosNotifyChannelAdmin::SupplierAdmin_var admin = create_supplieradmin (ec.in ()); if (!CORBA::is_nil (admin.in ())) @@ -156,7 +155,6 @@ int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) create_suppliers (admin.in (), client.root_poa ()); sig->running (MonitorTestInterface::Supplier); - ACE_DEBUG ((LM_DEBUG, "1 supplier sending %d events...\n", max_events)); for (int i = 0; i < max_events; ++i) @@ -166,9 +164,7 @@ int ACE_TMAIN (int argc, ACE_TCHAR *argv[]) } ACE_DEBUG ((LM_DEBUG, "\nSupplier sent %d events.\n", max_events)); - sig->finished (MonitorTestInterface::Supplier); - supplier_1->disconnect (); } } diff --git a/TAO/orbsvcs/tests/Notify/MC/notify.conf b/TAO/orbsvcs/tests/Notify/MC/notify.conf index 25bb9fdf06e..f0b80a96227 100644 --- a/TAO/orbsvcs/tests/Notify/MC/notify.conf +++ b/TAO/orbsvcs/tests/Notify/MC/notify.conf @@ -2,3 +2,4 @@ dynamic TAO_MC_Notify_Service Service_Object * TAO_CosNotification_MC_Ext:_make_TAO_MC_Notify_Service () "" static Notify_Default_Event_Manager_Objects_Factory "-DispatchingThreads 1" +dynamic TAO_MonitorAndControl Service_Object * TAO_CosNotification_MC:_make_TAO_MonitorAndControl () "-o monitor.ior -ORBArg -ORBInitRef -ORBArg NameService=corbaloc:iiop:localhost:12083/NameService" diff --git a/TAO/orbsvcs/tests/Notify/MC/run_test.pl b/TAO/orbsvcs/tests/Notify/MC/run_test.pl index e7d3453e804..42c56ac0ea3 100755 --- a/TAO/orbsvcs/tests/Notify/MC/run_test.pl +++ b/TAO/orbsvcs/tests/Notify/MC/run_test.pl @@ -14,6 +14,13 @@ PerlACE::add_lib_path ('../lib'); PerlACE::check_privilege_group(); +# define the following as necessary to customize the test + +my $static_build = 0; +$static_build = new PerlACE::ConfigList->check_config('STATIC'); +#print "static_build " . $static_build . "\n"; +my $orbdebuglevel = ""; +#$orbdebuglevel = " -ORBDebugLevel 8 "; my $ior = PerlACE::LocalFile('test_monitor.ior'); my $monitorior = PerlACE::LocalFile('monitor.ior'); my $namingior = PerlACE::LocalFile('naming.ior'); @@ -21,19 +28,35 @@ my $notifyior = PerlACE::LocalFile('notify.ior'); my $ready = PerlACE::LocalFile('ready.txt'); my $notify_conf = PerlACE::LocalFile("notify$PerlACE::svcconf_ext"); my $port = PerlACE::random_port(); -my $mc_conf= "dynamic TAO_MonitorAndControl Service_Object * ". - "TAO_CosNotification_MC:_make_TAO_MonitorAndControl () \\\"-o ". - "monitor.ior -ORBArg \\\"-ORBInitRef ". - "NameService=corbaloc:iiop:localhost:$port/NameService\\\"\\\""; my $nscorbaloc = "-ORBInitRef NameService=corbaloc:iiop:" . "localhost:$port/NameService"; +die "oops" if not open(FH, ">$notify_conf"); +if($static_build){ + print FH "static TAO_MonitorAndControl \"-o monitor.ior " . + "-ORBArg -ORBInitRef " . + "-ORBArg NameService=corbaloc:iiop:localhost:$port/NameService\"\n"; + print FH "static TAO_MC_Notify_Service \"-DispatchingThreads 1 \"\n"; +} else { + print FH "dynamic TAO_MC_Notify_Service Service_Object * " . + "TAO_CosNotification_MC_Ext:_make_TAO_MC_Notify_Service () \"\"\n"; + print FH "static Notify_Default_Event_Manager_Objects_Factory \"-DispatchingThreads 1\"\n"; + print FH "dynamic TAO_MonitorAndControl Service_Object * ". + "TAO_CosNotification_MC:_make_TAO_MonitorAndControl () \"" . + "-o monitor.ior " . + "-ORBArg -ORBInitRef ". + "-ORBArg NameService=corbaloc:iiop:localhost:$port/NameService" . + "\"\n"; +} +close(FH); my $NS = new PerlACE::Process("../../../Naming_Service/Naming_Service", "-ORBEndpoint iiop://localhost:$port " . "-o $namingior"); my $TS = new PerlACE::Process("../../../Notify_Service/Notify_Service", - "$nscorbaloc " . - "-IORoutput $notifyior -ORBSvcConf " . - "$notify_conf -ORBSvcConfDirective \"$mc_conf\""); + "$orbdebuglevel $nscorbaloc " . + "-IORoutput $notifyior " . + "-ORBSvcConf $notify_conf " + ); + my $MON = new PerlACE::Process("test_monitor", "-k file://$monitorior"); my $STS = new PerlACE::Process("Structured_Supplier", @@ -64,6 +87,15 @@ if (PerlACE::waitforfile_timed( exit(1); } +if (PerlACE::waitforfile_timed( + $monitorior, + $PerlACE::wait_interval_for_process_creation) == -1) { + print STDERR "ERROR: waiting for the NS Monitoring service to start\n"; + $TS->Kill(); + $NS->Kill(); + exit(1); +} + print $MON->CommandLine()."\n"; $MON->Spawn(); if (PerlACE::waitforfile_timed( diff --git a/TAO/orbsvcs/tests/Notify/MC/test_monitor.cpp b/TAO/orbsvcs/tests/Notify/MC/test_monitor.cpp index c01916d604d..fa3c66cbb6d 100644 --- a/TAO/orbsvcs/tests/Notify/MC/test_monitor.cpp +++ b/TAO/orbsvcs/tests/Notify/MC/test_monitor.cpp @@ -11,6 +11,15 @@ using namespace ACE_VERSIONED_NAMESPACE_NAME::ACE::Monitor_Control; #include "MonitorTestInterfaceS.h" +extern "C" int +sorter (const void* a, const void* b) +{ + const char* left = *(reinterpret_cast (a)); + const char* right = *(reinterpret_cast (b)); + return ACE_OS::strcmp (left, right); +} + + // It's reasonable to assume that there is only one event channel // factory and that we know its name. @@ -29,6 +38,10 @@ public: virtual void finished (MonitorTestInterface::Which proc); +private: + void brain_dump (const char * context); + void stat_dump (const char * statName); + void consumer_stats_check (void); private: ACE_CString base_; CosNotification::NotificationServiceMonitorControl_var nsm_; @@ -45,6 +58,7 @@ MonitorTestInterface_i::running (MonitorTestInterface::Which proc) switch (proc) { case MonitorTestInterface::NotifyService: + { data = nsm_->get_statistic (NotifyMonitoringExt::EventChannelFactoryNames); list = data->data_union.list (); @@ -81,7 +95,9 @@ MonitorTestInterface_i::running (MonitorTestInterface::Which proc) } break; + } case MonitorTestInterface::Consumer: + { str = this->base_ + NotifyMonitoringExt::ActiveEventChannelNames; data = nsm_->get_statistic (str.c_str ()); list = data->data_union.list (); @@ -100,69 +116,184 @@ MonitorTestInterface_i::running (MonitorTestInterface::Which proc) str = this->base_ + NotifyMonitoringExt::EventChannelConsumerCount; data = this->nsm_->get_statistic (str.c_str ()); num = data->data_union.num (); - if (num.dlist[0].value != 1) - { - ACE_ERROR ((LM_ERROR, "There should be only one Consumer\n")); - } + ACE_ERROR ((LM_ERROR, "Monitor: ERROR: There should be only one Consumer\n")); - str = - this->base_ + NotifyMonitoringExt::EventChannelConsumerAdminCount; - data = this->nsm_->get_statistic (str.c_str ()); + str = this->base_ + NotifyMonitoringExt::EventChannelConsumerAdminCount; + data = nsm_->get_statistic(str.c_str ()); num = data->data_union.num (); - if (num.dlist[0].value != 1) - { - ACE_ERROR ((LM_ERROR, "There should be only one ConsumerAdmin\n")); - } + ACE_ERROR ((LM_ERROR, + "Monitor: ERROR: There should be only one ConsumerAdmin\n")); - str = - this->base_ + NotifyMonitoringExt::EventChannelQueueElementCount; - data = this->nsm_->get_statistic (str.c_str ()); + str = this->base_ + NotifyMonitoringExt::EventChannelQueueElementCount; + data = nsm_->get_statistic(str.c_str ()); num = data->data_union.num (); + if (num.dlist[0].value != 1) + ACE_ERROR ((LM_ERROR, "Monitor: ERROR: There should be no events queued\n")); - if (num.dlist[0].value != 0) - { - ACE_ERROR ((LM_ERROR, "There should be no events queued\n")); - } + brain_dump ("Running Consumer"); break; + } case MonitorTestInterface::Supplier: + { str = this->base_ + NotifyMonitoringExt::EventChannelSupplierCount; - data = this->nsm_->get_statistic (str.c_str ()); + data = nsm_->get_statistic(str.c_str ()); num = data->data_union.num (); + if (num.dlist[0].value != 0) + ACE_ERROR ((LM_ERROR, "Monitor: ERROR: There should be only one Supplier\n")); - if (num.dlist[0].value != 1) + str = this->base_ + NotifyMonitoringExt::EventChannelSupplierAdminCount; + data = nsm_->get_statistic(str.c_str ()); + num = data->data_union.num (); + if (num.dlist[0].value != 0) + ACE_ERROR ((LM_ERROR, + "Monitor: ERROR: There should be only one SupplierAdmin\n")); + brain_dump ("Running Supplier"); + break; + } + default: + ACE_ERROR ((LM_ERROR, "Monitor: ERROR: Impossible enum value %d\n", proc)); + break; + } +} + +void +MonitorTestInterface_i::consumer_stats_check() +{ + bool foundConsumerStats = false; + Monitor::NameList_var names = nsm_->get_statistic_names (); + CORBA::ULong length = names->length (); + for(CORBA::ULong i = 0; i < length; i++) + { + const char * name = names[i].in (); + size_t slashcount = 0; + bool isConsumerQueueSize = false; + for (size_t nCh = 0; name[nCh] != 0 && slashcount < 3; ++nCh) { - ACE_ERROR ((LM_ERROR, "There should be only one Supplier\n")); + if (name[nCh] == '/') + { + slashcount += 1; + if(slashcount == 3) + { + isConsumerQueueSize = 0 == ACE_OS::strcmp( + &name[nCh + 1], + NotifyMonitoringExt::EventChannelQueueSize); + } + } } + if (isConsumerQueueSize) + { + foundConsumerStats = true; + // We have a consumer queue + try + { + Monitor::Data_var queueSizeData = + nsm_->get_statistic(name); + + Monitor::Numeric queueSizeNum = queueSizeData->data_union.num (); + ACE_DEBUG ((LM_DEBUG, "Monitor: %s: Average: %f, Maximum: %f, Most recent: %f\n", + name, + queueSizeNum.average, queueSizeNum.maximum, queueSizeNum.last)); + if (queueSizeNum.average <= 0.0 || queueSizeNum.average > 2000.0) + ACE_ERROR ((LM_ERROR, "Monitor: ERROR: %s average queue size [%f] should be greater than zero and less than 2000.\n", + name, + queueSizeNum.average)); + if (queueSizeNum.last > 2000.0) + ACE_ERROR ((LM_ERROR, "Monitor: ERROR: %s most recent queue size [%f] should not be greater than 2000.\n", + name, + queueSizeNum.last)); + } + catch (const CORBA::Exception& ex) + { + ex._tao_print_exception (name); + } + } - str = - this->base_ + NotifyMonitoringExt::EventChannelSupplierAdminCount; - data = this->nsm_->get_statistic (str.c_str ()); - num = data->data_union.num (); + } + if(! foundConsumerStats) + { + ACE_ERROR ((LM_ERROR, "Monitor: ERROR: No consumer queue size statistics found.\n" + )); + } +} - if (num.dlist[0].value != 1) +void +MonitorTestInterface_i::brain_dump(const char * /*context*/) +{ +#if 0 // verbose output should be controlled via a command line option + ACE_DEBUG ((LM_DEBUG, "\nStatistics as of: %s\n", context)); + // Temporary::Dale: Dump known names + CosNotification::NotificationServiceMonitorControl::NameList_var names = + nsm_->get_statistic_names (); + CORBA::ULong length = names->length (); + ACE_DEBUG ((LM_DEBUG, "Statistic names [%d]\n", (int)length)); + + // It's much easier to read once it's sorted + const char** narray = 0; + ACE_NEW_THROW_EX (narray, + const char* [length], + CORBA::NO_MEMORY ()); + for(CORBA::ULong i = 0; i < length; i++) + narray[i] = names[i].in (); + ACE_OS::qsort (narray, length, + sizeof (const char*), sorter); + + for(CORBA::ULong i = 0; i < length; i++) + { + stat_dump(narray[i]); + } + delete [] narray; +#endif // verbose option +} + +void +MonitorTestInterface_i::stat_dump (const char * statName) +{ + try + { + Monitor::Data_var data = nsm_->get_statistic(statName); + switch (data->data_union._d()) + { + case Monitor::DATA_NUMERIC: { - ACE_ERROR ((LM_ERROR, "There should be only one SupplierAdmin\n")); + ACE_DEBUG ((LM_DEBUG, "Numeric: %s\n", statName)); + Monitor::Numeric num = data->data_union.num(); + ACE_DEBUG ((LM_DEBUG, " count: %d, average: %f; sumsq: %f, min: %f, max: %f: last %f\n", + (unsigned int)num.count, num.average, num.sum_of_squares, num.minimum, num.maximum, num.last)); + break; } + default: + { + Monitor::NameList list = data->data_union.list (); + size_t len = list.length (); + ACE_DEBUG ((LM_DEBUG, "Text[%d]: %s\n", (int)len, statName)); - break; - default: - ACE_ERROR ((LM_ERROR, "Impossible enum value %d\n", proc)); - break; + for (size_t i = 0; i < len; i++) + { + ACE_CString str = list[i].in (); + ACE_DEBUG ((LM_DEBUG, " %d: %s\n", (int)i, str.c_str())); + } + break; + } + } + } + catch (const CORBA::Exception& ex) + { + + ex._tao_print_exception (statName); } } + void MonitorTestInterface_i::finished (MonitorTestInterface::Which proc) { - ACE_CString str; - Monitor::Data_var data; - Monitor::NameList list; - Monitor::Numeric num; - Monitor::NameList_var reg_names; - Monitor::NameList ec_names; +// ACE_CString str; +// Monitor::Data_var data; +// Monitor::NameList list; +// Monitor::Numeric num; switch (proc) { @@ -175,48 +306,53 @@ MonitorTestInterface_i::finished (MonitorTestInterface::Which proc) this->running (MonitorTestInterface::NotifyService); break; case MonitorTestInterface::Supplier: - str = this->base_ + NotifyMonitoringExt::EventChannelConsumerCount; - data = this->nsm_->get_statistic (str.c_str ()); - num = data->data_union.num (); - - if (num.dlist[0].value != 1) - { - ACE_ERROR ((LM_ERROR, "There should still be one Consumer\n")); - } - - str = - this->base_ + NotifyMonitoringExt::EventChannelQueueElementCount; - data = this->nsm_->get_statistic (str.c_str ()); - num = data->data_union.num (); - - if (num.dlist[0].value == 0) - { - ACE_ERROR ((LM_ERROR, - "There should be at least one event queued\n")); - } - - str = - this->base_ + NotifyMonitoringExt::EventChannelConsumerAdminNames; - data = nsm_->get_statistic(str.c_str ()); - list = data->data_union.list (); - - for (CORBA::ULong i = 0; i < list.length (); ++i) + { + ACE_CString consumerCountName = this->base_ + NotifyMonitoringExt::EventChannelConsumerCount; + Monitor::Data_var consumerCountData = + nsm_->get_statistic(consumerCountName.c_str ()); + Monitor::Numeric consumerCountNum = + consumerCountData->data_union.num (); + if (consumerCountNum.last != 1) + ACE_ERROR ((LM_ERROR, "Monitor: ERROR: There should still be one Consumer\n")); + + ACE_CString queueElementName = this->base_ + NotifyMonitoringExt::EventChannelQueueElementCount; + Monitor::Data_var queueElementData = + nsm_->get_statistic(queueElementName.c_str ()); + Monitor::Numeric queueElementNum = + queueElementData->data_union.num (); + if (queueElementNum.last == 0) + ACE_ERROR ((LM_ERROR, "Monitor: ERROR: There should be at least one " + "event queued\n")); + + ACE_CString adminNamesName = this->base_ + NotifyMonitoringExt::EventChannelConsumerAdminNames; + Monitor::Data_var adminNamesData = + nsm_->get_statistic(adminNamesName.c_str ()); + Monitor::NameList nameList = + adminNamesData->data_union.list (); + for (CORBA::ULong i = 0; i < nameList.length (); i++) { - str = list[i].in (); - str += "/"; - str += NotifyMonitoringExt::EventChannelQueueSize; - data = nsm_->get_statistic(str.c_str ()); - num = data->data_union.num (); - ACE_DEBUG ((LM_DEBUG, "Average Queue Size: %f\n", num.average)); - - if (num.average == 0.0) - { - ACE_ERROR ((LM_ERROR, - "The average should be non-zero\n")); - } - } - + ACE_CString queueSizeName = nameList[i].in (); + queueSizeName += "/"; + queueSizeName += NotifyMonitoringExt::EventChannelQueueSize; + Monitor::Data_var queueSizeData = + nsm_->get_statistic(queueSizeName.c_str ()); + Monitor::Numeric queueSizeNum = + queueSizeData->data_union.num (); + ACE_DEBUG ((LM_DEBUG, "Monitor: Queue Size: Average: %f, Maximum: %f, Most recent: %f\n", + queueSizeNum.average, queueSizeNum.maximum, queueSizeNum.last)); + if (queueSizeNum.average <= 0.0 || queueSizeNum.average > 2000.0) + ACE_ERROR ((LM_ERROR, "Monitor: ERROR: The average queue size [%f] should be greater than zero and less than 2000.\n", + queueSizeNum.average)); + if (queueSizeNum.last > 2000.0) + ACE_ERROR ((LM_ERROR, "Monitor: ERROR: The most recent queue size [%f] should not be greater than 2000.\n", + queueSizeNum.last)); + } + + consumer_stats_check(); + + brain_dump ("Finished Supplier"); break; + } default: ACE_ERROR ((LM_ERROR, "Impossible enum value %d\n", proc)); break; @@ -244,7 +380,7 @@ parse_args (int argc, ACE_TCHAR *argv[]) case '?': default: ACE_ERROR_RETURN ((LM_ERROR, - "usage: %s " + "Monitor: usage: %s " "-k " "-o " "\n", @@ -280,7 +416,7 @@ ACE_TMAIN (int argc, ACE_TCHAR* argv[]) if (CORBA::is_nil (nsm.in ())) { ACE_ERROR_RETURN ((LM_ERROR, - "Unable to locate the " + "Monitor: Unable to locate the " "Notification Service Monitor\n"), 1); } diff --git a/TAO/orbsvcs/tests/Notify/MT_Dispatching/Notify_Structured_Push_Consumer.cpp b/TAO/orbsvcs/tests/Notify/MT_Dispatching/Notify_Structured_Push_Consumer.cpp index 8969889d264..4c74caed6df 100644 --- a/TAO/orbsvcs/tests/Notify/MT_Dispatching/Notify_Structured_Push_Consumer.cpp +++ b/TAO/orbsvcs/tests/Notify/MT_Dispatching/Notify_Structured_Push_Consumer.cpp @@ -2,6 +2,7 @@ #include "Notify_Structured_Push_Consumer.h" #include "Notify_Test_Client.h" +#include "ace/OS.h" Notify_Structured_Push_Consumer::Notify_Structured_Push_Consumer ( const char* name, @@ -10,11 +11,19 @@ Notify_Structured_Push_Consumer::Notify_Structured_Push_Consumer ( : name_ (name), expected_ (expected), count_ (0), + delay_count_ (0), + delay_period_ (5), client_ (client) { this->client_.consumer_start (this); } +void +Notify_Structured_Push_Consumer::set_delay_parameters (unsigned int delay_count, unsigned long delay_period) +{ + this->delay_count_ = delay_count; + this->delay_period_ = delay_period; +} void Notify_Structured_Push_Consumer::push_structured_event ( @@ -24,6 +33,11 @@ Notify_Structured_Push_Consumer::push_structured_event ( ++count_; + if (this->delay_count_ != 0 && this->count_ % this->delay_count_ == 0) + { + ACE_OS::sleep (this->delay_period_); + } + if (this->count_ > this->expected_) { ACE_ERROR ((LM_ERROR, ACE_TEXT ("ERROR: too many events received.\n"))); diff --git a/TAO/orbsvcs/tests/Notify/MT_Dispatching/Notify_Structured_Push_Consumer.h b/TAO/orbsvcs/tests/Notify/MT_Dispatching/Notify_Structured_Push_Consumer.h index 0e5ff0b2fea..9f3e4ed57f4 100644 --- a/TAO/orbsvcs/tests/Notify/MT_Dispatching/Notify_Structured_Push_Consumer.h +++ b/TAO/orbsvcs/tests/Notify/MT_Dispatching/Notify_Structured_Push_Consumer.h @@ -29,12 +29,17 @@ public: const char* name, unsigned int expected, Notify_Test_Client& client); + void set_delay_parameters (unsigned int delay_count, unsigned long delay_period); + protected: void push_structured_event (const CosNotification::StructuredEvent&); ACE_CString name_; unsigned int expected_; unsigned int count_; + unsigned int delay_count_; + unsigned long delay_period_; + Notify_Test_Client& client_; }; diff --git a/TAO/orbsvcs/tests/unit/Notify/MC/Statistic/Statistic.cpp b/TAO/orbsvcs/tests/unit/Notify/MC/Statistic/Statistic.cpp index 57f0822717e..2db160fceb1 100644 --- a/TAO/orbsvcs/tests/unit/Notify/MC/Statistic/Statistic.cpp +++ b/TAO/orbsvcs/tests/unit/Notify/MC/Statistic/Statistic.cpp @@ -73,7 +73,7 @@ ACE_TMAIN (int, ACE_TCHAR*[]) if (stime.minimum_sample () != 1083466309.88374) { - error ("Time TAO_Statistic::minimum_sample() failed"); + error ("Time Monitor_Base::minimum_sample() failed"); } if (stime.maximum_sample () != 1183466377.9922) @@ -116,7 +116,7 @@ ACE_TMAIN (int, ACE_TCHAR*[]) l.push_back ("three"); list.receive (l); - if (counter.count () != 3) + if (list.count () != 3) { error ("List Monitor_Base::receive() failed"); } diff --git a/TAO/tao/Monitor/Monitor_Types.pidl b/TAO/tao/Monitor/Monitor_Types.pidl index 8027cdfce7d..de9a67f57dd 100644 --- a/TAO/tao/Monitor/Monitor_Types.pidl +++ b/TAO/tao/Monitor/Monitor_Types.pidl @@ -24,6 +24,7 @@ module Monitor double sum_of_squares; double minimum; double maximum; + double last; }; enum DataType { DATA_NUMERIC, DATA_TEXT }; union UData switch (DataType) { -- cgit v1.2.1