From 3a06f9c5f150b6058e0c6abdde7ca976902a6d28 Mon Sep 17 00:00:00 2001 From: pradeep Date: Tue, 25 Feb 2003 13:02:48 +0000 Subject: *** empty log message *** --- TAO/orbsvcs/orbsvcs/Notify/Admin.cpp | 77 +++- TAO/orbsvcs/orbsvcs/Notify/Admin.h | 34 +- TAO/orbsvcs/orbsvcs/Notify/Admin.inl | 2 - TAO/orbsvcs/orbsvcs/Notify/AdminProperties.h | 1 - .../orbsvcs/Notify/Any/CosEC_ProxyPushConsumer.cpp | 7 +- .../orbsvcs/Notify/Any/CosEC_ProxyPushConsumer.h | 5 +- .../orbsvcs/Notify/Any/CosEC_ProxyPushSupplier.cpp | 11 +- .../orbsvcs/Notify/Any/CosEC_ProxyPushSupplier.h | 4 +- .../orbsvcs/Notify/Any/ProxyPushConsumer.cpp | 7 +- TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushConsumer.h | 5 +- .../orbsvcs/Notify/Any/ProxyPushSupplier.cpp | 11 +- TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushSupplier.h | 2 +- TAO/orbsvcs/orbsvcs/Notify/Any/PushConsumer.h | 1 - TAO/orbsvcs/orbsvcs/Notify/Any/PushSupplier.h | 1 - TAO/orbsvcs/orbsvcs/Notify/Builder.cpp | 429 ++++++++++++--------- TAO/orbsvcs/orbsvcs/Notify/Builder.h | 103 +++-- TAO/orbsvcs/orbsvcs/Notify/Builder.inl | 2 - TAO/orbsvcs/orbsvcs/Notify/Consumer.cpp | 77 ++-- TAO/orbsvcs/orbsvcs/Notify/Consumer.h | 43 ++- TAO/orbsvcs/orbsvcs/Notify/Consumer.inl | 22 +- TAO/orbsvcs/orbsvcs/Notify/ConsumerAdmin.cpp | 279 +++++++------- TAO/orbsvcs/orbsvcs/Notify/ConsumerAdmin.h | 125 +++--- TAO/orbsvcs/orbsvcs/Notify/ConsumerAdmin.inl | 2 - TAO/orbsvcs/orbsvcs/Notify/Consumer_Map.h | 36 ++ TAO/orbsvcs/orbsvcs/Notify/Container_T.cpp | 34 +- TAO/orbsvcs/orbsvcs/Notify/Container_T.h | 32 +- TAO/orbsvcs/orbsvcs/Notify/Container_T.inl | 6 +- .../orbsvcs/Notify/CosNotify_Initializer.cpp | 4 +- TAO/orbsvcs/orbsvcs/Notify/CosNotify_Service.cpp | 327 ++++++++++++++++ TAO/orbsvcs/orbsvcs/Notify/CosNotify_Service.h | 90 +++++ TAO/orbsvcs/orbsvcs/Notify/CosNotify_Service.inl | 1 + TAO/orbsvcs/orbsvcs/Notify/Default_Factory.cpp | 395 +++++++++++++++++++ TAO/orbsvcs/orbsvcs/Notify/Default_Factory.h | 101 +++++ TAO/orbsvcs/orbsvcs/Notify/Default_Factory.inl | 1 + TAO/orbsvcs/orbsvcs/Notify/ETCL_Filter.cpp | 179 +++++---- TAO/orbsvcs/orbsvcs/Notify/ETCL_Filter.h | 38 +- TAO/orbsvcs/orbsvcs/Notify/ETCL_Filter.inl | 2 - TAO/orbsvcs/orbsvcs/Notify/ETCL_FilterFactory.cpp | 25 +- TAO/orbsvcs/orbsvcs/Notify/ETCL_FilterFactory.h | 27 +- TAO/orbsvcs/orbsvcs/Notify/ETCL_FilterFactory.inl | 2 - TAO/orbsvcs/orbsvcs/Notify/Event.cpp | 26 +- TAO/orbsvcs/orbsvcs/Notify/Event.h | 47 ++- TAO/orbsvcs/orbsvcs/Notify/Event.inl | 12 +- TAO/orbsvcs/orbsvcs/Notify/EventChannel.cpp | 325 +++++++++++----- TAO/orbsvcs/orbsvcs/Notify/EventChannel.h | 127 +++--- TAO/orbsvcs/orbsvcs/Notify/EventChannel.inl | 2 - TAO/orbsvcs/orbsvcs/Notify/EventChannelFactory.cpp | 165 ++++++-- TAO/orbsvcs/orbsvcs/Notify/EventChannelFactory.h | 87 +++-- TAO/orbsvcs/orbsvcs/Notify/EventChannelFactory.inl | 2 - TAO/orbsvcs/orbsvcs/Notify/EventType.cpp | 6 + TAO/orbsvcs/orbsvcs/Notify/EventType.h | 7 +- TAO/orbsvcs/orbsvcs/Notify/EventType.inl | 2 - TAO/orbsvcs/orbsvcs/Notify/EventTypeSeq.cpp | 145 +++++-- TAO/orbsvcs/orbsvcs/Notify/EventTypeSeq.h | 15 +- TAO/orbsvcs/orbsvcs/Notify/EventTypeSeq.inl | 3 - TAO/orbsvcs/orbsvcs/Notify/Event_Manager.cpp | 291 ++++++++++---- TAO/orbsvcs/orbsvcs/Notify/Event_Manager.h | 101 +++-- TAO/orbsvcs/orbsvcs/Notify/Event_Manager.inl | 46 ++- TAO/orbsvcs/orbsvcs/Notify/Event_Map_Entry_T.cpp | 7 +- TAO/orbsvcs/orbsvcs/Notify/Event_Map_Entry_T.h | 14 +- TAO/orbsvcs/orbsvcs/Notify/Event_Map_Entry_T.inl | 20 +- TAO/orbsvcs/orbsvcs/Notify/Event_Map_T.cpp | 135 ++++--- TAO/orbsvcs/orbsvcs/Notify/Event_Map_T.h | 57 ++- TAO/orbsvcs/orbsvcs/Notify/Event_Map_T.inl | 40 +- TAO/orbsvcs/orbsvcs/Notify/Factory.h | 94 +++-- TAO/orbsvcs/orbsvcs/Notify/FilterAdmin.cpp | 71 ++-- TAO/orbsvcs/orbsvcs/Notify/FilterAdmin.h | 10 +- TAO/orbsvcs/orbsvcs/Notify/FilterFactory.h | 5 +- TAO/orbsvcs/orbsvcs/Notify/Find_Worker_T.cpp | 47 +++ TAO/orbsvcs/orbsvcs/Notify/Find_Worker_T.h | 72 ++++ TAO/orbsvcs/orbsvcs/Notify/Find_Worker_T.inl | 8 + TAO/orbsvcs/orbsvcs/Notify/ID_Factory.h | 6 +- TAO/orbsvcs/orbsvcs/Notify/ID_Factory.inl | 5 +- TAO/orbsvcs/orbsvcs/Notify/Method_Request.cpp | 56 ++- TAO/orbsvcs/orbsvcs/Notify/Method_Request.h | 42 +- TAO/orbsvcs/orbsvcs/Notify/Method_Request.inl | 2 - .../orbsvcs/Notify/Method_Request_Dispatch.cpp | 47 ++- .../orbsvcs/Notify/Method_Request_Dispatch.h | 17 +- .../orbsvcs/Notify/Method_Request_Dispatch.inl | 2 - .../Method_Request_Dispatch_No_Filtering.cpp | 16 +- .../Notify/Method_Request_Dispatch_No_Filtering.h | 15 +- .../Method_Request_Dispatch_No_Filtering.inl | 2 - .../orbsvcs/Notify/Method_Request_Lookup.cpp | 50 ++- TAO/orbsvcs/orbsvcs/Notify/Method_Request_Lookup.h | 16 +- .../orbsvcs/Notify/Method_Request_Lookup.inl | 2 - .../orbsvcs/Notify/Method_Request_Shutdown.cpp | 8 +- .../orbsvcs/Notify/Method_Request_Shutdown.h | 11 +- .../orbsvcs/Notify/Method_Request_Shutdown.inl | 2 - .../orbsvcs/Notify/Method_Request_Updates.h | 6 +- .../Notify/Notify_Constraint_Interpreter.cpp | 15 +- .../orbsvcs/Notify/Notify_Constraint_Interpreter.h | 13 +- .../orbsvcs/Notify/Notify_Constraint_Visitors.cpp | 110 +++--- .../orbsvcs/Notify/Notify_Constraint_Visitors.h | 4 +- .../orbsvcs/Notify/Notify_Default_CO_Factory.cpp | 344 +---------------- .../orbsvcs/Notify/Notify_Default_CO_Factory.h | 70 +--- .../Notify/Notify_Default_Collection_Factory.cpp | 162 +------- .../Notify/Notify_Default_Collection_Factory.h | 28 +- .../orbsvcs/Notify/Notify_Default_EMO_Factory.cpp | 343 +--------------- .../orbsvcs/Notify/Notify_Default_EMO_Factory.h | 90 +---- .../orbsvcs/Notify/Notify_Default_POA_Factory.cpp | 252 +----------- .../orbsvcs/Notify/Notify_Default_POA_Factory.h | 66 +--- .../Notify/Notify_EventChannelFactory_i.cpp | 221 ++--------- .../orbsvcs/Notify/Notify_EventChannelFactory_i.h | 118 +----- TAO/orbsvcs/orbsvcs/Notify/Object.cpp | 224 +++++++++-- TAO/orbsvcs/orbsvcs/Notify/Object.h | 93 +++-- TAO/orbsvcs/orbsvcs/Notify/Object.inl | 20 +- TAO/orbsvcs/orbsvcs/Notify/POA_Helper.cpp | 6 +- TAO/orbsvcs/orbsvcs/Notify/POA_Helper.h | 4 +- TAO/orbsvcs/orbsvcs/Notify/POA_Helper.inl | 4 +- TAO/orbsvcs/orbsvcs/Notify/Peer.cpp | 109 +++--- TAO/orbsvcs/orbsvcs/Notify/Peer.h | 58 ++- TAO/orbsvcs/orbsvcs/Notify/Peer.inl | 12 +- TAO/orbsvcs/orbsvcs/Notify/Properties.cpp | 25 +- TAO/orbsvcs/orbsvcs/Notify/Properties.h | 69 +++- TAO/orbsvcs/orbsvcs/Notify/Properties.inl | 80 +++- TAO/orbsvcs/orbsvcs/Notify/Proxy.cpp | 107 ++++- TAO/orbsvcs/orbsvcs/Notify/Proxy.h | 50 ++- TAO/orbsvcs/orbsvcs/Notify/Proxy.inl | 8 +- TAO/orbsvcs/orbsvcs/Notify/ProxyConsumer.cpp | 118 ++++-- TAO/orbsvcs/orbsvcs/Notify/ProxyConsumer.h | 27 +- TAO/orbsvcs/orbsvcs/Notify/ProxyConsumer.inl | 12 +- TAO/orbsvcs/orbsvcs/Notify/ProxyConsumer_T.cpp | 3 +- TAO/orbsvcs/orbsvcs/Notify/ProxySupplier.cpp | 134 +++++-- TAO/orbsvcs/orbsvcs/Notify/ProxySupplier.h | 36 +- TAO/orbsvcs/orbsvcs/Notify/ProxySupplier.inl | 10 +- TAO/orbsvcs/orbsvcs/Notify/ProxySupplier_T.cpp | 3 +- TAO/orbsvcs/orbsvcs/Notify/Proxy_T.cpp | 25 ++ TAO/orbsvcs/orbsvcs/Notify/QoSProperties.cpp | 18 +- TAO/orbsvcs/orbsvcs/Notify/QoSProperties.h | 7 +- TAO/orbsvcs/orbsvcs/Notify/README | 2 +- TAO/orbsvcs/orbsvcs/Notify/RT_Builder.cpp | 106 +++++ TAO/orbsvcs/orbsvcs/Notify/RT_Builder.h | 54 +++ TAO/orbsvcs/orbsvcs/Notify/RT_Builder.inl | 3 + TAO/orbsvcs/orbsvcs/Notify/RT_Factory.cpp | 29 ++ TAO/orbsvcs/orbsvcs/Notify/RT_Factory.h | 50 +++ TAO/orbsvcs/orbsvcs/Notify/RT_Factory.inl | 3 + TAO/orbsvcs/orbsvcs/Notify/RT_Notify_Service.cpp | 96 +++++ TAO/orbsvcs/orbsvcs/Notify/RT_Notify_Service.h | 60 +++ TAO/orbsvcs/orbsvcs/Notify/RT_Notify_Service.inl | 3 + TAO/orbsvcs/orbsvcs/Notify/RT_POA_Helper.cpp | 153 ++++++++ TAO/orbsvcs/orbsvcs/Notify/RT_POA_Helper.h | 64 +++ TAO/orbsvcs/orbsvcs/Notify/RT_POA_Helper.inl | 3 + TAO/orbsvcs/orbsvcs/Notify/RT_Properties.cpp | 17 + TAO/orbsvcs/orbsvcs/Notify/RT_Properties.h | 65 ++++ TAO/orbsvcs/orbsvcs/Notify/RT_Properties.inl | 27 ++ TAO/orbsvcs/orbsvcs/Notify/RT_ProxySupplier.cpp | 48 +++ TAO/orbsvcs/orbsvcs/Notify/RT_ProxySupplier.h | 64 +++ TAO/orbsvcs/orbsvcs/Notify/RT_ProxySupplier.inl | 3 + TAO/orbsvcs/orbsvcs/Notify/Reactive_Task.cpp | 33 +- TAO/orbsvcs/orbsvcs/Notify/Reactive_Task.h | 25 +- TAO/orbsvcs/orbsvcs/Notify/Reactive_Task.inl | 6 +- TAO/orbsvcs/orbsvcs/Notify/Refcountable.cpp | 16 +- TAO/orbsvcs/orbsvcs/Notify/Refcountable.h | 33 +- TAO/orbsvcs/orbsvcs/Notify/Refcountable.inl | 13 +- TAO/orbsvcs/orbsvcs/Notify/Seq_Worker_T.cpp | 37 ++ TAO/orbsvcs/orbsvcs/Notify/Seq_Worker_T.h | 68 ++++ TAO/orbsvcs/orbsvcs/Notify/Seq_Worker_T.inl | 9 + .../Notify/Sequence/SequenceProxyPushConsumer.cpp | 7 +- .../Notify/Sequence/SequenceProxyPushConsumer.h | 3 +- .../Notify/Sequence/SequenceProxyPushSupplier.cpp | 11 +- .../Notify/Sequence/SequenceProxyPushSupplier.h | 2 +- .../orbsvcs/Notify/Sequence/SequencePushSupplier.h | 1 - TAO/orbsvcs/orbsvcs/Notify/Service.h | 19 +- .../RTCORBA_StructuredProxyPushConsumer.cpp | 21 - .../RTCORBA_StructuredProxyPushConsumer.h | 46 --- .../RTCORBA_StructuredProxyPushConsumer.inl | 3 - .../RTCORBA_StructuredProxyPushSupplier.cpp | 20 - .../RTCORBA_StructuredProxyPushSupplier.h | 51 --- .../RTCORBA_StructuredProxyPushSupplier.inl | 3 - .../RTCORBA_StructuredProxyPushSupplier_Tie.cpp | 43 --- .../RTCORBA_StructuredProxyPushSupplier_Tie.h | 65 ---- .../RTCORBA_StructuredProxyPushSupplier_Tie.inl | 3 - .../Structured/RT_StructuredProxyPushSupplier.cpp | 44 +++ .../Structured/RT_StructuredProxyPushSupplier.h | 58 +++ .../Structured/RT_StructuredProxyPushSupplier.inl | 3 + .../orbsvcs/Notify/Structured/StructuredEvent.cpp | 44 --- .../orbsvcs/Notify/Structured/StructuredEvent.h | 62 --- .../orbsvcs/Notify/Structured/StructuredEvent.inl | 4 - .../Structured/StructuredProxyPushConsumer.cpp | 249 ------------ .../Structured/StructuredProxyPushConsumer.h | 185 --------- .../Structured/StructuredProxyPushConsumer.inl | 3 - .../Structured/StructuredProxyPushSupplier.cpp | 311 --------------- .../Structured/StructuredProxyPushSupplier.h | 222 ----------- .../Structured/StructuredProxyPushSupplier.inl | 3 - .../Structured/StructuredProxyPushSupplier_Tie.cpp | 42 -- .../Structured/StructuredProxyPushSupplier_Tie.h | 60 --- .../Structured/StructuredProxyPushSupplier_Tie.inl | 3 - .../Notify/Structured/StructuredPushConsumer.cpp | 32 -- .../Notify/Structured/StructuredPushConsumer.h | 56 --- .../Notify/Structured/StructuredPushConsumer.inl | 3 - .../Notify/Structured/StructuredPushSupplier.cpp | 26 -- .../Notify/Structured/StructuredPushSupplier.h | 54 --- .../Notify/Structured/StructuredPushSupplier.inl | 3 - .../orbsvcs/Notify/Subscription_Change_Worker.inl | 5 +- TAO/orbsvcs/orbsvcs/Notify/Supplier.cpp | 9 + TAO/orbsvcs/orbsvcs/Notify/Supplier.h | 9 + TAO/orbsvcs/orbsvcs/Notify/Supplier.inl | 2 - TAO/orbsvcs/orbsvcs/Notify/SupplierAdmin.cpp | 207 +++++----- TAO/orbsvcs/orbsvcs/Notify/SupplierAdmin.h | 105 ++--- TAO/orbsvcs/orbsvcs/Notify/SupplierAdmin.inl | 2 - TAO/orbsvcs/orbsvcs/Notify/Supplier_Map.h | 35 ++ TAO/orbsvcs/orbsvcs/Notify/ThreadPool_Task.cpp | 156 ++++++-- TAO/orbsvcs/orbsvcs/Notify/ThreadPool_Task.h | 40 +- TAO/orbsvcs/orbsvcs/Notify/ThreadPool_Task.inl | 14 +- TAO/orbsvcs/orbsvcs/Notify/Timer_Queue.cpp | 2 - TAO/orbsvcs/orbsvcs/Notify/Timer_Queue.h | 4 +- TAO/orbsvcs/orbsvcs/Notify/Timer_Reactor.cpp | 4 +- TAO/orbsvcs/orbsvcs/Notify/Timer_Reactor.h | 4 +- TAO/orbsvcs/orbsvcs/Notify/Worker_Task.cpp | 3 +- TAO/orbsvcs/orbsvcs/Notify/Worker_Task.h | 27 +- TAO/orbsvcs/orbsvcs/Notify/Worker_Task.inl | 2 - TAO/orbsvcs/orbsvcs/Notify/notify_export.h | 1 + 212 files changed, 6206 insertions(+), 5222 deletions(-) create mode 100644 TAO/orbsvcs/orbsvcs/Notify/Consumer_Map.h create mode 100644 TAO/orbsvcs/orbsvcs/Notify/CosNotify_Service.cpp create mode 100644 TAO/orbsvcs/orbsvcs/Notify/CosNotify_Service.h create mode 100644 TAO/orbsvcs/orbsvcs/Notify/CosNotify_Service.inl create mode 100644 TAO/orbsvcs/orbsvcs/Notify/Default_Factory.cpp create mode 100644 TAO/orbsvcs/orbsvcs/Notify/Default_Factory.h create mode 100644 TAO/orbsvcs/orbsvcs/Notify/Default_Factory.inl create mode 100644 TAO/orbsvcs/orbsvcs/Notify/Find_Worker_T.cpp create mode 100644 TAO/orbsvcs/orbsvcs/Notify/Find_Worker_T.h create mode 100644 TAO/orbsvcs/orbsvcs/Notify/Find_Worker_T.inl create mode 100644 TAO/orbsvcs/orbsvcs/Notify/RT_Builder.cpp create mode 100644 TAO/orbsvcs/orbsvcs/Notify/RT_Builder.h create mode 100644 TAO/orbsvcs/orbsvcs/Notify/RT_Builder.inl create mode 100644 TAO/orbsvcs/orbsvcs/Notify/RT_Factory.cpp create mode 100644 TAO/orbsvcs/orbsvcs/Notify/RT_Factory.h create mode 100644 TAO/orbsvcs/orbsvcs/Notify/RT_Factory.inl create mode 100644 TAO/orbsvcs/orbsvcs/Notify/RT_Notify_Service.cpp create mode 100644 TAO/orbsvcs/orbsvcs/Notify/RT_Notify_Service.h create mode 100644 TAO/orbsvcs/orbsvcs/Notify/RT_Notify_Service.inl create mode 100644 TAO/orbsvcs/orbsvcs/Notify/RT_POA_Helper.cpp create mode 100644 TAO/orbsvcs/orbsvcs/Notify/RT_POA_Helper.h create mode 100644 TAO/orbsvcs/orbsvcs/Notify/RT_POA_Helper.inl create mode 100644 TAO/orbsvcs/orbsvcs/Notify/RT_Properties.cpp create mode 100644 TAO/orbsvcs/orbsvcs/Notify/RT_Properties.h create mode 100644 TAO/orbsvcs/orbsvcs/Notify/RT_Properties.inl create mode 100644 TAO/orbsvcs/orbsvcs/Notify/RT_ProxySupplier.cpp create mode 100644 TAO/orbsvcs/orbsvcs/Notify/RT_ProxySupplier.h create mode 100644 TAO/orbsvcs/orbsvcs/Notify/RT_ProxySupplier.inl create mode 100644 TAO/orbsvcs/orbsvcs/Notify/Seq_Worker_T.cpp create mode 100644 TAO/orbsvcs/orbsvcs/Notify/Seq_Worker_T.h create mode 100644 TAO/orbsvcs/orbsvcs/Notify/Seq_Worker_T.inl delete mode 100644 TAO/orbsvcs/orbsvcs/Notify/Structured/RTCORBA_StructuredProxyPushConsumer.cpp delete mode 100644 TAO/orbsvcs/orbsvcs/Notify/Structured/RTCORBA_StructuredProxyPushConsumer.h delete mode 100644 TAO/orbsvcs/orbsvcs/Notify/Structured/RTCORBA_StructuredProxyPushConsumer.inl delete mode 100644 TAO/orbsvcs/orbsvcs/Notify/Structured/RTCORBA_StructuredProxyPushSupplier.cpp delete mode 100644 TAO/orbsvcs/orbsvcs/Notify/Structured/RTCORBA_StructuredProxyPushSupplier.h delete mode 100644 TAO/orbsvcs/orbsvcs/Notify/Structured/RTCORBA_StructuredProxyPushSupplier.inl delete mode 100644 TAO/orbsvcs/orbsvcs/Notify/Structured/RTCORBA_StructuredProxyPushSupplier_Tie.cpp delete mode 100644 TAO/orbsvcs/orbsvcs/Notify/Structured/RTCORBA_StructuredProxyPushSupplier_Tie.h delete mode 100644 TAO/orbsvcs/orbsvcs/Notify/Structured/RTCORBA_StructuredProxyPushSupplier_Tie.inl create mode 100644 TAO/orbsvcs/orbsvcs/Notify/Structured/RT_StructuredProxyPushSupplier.cpp create mode 100644 TAO/orbsvcs/orbsvcs/Notify/Structured/RT_StructuredProxyPushSupplier.h create mode 100644 TAO/orbsvcs/orbsvcs/Notify/Structured/RT_StructuredProxyPushSupplier.inl delete mode 100644 TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredEvent.cpp delete mode 100644 TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredEvent.h delete mode 100644 TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredEvent.inl delete mode 100644 TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushConsumer.cpp delete mode 100644 TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushConsumer.h delete mode 100644 TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushConsumer.inl delete mode 100644 TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier.cpp delete mode 100644 TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier.h delete mode 100644 TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier.inl delete mode 100644 TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier_Tie.cpp delete mode 100644 TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier_Tie.h delete mode 100644 TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier_Tie.inl delete mode 100644 TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushConsumer.cpp delete mode 100644 TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushConsumer.h delete mode 100644 TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushConsumer.inl delete mode 100644 TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushSupplier.cpp delete mode 100644 TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushSupplier.h delete mode 100644 TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushSupplier.inl create mode 100644 TAO/orbsvcs/orbsvcs/Notify/Supplier_Map.h diff --git a/TAO/orbsvcs/orbsvcs/Notify/Admin.cpp b/TAO/orbsvcs/orbsvcs/Notify/Admin.cpp index 1ceae887444..6723aa20d68 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Admin.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Admin.cpp @@ -1,10 +1,6 @@ // $Id$ #include "Admin.h" -#include "EventChannel.h" -#include "Proxy.h" -#include "orbsvcs/ESF/ESF_Proxy_Collection.h" -#include "orbsvcs/CosNotifyChannelAdminC.h" #if ! defined (__ACE_INLINE__) #include "Admin.inl" @@ -12,25 +8,90 @@ ACE_RCSID(RT_Notify, TAO_NS_Admin, "$Id$") +#include "orbsvcs/CosNotifyChannelAdminC.h" + +#include "Container_T.h" +#include "Proxy.h" +#include "EventChannel.h" + TAO_NS_Admin::TAO_NS_Admin (void) - :filter_operator_ (CosNotifyChannelAdmin::OR_OP) + : ec_ (0) + , proxy_container_ (0) + , filter_operator_ (CosNotifyChannelAdmin::OR_OP) { // Initialize all Admin objects to initially be subscribed for all events. - // This is a reasonable default and is ewquired to allow Cos Event consumers/suppliers to send/receive events, + // This is a reasonable default and is required to allow Cos Event consumers/suppliers to send/receive events, this->subscribed_types_.insert (TAO_NS_EventType::special ()); } TAO_NS_Admin::~TAO_NS_Admin () { + this->ec_->_decr_refcnt (); +} + +void +TAO_NS_Admin::init (TAO_NS_EventChannel *ec ACE_ENV_ARG_DECL) +{ + this->ec_ = ec; + + this->ec_->_incr_refcnt (); + + this->TAO_NS_Object::init (ec); + + ACE_NEW_THROW_EX (this->proxy_container_, + TAO_NS_Proxy_Container (), + CORBA::INTERNAL ()); + ACE_CHECK; + + this->proxy_container_->init (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + } void -TAO_NS_Admin::subscribed_types (TAO_NS_EventTypeSeq& subscribed_types) +TAO_NS_Admin::remove (TAO_NS_Proxy* proxy ACE_ENV_ARG_DECL) +{ + this->proxy_container_->remove (proxy ACE_ENV_ARG_PARAMETER); + ACE_CHECK; +} + +void +TAO_NS_Admin::subscribed_types (TAO_NS_EventTypeSeq& subscribed_types ACE_ENV_ARG_DECL) { ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, ace_mon, this->lock_, - CORBA::INTERNAL ()); + CORBA::INTERNAL ()); ACE_CHECK; // copy subscribed_types = this->subscribed_types_; } + +int +TAO_NS_Admin::shutdown (ACE_ENV_SINGLE_ARG_DECL) +{ + if (TAO_NS_Object::shutdown (ACE_ENV_SINGLE_ARG_PARAMETER) == 1) + return 1; + + this->proxy_container_->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (1); + + delete this->proxy_container_; + + return 0; +} + +void +TAO_NS_Admin::insert (TAO_NS_Proxy* proxy ACE_ENV_ARG_DECL) +{ + this->proxy_container_->insert (proxy ACE_ENV_ARG_PARAMETER); +} + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) + +template class TAO_NS_Container_T ; + +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) + +#pragma instantiate TAO_NS_Container_T + +#endif /*ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Admin.h b/TAO/orbsvcs/orbsvcs/Notify/Admin.h index 8514026776b..12228fb5a67 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Admin.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Admin.h @@ -19,28 +19,43 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#include "Container_T.h" #include "FilterAdmin.h" #include "EventTypeSeq.h" +#include "Object.h" class TAO_NS_Proxy; class TAO_NS_EventChannel; +template class TAO_NS_Container_T; /** * @class TAO_NS_Admin * - * @brief + * @brief Base class for the ConsumerAdmin and SupplierAdmin. * */ -class TAO_Notify_Export TAO_NS_Admin : public TAO_NS_Container_T + +class TAO_Notify_Export TAO_NS_Admin : public virtual TAO_NS_Object { + friend class TAO_NS_Builder; public: + typedef CosNotifyChannelAdmin::AdminIDSeq SEQ; + typedef CosNotifyChannelAdmin::AdminIDSeq_var SEQ_VAR; + /// Constuctor TAO_NS_Admin (void); /// Destructor ~TAO_NS_Admin (); + /// Init + void init (TAO_NS_EventChannel *ec ACE_ENV_ARG_DECL); + + /// Insert the proxy in the . + void insert (TAO_NS_Proxy* proxy ACE_ENV_ARG_DECL); + + /// Remove type from container_ + void remove (TAO_NS_Proxy *proxy ACE_ENV_ARG_DECL); + /// Access Admin FilterAdmin. TAO_NS_FilterAdmin& filter_admin (void); @@ -51,13 +66,22 @@ public: CosNotifyChannelAdmin::InterFilterGroupOperator filter_operator (void); /// Obtain the Admin's subscribed types. - void subscribed_types (TAO_NS_EventTypeSeq& subscribed_types); + void subscribed_types (TAO_NS_EventTypeSeq& subscribed_types ACE_ENV_ARG_DECL); + + /// Shutdown + virtual int shutdown (ACE_ENV_SINGLE_ARG_DECL); protected: - typedef TAO_NS_Container_T inherited; + typedef TAO_NS_Container_T TAO_NS_Proxy_Container; /// = Data Members + /// The EventChannel. + TAO_NS_EventChannel *ec_; + + /// The Proxy Container. + TAO_NS_Proxy_Container *proxy_container_;; + /// The types that we've subscribed our proxy objects with the event manager. TAO_NS_EventTypeSeq subscribed_types_; diff --git a/TAO/orbsvcs/orbsvcs/Notify/Admin.inl b/TAO/orbsvcs/orbsvcs/Notify/Admin.inl index 6b3949f1076..2975697d92a 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Admin.inl +++ b/TAO/orbsvcs/orbsvcs/Notify/Admin.inl @@ -1,7 +1,5 @@ // $Id$ -#include "Admin.h" - ACE_INLINE TAO_NS_FilterAdmin& TAO_NS_Admin::filter_admin (void) { diff --git a/TAO/orbsvcs/orbsvcs/Notify/AdminProperties.h b/TAO/orbsvcs/orbsvcs/Notify/AdminProperties.h index fe14835ab24..e05e06d2b1c 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/AdminProperties.h +++ b/TAO/orbsvcs/orbsvcs/Notify/AdminProperties.h @@ -22,7 +22,6 @@ #include "ace/Atomic_Op.h" #include "ace/Refcounted_Auto_Ptr.h" #include "tao/orbconf.h" -#include "Types.h" #include "PropertySeq.h" #include "Property_T.h" #include "Property.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushConsumer.cpp b/TAO/orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushConsumer.cpp index a8f0fa35236..92576ba0b82 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushConsumer.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushConsumer.cpp @@ -8,9 +8,7 @@ ACE_RCSID(Notify, TAO_NS_CosEC_ProxyPushConsumer, "$id$") -#include "ace/Refcounted_Auto_Ptr.h" #include "tao/debug.h" -#include "../Admin.h" #include "../AdminProperties.h" #include "AnyEvent.h" #include "PushSupplier.h" @@ -36,7 +34,10 @@ TAO_NS_CosEC_ProxyPushConsumer::destroy (ACE_ENV_SINGLE_ARG_DECL) if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "In TAO_NS_CosEC_ProxyPushConsumer::destroy \n")); - this->inherited::destroy (this ACE_ENV_ARG_PARAMETER); + if (this->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER) == 1) + return; + + ACE_CHECK; } void diff --git a/TAO/orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushConsumer.h b/TAO/orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushConsumer.h index 780eb08aaa2..08b822c921f 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushConsumer.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushConsumer.h @@ -21,7 +21,6 @@ #include "orbsvcs/CosEventChannelAdminS.h" #include "../ProxyConsumer_T.h" -#include "../Destroy_Callback.h" #if defined(_MSC_VER) #if (_MSC_VER >= 1200) @@ -36,7 +35,7 @@ * @brief * */ -class TAO_Notify_Export TAO_NS_CosEC_ProxyPushConsumer : public virtual TAO_NS_ProxyConsumer_T , public TAO_NS_Destroy_Callback +class TAO_Notify_Export TAO_NS_CosEC_ProxyPushConsumer : public virtual TAO_NS_ProxyConsumer_T { friend class TAO_NS_Builder; public: @@ -46,7 +45,7 @@ public: /// Destructor ~TAO_NS_CosEC_ProxyPushConsumer (); - /// TAO_NS_Destroy_Callback methods + /// Release virtual void release (void); /// Destroy this object. diff --git a/TAO/orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushSupplier.cpp b/TAO/orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushSupplier.cpp index 401d9e8d604..c4c139cf9c8 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushSupplier.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushSupplier.cpp @@ -10,12 +10,6 @@ ACE_RCSID(Notify, TAO_NS_CosEC_ProxyPushSupplier, "$id$") #include "tao/debug.h" #include "PushConsumer.h" -#include "../Proxy.h" -#include "../Admin.h" -#include "../EventChannel.h" -#include "../EventChannelFactory.h" -#include "../Notify_Service.h" - TAO_NS_CosEC_ProxyPushSupplier::TAO_NS_CosEC_ProxyPushSupplier (void) { @@ -31,7 +25,10 @@ TAO_NS_CosEC_ProxyPushSupplier::destroy (ACE_ENV_SINGLE_ARG_DECL) if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "In TAO_NS_ProxyPushConsumer::destroy \n")); - this->inherited::destroy (this ACE_ENV_ARG_PARAMETER); + if (this->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER) == 1) + return; + + ACE_CHECK; } void diff --git a/TAO/orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushSupplier.h b/TAO/orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushSupplier.h index a7a27dc3221..3f3a794e2b8 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushSupplier.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Any/CosEC_ProxyPushSupplier.h @@ -40,7 +40,7 @@ TAO_NS_ProxySupplier_T; * @brief * */ -class TAO_Notify_Export TAO_NS_CosEC_ProxyPushSupplier : public virtual TAO_NS_ProxySupplier_T , public TAO_NS_Destroy_Callback +class TAO_Notify_Export TAO_NS_CosEC_ProxyPushSupplier : public virtual TAO_NS_ProxySupplier_T { friend class TAO_NS_Builder; public: @@ -53,7 +53,7 @@ public: /// Destroy this object. virtual void destroy (ACE_ENV_SINGLE_ARG_DECL); - /// TAO_NS_Destroy_Callback methods + /// Release virtual void release (void); // = Interface methods diff --git a/TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushConsumer.cpp b/TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushConsumer.cpp index 8b2ec3bb101..d09f50987a7 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushConsumer.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushConsumer.cpp @@ -8,9 +8,7 @@ ACE_RCSID(Notify, TAO_NS_ProxyPushConsumer, "$id$") -#include "ace/Refcounted_Auto_Ptr.h" #include "tao/debug.h" -#include "../Admin.h" #include "../AdminProperties.h" #include "AnyEvent.h" #include "PushSupplier.h" @@ -39,7 +37,10 @@ TAO_NS_ProxyPushConsumer::destroy (ACE_ENV_SINGLE_ARG_DECL) if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "In TAO_NS_ProxyPushConsumer::destroy \n")); - this->inherited::destroy (this ACE_ENV_ARG_PARAMETER); + if (this->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER) == 1) + return; + + ACE_CHECK; } CosNotifyChannelAdmin::ProxyType diff --git a/TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushConsumer.h b/TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushConsumer.h index 83eb801af1f..90a6fd5a7c4 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushConsumer.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushConsumer.h @@ -21,7 +21,6 @@ #include "orbsvcs/CosNotifyChannelAdminS.h" #include "../ProxyConsumer_T.h" -#include "../Destroy_Callback.h" #if defined(_MSC_VER) #if (_MSC_VER >= 1200) @@ -36,7 +35,7 @@ * @brief * */ -class TAO_Notify_Export TAO_NS_ProxyPushConsumer : public virtual TAO_NS_ProxyConsumer_T , public TAO_NS_Destroy_Callback +class TAO_Notify_Export TAO_NS_ProxyPushConsumer : public virtual TAO_NS_ProxyConsumer_T { friend class TAO_NS_Builder; public: @@ -46,7 +45,7 @@ public: /// Destructor ~TAO_NS_ProxyPushConsumer (); - /// TAO_NS_Destroy_Callback methods + /// Release virtual void release (void); /// Destroy this object. diff --git a/TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushSupplier.cpp b/TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushSupplier.cpp index a430c6f0a1c..81612398502 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushSupplier.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushSupplier.cpp @@ -10,12 +10,6 @@ ACE_RCSID(Notify, TAO_NS_ProxyPushSupplier, "$id$") #include "tao/debug.h" #include "PushConsumer.h" -#include "../Proxy.h" -#include "../Admin.h" -#include "../EventChannel.h" -#include "../EventChannelFactory.h" -#include "../Notify_Service.h" - TAO_NS_ProxyPushSupplier::TAO_NS_ProxyPushSupplier (void) { @@ -31,7 +25,10 @@ TAO_NS_ProxyPushSupplier::destroy (ACE_ENV_SINGLE_ARG_DECL) if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "In TAO_NS_ProxyPushConsumer::destroy \n")); - this->inherited::destroy (this ACE_ENV_ARG_PARAMETER); + if (this->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER) == 1) + return; + + ACE_CHECK; } void diff --git a/TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushSupplier.h b/TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushSupplier.h index 66a6f0de2d8..8d2e9bb8277 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushSupplier.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Any/ProxyPushSupplier.h @@ -41,7 +41,7 @@ TAO_NS_ProxySupplier_T; * @brief * */ -class TAO_Notify_Export TAO_NS_ProxyPushSupplier : public virtual TAO_NS_ProxySupplier_T , public TAO_NS_Destroy_Callback +class TAO_Notify_Export TAO_NS_ProxyPushSupplier : public virtual TAO_NS_ProxySupplier_T { friend class TAO_NS_Builder; public: diff --git a/TAO/orbsvcs/orbsvcs/Notify/Any/PushConsumer.h b/TAO/orbsvcs/orbsvcs/Notify/Any/PushConsumer.h index 5660ddeee77..7a3d5c7ed39 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Any/PushConsumer.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Any/PushConsumer.h @@ -21,7 +21,6 @@ #include "orbsvcs/CosNotifyCommC.h" #include "../Consumer.h" -#include "../Destroy_Callback.h" /** * @class TAO_NS_PushConsumer diff --git a/TAO/orbsvcs/orbsvcs/Notify/Any/PushSupplier.h b/TAO/orbsvcs/orbsvcs/Notify/Any/PushSupplier.h index 3ba1c4fb2c0..be260eb1710 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Any/PushSupplier.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Any/PushSupplier.h @@ -22,7 +22,6 @@ #include "orbsvcs/CosNotifyCommC.h" #include "../Supplier.h" -#include "../Destroy_Callback.h" class TAO_NS_ProxyConsumer; diff --git a/TAO/orbsvcs/orbsvcs/Notify/Builder.cpp b/TAO/orbsvcs/orbsvcs/Notify/Builder.cpp index 33367514fc1..7f260d10cca 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Builder.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Builder.cpp @@ -7,7 +7,7 @@ ACE_RCSID(RT_Notify, TAO_NS_Builder, "$Id$") -#include "ace/Auto_Ptr.h" +#include "ace/Dynamic_Service.h" #include "tao/PortableServer/PortableServerC.h" #include "Factory.h" #include "Properties.h" @@ -17,14 +17,129 @@ ACE_RCSID(RT_Notify, TAO_NS_Builder, "$Id$") #include "EventChannel.h" #include "SupplierAdmin.h" #include "ConsumerAdmin.h" -#include "Structured/StructuredProxyPushConsumer.h" -#include "Structured/StructuredProxyPushSupplier.h" #include "Event_Manager.h" #include "Worker_Task.h" #include "Reactive_Task.h" #include "ThreadPool_Task.h" #include "FilterFactory.h" -#include "ace/Dynamic_Service.h" +#include "Object.h" +#include "EventType.h" +#include "Event.h" +#include "Any/AnyEvent.h" +#include "Any/ProxyPushConsumer.h" +#include "Any/ProxyPushSupplier.h" +#include "Any/CosEC_ProxyPushConsumer.h" +#include "Any/CosEC_ProxyPushSupplier.h" +#include "Structured/StructuredProxyPushConsumer.h" +#include "Structured/StructuredProxyPushSupplier.h" +#include "Sequence/SequenceProxyPushConsumer.h" +#include "Sequence/SequenceProxyPushSupplier.h" +#include "ETCL_FilterFactory.h" +#include "Container_T.h" + +template +class TAO_NS_Proxy_Builder_T +{ +public: + PROXY_PTR + build (PARENT *parent, CosNotifyChannelAdmin::ProxyID_out proxy_id ACE_ENV_ARG_DECL) + { + PROXY_VAR proxy_ret; + + TAO_NS_Factory* factory = TAO_NS_PROPERTIES::instance ()->factory (); + + PROXY_IMPL* proxy = 0; + factory->create (proxy ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (proxy_ret._retn ()); + + PortableServer::ServantBase_var servant (proxy); + + proxy->init (parent ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (proxy_ret._retn ()); + + CORBA::Object_var obj = proxy->activate (proxy ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (proxy_ret._retn ()); + + proxy_id = proxy->id (); + + proxy_ret = PROXY::_narrow (obj.in() ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (proxy_ret._retn ()); + + // insert proxy in admin container. + parent->insert (proxy ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (PROXY::_nil ()); + + return proxy_ret._retn (); + } +}; + +// define the ProxyConsumer Builders. +typedef TAO_NS_Proxy_Builder_T +TAO_NS_ProxyPushConsumer_Builder; + +typedef TAO_NS_Proxy_Builder_T +TAO_NS_StructuredProxyPushConsumer_Builder; + +typedef TAO_NS_Proxy_Builder_T +TAO_NS_SequenceProxyPushConsumer_Builder; + +typedef TAO_NS_Proxy_Builder_T +TAO_NS_CosEC_ProxyPushConsumer_Builder; + +// define the ProxySupplier Builders. +typedef TAO_NS_Proxy_Builder_T +TAO_NS_ProxyPushSupplier_Builder; + +typedef TAO_NS_Proxy_Builder_T +TAO_NS_StructuredProxyPushSupplier_Builder; + +typedef TAO_NS_Proxy_Builder_T +TAO_NS_SequenceProxyPushSupplier_Builder; + +typedef TAO_NS_Proxy_Builder_T +TAO_NS_CosEC_ProxyPushSupplier_Builder; + +TAO_NS_Builder::TAO_NS_Builder (void) +{ + // Init the static members. + TAO_NS_AnyEvent::event_type_ = TAO_NS_EventType::special (); +} + +TAO_NS_Builder::~TAO_NS_Builder () +{ +} CosNotifyFilter::FilterFactory_ptr TAO_NS_Builder::build_filter_factory (ACE_ENV_SINGLE_ARG_DECL) @@ -32,9 +147,16 @@ TAO_NS_Builder::build_filter_factory (ACE_ENV_SINGLE_ARG_DECL) TAO_NS_FilterFactory* ff = ACE_Dynamic_Service::instance ("TAO_NS_FilterFactory"); if (ff == 0) - return CosNotifyFilter::FilterFactory::_nil (); - else - return ff->create (ACE_ENV_SINGLE_ARG_PARAMETER); + { + ACE_NEW_THROW_EX (ff, + TAO_NS_ETCL_FilterFactory (), + CORBA::NO_MEMORY ()); + ACE_CHECK_RETURN (CosNotifyFilter::FilterFactory::_nil ()); + } + + PortableServer::POA_var default_poa = TAO_NS_PROPERTIES::instance ()->default_poa (); + + return ff->create (default_poa ACE_ENV_ARG_PARAMETER); } CosNotifyChannelAdmin::EventChannelFactory_ptr @@ -44,44 +166,18 @@ TAO_NS_Builder::build_event_channel_factory (PortableServer::POA_ptr poa ACE_ENV TAO_NS_Factory* factory = TAO_NS_PROPERTIES::instance ()->factory (); - TAO_NS_POA_Helper* object_poa = 0; - // Bootstrap initial Object POA - ACE_NEW_THROW_EX (object_poa, - TAO_NS_POA_Helper (), - CORBA::NO_MEMORY ()); - ACE_CHECK_RETURN (ecf_ret._retn ()); - - auto_ptr auto_object_poa (object_poa); - - object_poa->init (poa ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (ecf_ret._retn ()); - // Create ECF TAO_NS_EventChannelFactory* ecf = 0; factory->create (ecf ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (ecf_ret._retn ()); - ecf->TAO_NS_EventChannelFactory::init (ACE_ENV_ARG_PARAMETER); - - ecf->destroy_callback (ecf); - PortableServer::ServantBase_var servant_var (ecf); - ecf->TAO_NS_Container_T ::init (object_poa, 0, object_poa, object_poa ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (ecf_ret._retn ()); + ecf->TAO_NS_EventChannelFactory::init (poa ACE_ENV_ARG_PARAMETER); - ecf->init_collection (ACE_ENV_SINGLE_ARG_PARAMETER); + CORBA::Object_var obj = ecf->activate (ecf ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (ecf_ret._retn ()); - // Give ownership of object_poa - ecf->object_poa (object_poa); - - CORBA::Object_var obj = ecf->activate (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (ecf_ret._retn ()); - - // release auto_ref. - auto_object_poa.release (); - ecf_ret = CosNotifyChannelAdmin::EventChannelFactory::_narrow (obj.in() ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (ecf_ret._retn ()); @@ -90,11 +186,6 @@ TAO_NS_Builder::build_event_channel_factory (PortableServer::POA_ptr poa ACE_ENV CosNotifyChannelAdmin::EventChannel_ptr TAO_NS_Builder::build_event_channel (TAO_NS_EventChannelFactory* ecf, const CosNotification::QoSProperties & initial_qos, const CosNotification::AdminProperties & initial_admin, CosNotifyChannelAdmin::ChannelID_out id ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException - , CosNotification::UnsupportedQoS - , CosNotification::UnsupportedAdmin - )) { CosNotifyChannelAdmin::EventChannel_var ec_ret; @@ -104,46 +195,19 @@ TAO_NS_Builder::build_event_channel (TAO_NS_EventChannelFactory* ecf, const CosN factory->create (ec ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (ec_ret._retn ()); - ec->destroy_callback (ec); - PortableServer::ServantBase_var servant_var (ec); - // set the parent - - ec->parent_ = ecf; - - ec->init (ecf->object_poa(), 0, ecf->object_poa(), ecf->object_poa() ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (ec_ret._retn ()); - - // Create the default worker task. - TAO_NS_Reactive_Task* worker_task = new TAO_NS_Reactive_Task (); - ec->worker_task_own (worker_task); - - // proxy poa is set next. - ec->init_collection (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (ec_ret._retn ()); - - // insert ec in ecf container. - ecf->insert (ec ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (ec_ret._retn ()); - - // create the event manager. @@ use factory - ACE_NEW_THROW_EX (ec->event_manager_, - TAO_NS_Event_Manager (), - CORBA::NO_MEMORY ()); - ACE_CHECK_RETURN (ec_ret._retn ()); - - ec->event_manager_->init (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (ec_ret._retn ()); - - ec->set_qos (initial_qos ACE_ENV_ARG_PARAMETER); + ec->init (ecf, initial_qos, initial_admin ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (ec_ret._retn ()); - ec->set_admin (initial_admin ACE_ENV_ARG_PARAMETER); + // insert ec in ec container. + ecf->ec_container_->insert (ec ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (ec_ret._retn ()); - CORBA::Object_var obj = ec->activate (ACE_ENV_SINGLE_ARG_PARAMETER); + CORBA::Object_var obj = ec->activate (ec ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (ec_ret._retn ()); + // Populate the ID to return. id = ec->id (); ec_ret = CosNotifyChannelAdmin::EventChannel::_narrow (obj.in() ACE_ENV_ARG_PARAMETER); @@ -154,9 +218,6 @@ TAO_NS_Builder::build_event_channel (TAO_NS_EventChannelFactory* ecf, const CosN CosNotifyChannelAdmin::ConsumerAdmin_ptr TAO_NS_Builder::build_consumer_admin (TAO_NS_EventChannel* ec, CosNotifyChannelAdmin::InterFilterGroupOperator op, CosNotifyChannelAdmin::AdminID_out id ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException - )) { CosNotifyChannelAdmin::ConsumerAdmin_var ca_ret; @@ -166,24 +227,14 @@ TAO_NS_Builder::build_consumer_admin (TAO_NS_EventChannel* ec, CosNotifyChannelA factory->create (ca ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (ca_ret._retn ()); - ca->destroy_callback (ca); - ca->filter_operator (op); - - ca->parent_ = ec; - ca->event_manager_ = ec->event_manager_; - PortableServer::ServantBase_var servant_var (ca); - ca->init (ec->object_poa (), ec->worker_task (), ec->object_poa (), ec->proxy_poa () ACE_ENV_ARG_PARAMETER); + ca->init (ec ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (ca_ret._retn ()); - ca->init_collection (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (ca_ret._retn ()); - - // insert admin in ec container. - ec->insert (ca ACE_ENV_ARG_PARAMETER); + ca->filter_operator (op); - CORBA::Object_var obj = ca->activate (ACE_ENV_SINGLE_ARG_PARAMETER); + CORBA::Object_var obj = ca->activate (ca ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (ca_ret._retn ()); id = ca->id (); @@ -191,14 +242,15 @@ TAO_NS_Builder::build_consumer_admin (TAO_NS_EventChannel* ec, CosNotifyChannelA ca_ret = CosNotifyChannelAdmin::ConsumerAdmin::_narrow (obj.in() ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (ca_ret._retn ()); + // insert admin in CA container. + ec->ca_container_->insert (ca ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (ca_ret._retn ()); + return ca_ret._retn (); } CosNotifyChannelAdmin::SupplierAdmin_ptr TAO_NS_Builder::build_supplier_admin (TAO_NS_EventChannel* ec, CosNotifyChannelAdmin::InterFilterGroupOperator op, CosNotifyChannelAdmin::AdminID_out id ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException - )) { CosNotifyChannelAdmin::SupplierAdmin_var sa_ret; @@ -208,24 +260,14 @@ TAO_NS_Builder::build_supplier_admin (TAO_NS_EventChannel* ec, CosNotifyChannelA factory->create (sa ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (sa_ret._retn ()); - sa->destroy_callback (sa); - sa->filter_operator (op); - - sa->parent_ = ec; - sa->event_manager_ = ec->event_manager_; - PortableServer::ServantBase_var servant_var (sa); - sa->init (ec->object_poa (), ec->worker_task (), ec->object_poa (), ec->proxy_poa () ACE_ENV_ARG_PARAMETER); + sa->init (ec ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (sa_ret._retn ()); - sa->init_collection (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (sa_ret._retn ()); - - // insert admin in ec container. - ec->insert (sa ACE_ENV_ARG_PARAMETER); + sa->filter_operator (op); - CORBA::Object_var obj = sa->activate (ACE_ENV_SINGLE_ARG_PARAMETER); + CORBA::Object_var obj = sa->activate (sa ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (sa_ret._retn ()); id = sa->id (); @@ -233,120 +275,74 @@ TAO_NS_Builder::build_supplier_admin (TAO_NS_EventChannel* ec, CosNotifyChannelA sa_ret = CosNotifyChannelAdmin::SupplierAdmin::_narrow (obj.in() ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (sa_ret._retn ()); + // insert admin in SA container. + ec->sa_container_->insert (sa ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (sa_ret._retn ()); + return sa_ret._retn (); } CosNotifyChannelAdmin::ProxyConsumer_ptr -TAO_NS_Builder::build_notification_push_consumer (TAO_NS_SupplierAdmin* sa, CosNotifyChannelAdmin::ClientType ctype, CosNotifyChannelAdmin::ProxyID_out proxy_id ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException - , CosNotifyChannelAdmin::AdminLimitExceeded - )) - +TAO_NS_Builder::build_proxy(TAO_NS_SupplierAdmin* sa + , CosNotifyChannelAdmin::ClientType ctype + , CosNotifyChannelAdmin::ProxyID_out proxy_id + ACE_ENV_ARG_DECL) { - CosNotifyChannelAdmin::ProxyConsumer_var proxy_ret; - - TAO_NS_Factory* factory = TAO_NS_PROPERTIES::instance ()->factory (); - switch (ctype) { case CosNotifyChannelAdmin::ANY_EVENT: { - + TAO_NS_ProxyPushConsumer_Builder pb; + return pb.build (sa, proxy_id ACE_ENV_ARG_PARAMETER); } - break; + break; case CosNotifyChannelAdmin::STRUCTURED_EVENT: { - TAO_NS_StructuredProxyPushConsumer* pc = 0; - factory->create (pc ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (proxy_ret._retn ()); - - pc->destroy_callback (pc); - - PortableServer::ServantBase_var servantbase_var (pc); - - pc->event_manager_ = sa->event_manager_; - pc->parent_ = sa; - - pc->init (sa->proxy_poa (), sa->worker_task () ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (proxy_ret._retn ()); - - // insert proxy in admin container. - sa->insert (pc ACE_ENV_ARG_PARAMETER); - - CORBA::Object_var obj = pc->activate (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (proxy_ret._retn ()); - - proxy_id = pc->id (); - - proxy_ret = CosNotifyChannelAdmin::ProxyConsumer::_narrow (obj.in() ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (proxy_ret._retn ()); + TAO_NS_StructuredProxyPushConsumer_Builder pb; + return pb.build (sa, proxy_id ACE_ENV_ARG_PARAMETER); } + break; case CosNotifyChannelAdmin::SEQUENCE_EVENT: - { - } + { + TAO_NS_SequenceProxyPushConsumer_Builder pb; + return pb.build (sa, proxy_id ACE_ENV_ARG_PARAMETER); + } break; default: ACE_THROW_RETURN (CORBA::BAD_PARAM (), CosNotifyChannelAdmin::ProxyConsumer::_nil ()); - } - - return proxy_ret._retn (); + } } - CosNotifyChannelAdmin::ProxySupplier_ptr -TAO_NS_Builder::build_notification_push_supplier (TAO_NS_ConsumerAdmin* ca, CosNotifyChannelAdmin::ClientType ctype, CosNotifyChannelAdmin::ProxyID_out proxy_id ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException - , CosNotifyChannelAdmin::AdminLimitExceeded - )) +TAO_NS_Builder::build_proxy(TAO_NS_ConsumerAdmin* ca + , CosNotifyChannelAdmin::ClientType ctype + , CosNotifyChannelAdmin::ProxyID_out proxy_id + ACE_ENV_ARG_DECL) { - CosNotifyChannelAdmin::ProxySupplier_var proxy_ret; - - TAO_NS_Factory* factory = TAO_NS_PROPERTIES::instance ()->factory (); - switch (ctype) { case CosNotifyChannelAdmin::ANY_EVENT: { - + TAO_NS_ProxyPushSupplier_Builder pb; + return pb.build (ca, proxy_id ACE_ENV_ARG_PARAMETER); } break; case CosNotifyChannelAdmin::STRUCTURED_EVENT: { - TAO_NS_StructuredProxyPushSupplier* ps = 0; - factory->create (ps ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (proxy_ret._retn ()); - - PortableServer::ServantBase_var servant (ps->servant ()); - - ps->event_manager_ = ca->event_manager_; - ps->parent_ = ca; - - ps->init (ca->proxy_poa (), ca->worker_task () ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (proxy_ret._retn ()); - - // insert proxy in admin container. - ca->insert (ps ACE_ENV_ARG_PARAMETER); - - CORBA::Object_var obj = ps->activate (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (proxy_ret._retn ()); - - proxy_id = ps->id (); - - ps->init_ps (ACE_ENV_SINGLE_ARG_PARAMETER); - - proxy_ret = CosNotifyChannelAdmin::ProxySupplier::_narrow (obj.in() ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (proxy_ret._retn ()); + TAO_NS_StructuredProxyPushSupplier_Builder pb; + return pb.build (ca, proxy_id ACE_ENV_ARG_PARAMETER); } + break; case CosNotifyChannelAdmin::SEQUENCE_EVENT: { + TAO_NS_SequenceProxyPushSupplier_Builder pb; + return pb.build (ca, proxy_id ACE_ENV_ARG_PARAMETER); } break; @@ -354,6 +350,77 @@ TAO_NS_Builder::build_notification_push_supplier (TAO_NS_ConsumerAdmin* ca, CosN ACE_THROW_RETURN (CORBA::BAD_PARAM (), CosNotifyChannelAdmin::ProxySupplier::_nil ()); } +} + +CosEventChannelAdmin::ProxyPushSupplier_ptr +TAO_NS_Builder::build_proxy (TAO_NS_ConsumerAdmin* ca ACE_ENV_ARG_DECL) +{ + CosNotifyChannelAdmin::ProxyID proxy_id; + + TAO_NS_CosEC_ProxyPushSupplier_Builder pb; + + return pb.build (ca, proxy_id ACE_ENV_ARG_PARAMETER); +} + +CosEventChannelAdmin::ProxyPushConsumer_ptr +TAO_NS_Builder::build_proxy (TAO_NS_SupplierAdmin* sa ACE_ENV_ARG_DECL) +{ + CosNotifyChannelAdmin::ProxyID proxy_id; + + TAO_NS_CosEC_ProxyPushConsumer_Builder pb; + + return pb.build (sa, proxy_id ACE_ENV_ARG_PARAMETER); +} + +void +TAO_NS_Builder::apply_reactive_concurrency (TAO_NS_Object& object ACE_ENV_ARG_DECL) +{ + TAO_NS_Reactive_Task* worker_task; + + ACE_NEW_THROW_EX (worker_task, + TAO_NS_Reactive_Task (), + CORBA::NO_MEMORY ()); + ACE_CHECK; + + worker_task->init (object.admin_properties_ ACE_ENV_ARG_PARAMETER); + ACE_CHECK; - return proxy_ret._retn (); + object.worker_task_own (worker_task); + + object.worker_task_->_decr_refcnt (); } + +void +TAO_NS_Builder::apply_thread_pool_concurrency (TAO_NS_Object& object, const NotifyExt::ThreadPoolParams& tp_params ACE_ENV_ARG_DECL) +{ + TAO_NS_ThreadPool_Task* worker_task; + + ACE_NEW_THROW_EX (worker_task, + TAO_NS_ThreadPool_Task (), + CORBA::NO_MEMORY ()); + ACE_CHECK; + + worker_task->init (tp_params, object.admin_properties_ ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + object.worker_task_own (worker_task); + + object.worker_task_->_decr_refcnt (); +} + +void +TAO_NS_Builder::apply_lane_concurrency (TAO_NS_Object& object, const NotifyExt::ThreadPoolLanesParams& /*tpl_params*/ ACE_ENV_ARG_DECL) +{ + // No lane support + ACE_THROW (CORBA::NO_IMPLEMENT ()); +} + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) + +template class ACE_Dynamic_Service; + +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) + +#pragma instantiate ACE_Dynamic_Service + +#endif /*ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Builder.h b/TAO/orbsvcs/orbsvcs/Notify/Builder.h index 45691bc6e64..6bee188690d 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Builder.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Builder.h @@ -19,15 +19,17 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#include "orbsvcs/CosNotifyChannelAdminC.h" #include "tao/PortableServer/PortableServer.h" +#include "orbsvcs/CosNotifyChannelAdminC.h" +#include "orbsvcs/NotifyExtC.h" +#include "AdminProperties.h" class TAO_NS_EventChannelFactory; class TAO_NS_EventChannel; class TAO_NS_SupplierAdmin; class TAO_NS_ConsumerAdmin; class TAO_NS_FilterFactory; -//class TAO_NS_Filter; +class TAO_NS_Object; /** * @class TAO_NS_Builder @@ -38,38 +40,71 @@ class TAO_NS_FilterFactory; class TAO_Notify_Export TAO_NS_Builder { public: - CosNotifyChannelAdmin::EventChannelFactory_ptr build_event_channel_factory (PortableServer::POA_ptr poa ACE_ENV_ARG_DECL); - - CosNotifyChannelAdmin::EventChannel_ptr build_event_channel (TAO_NS_EventChannelFactory* ecf, const CosNotification::QoSProperties & initial_qos, const CosNotification::AdminProperties & initial_admin, CosNotifyChannelAdmin::ChannelID_out id ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException - , CosNotification::UnsupportedQoS - , CosNotification::UnsupportedAdmin - )); - - CosNotifyChannelAdmin::ConsumerAdmin_ptr build_consumer_admin (TAO_NS_EventChannel* ec, CosNotifyChannelAdmin::InterFilterGroupOperator op, CosNotifyChannelAdmin::AdminID_out id ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException - )); - - CosNotifyChannelAdmin::SupplierAdmin_ptr build_supplier_admin (TAO_NS_EventChannel* ec, CosNotifyChannelAdmin::InterFilterGroupOperator op, CosNotifyChannelAdmin::AdminID_out id ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException - )); - - CosNotifyChannelAdmin::ProxyConsumer_ptr build_notification_push_consumer (TAO_NS_SupplierAdmin* sa, CosNotifyChannelAdmin::ClientType ctype, CosNotifyChannelAdmin::ProxyID_out proxy_id ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException - , CosNotifyChannelAdmin::AdminLimitExceeded - )); - - CosNotifyChannelAdmin::ProxySupplier_ptr build_notification_push_supplier (TAO_NS_ConsumerAdmin* ca, CosNotifyChannelAdmin::ClientType ctype, CosNotifyChannelAdmin::ProxyID_out proxy_id ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException - , CosNotifyChannelAdmin::AdminLimitExceeded - )); - - CosNotifyFilter::FilterFactory_ptr build_filter_factory (ACE_ENV_SINGLE_ARG_DECL); + TAO_NS_Builder (void); + + virtual ~TAO_NS_Builder (); + + ///= Factory Methods + + /// Build EventChannel Factory. + virtual CosNotifyChannelAdmin::EventChannelFactory_ptr + build_event_channel_factory (PortableServer::POA_ptr poa ACE_ENV_ARG_DECL); + + /// Build the Filter Factory. + virtual CosNotifyFilter::FilterFactory_ptr build_filter_factory (ACE_ENV_SINGLE_ARG_DECL); + + /// Build EventChannel. + virtual CosNotifyChannelAdmin::EventChannel_ptr + build_event_channel (TAO_NS_EventChannelFactory* ecf + , const CosNotification::QoSProperties & initial_qos + , const CosNotification::AdminProperties & initial_admin + , CosNotifyChannelAdmin::ChannelID_out id + ACE_ENV_ARG_DECL); + + /// Build ConsumerAdmin + virtual CosNotifyChannelAdmin::ConsumerAdmin_ptr + build_consumer_admin (TAO_NS_EventChannel* ec + , CosNotifyChannelAdmin::InterFilterGroupOperator op + , CosNotifyChannelAdmin::AdminID_out id + ACE_ENV_ARG_DECL); + + /// Build SupplierAdmin + virtual CosNotifyChannelAdmin::SupplierAdmin_ptr + build_supplier_admin (TAO_NS_EventChannel* ec + , CosNotifyChannelAdmin::InterFilterGroupOperator op + , CosNotifyChannelAdmin::AdminID_out id + ACE_ENV_ARG_DECL); + + /// Build ProxyConsumer + virtual CosNotifyChannelAdmin::ProxyConsumer_ptr + build_proxy (TAO_NS_SupplierAdmin* sa + , CosNotifyChannelAdmin::ClientType ctype + , CosNotifyChannelAdmin::ProxyID_out proxy_id + ACE_ENV_ARG_DECL); + + /// Build ProxySupplier. + virtual CosNotifyChannelAdmin::ProxySupplier_ptr + build_proxy (TAO_NS_ConsumerAdmin* ca + , CosNotifyChannelAdmin::ClientType ctype + , CosNotifyChannelAdmin::ProxyID_out proxy_id + ACE_ENV_ARG_DECL); + + /// Build CosEC style ProxySupplier. + virtual CosEventChannelAdmin::ProxyPushSupplier_ptr + build_proxy (TAO_NS_ConsumerAdmin* ca ACE_ENV_ARG_DECL); + + /// Build CosEC style ProxyConsumer. + virtual CosEventChannelAdmin::ProxyPushConsumer_ptr + build_proxy (TAO_NS_SupplierAdmin* sa ACE_ENV_ARG_DECL); + + /// Apply Reactive concurrency. + virtual void apply_reactive_concurrency (TAO_NS_Object& object ACE_ENV_ARG_DECL); + + /// Apply Thread Pools. + virtual void apply_thread_pool_concurrency (TAO_NS_Object& object, const NotifyExt::ThreadPoolParams& tp_params ACE_ENV_ARG_DECL); + + /// Apply Thread Pools with Lanes. + virtual void apply_lane_concurrency (TAO_NS_Object& object, const NotifyExt::ThreadPoolLanesParams& tpl_params ACE_ENV_ARG_DECL); }; #if defined (__ACE_INLINE__) diff --git a/TAO/orbsvcs/orbsvcs/Notify/Builder.inl b/TAO/orbsvcs/orbsvcs/Notify/Builder.inl index 34b13542be9..cfa1da318d3 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Builder.inl +++ b/TAO/orbsvcs/orbsvcs/Notify/Builder.inl @@ -1,3 +1 @@ // $Id$ - -#include "Builder.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/Consumer.cpp b/TAO/orbsvcs/orbsvcs/Notify/Consumer.cpp index 2c0e9bb5efd..2210c3ca7ad 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Consumer.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Consumer.cpp @@ -9,17 +9,18 @@ ACE_RCSID(RT_Notify, TAO_NS_Consumer, "$Id$") #include "ace/Refcounted_Auto_Ptr.h" +#include "ace/Unbounded_Queue.h" #include "tao/debug.h" -#include "ProxySupplier.h" -#include "Dispatch_Observer_T.h" TAO_NS_Consumer::TAO_NS_Consumer (TAO_NS_ProxySupplier* proxy) - :proxy_ (proxy), event_dispatch_observer_ (0) + :proxy_ (proxy), event_collection_ (0), is_suspended_ (0) { + this->event_collection_ = new TAO_NS_Event_Collection (); } TAO_NS_Consumer::~TAO_NS_Consumer () { + delete this->event_collection_; } TAO_NS_Proxy* @@ -31,51 +32,47 @@ TAO_NS_Consumer::proxy (void) void TAO_NS_Consumer::push (const TAO_NS_Event_var &event ACE_ENV_ARG_DECL) { + if (this->is_suspended_ == 1) // If we're suspended, queue for later delivery. + { + ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, *this->proxy_lock ()); + this->event_collection_->enqueue_head (event); + + return; + } + ACE_TRY { this->push_i (event ACE_ENV_ARG_PARAMETER); ACE_TRY_CHECK; - - if (this->event_dispatch_observer_ != 0) - { - this->event_dispatch_observer_->dispatch_success (this ACE_ENV_ARG_PARAMETER); - - ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->lock_); - this->retry_count_ = 0; - } + } + ACE_CATCH (CORBA::OBJECT_NOT_EXIST, not_exist) + { + this->handle_dispatch_exception (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + } + ACE_CATCH (CORBA::SystemException, sysex) + { + this->handle_dispatch_exception (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; } ACE_CATCHANY { - if (TAO_debug_level > 0) - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "TAO_NS_Consumer::push: error sending event. informing dispatch observer\n "); - } - //ACE_RE_THROW; - - if (this->event_dispatch_observer_ != 0) - { - { - ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->lock_); - - ++this->retry_count_; - this->event_collection_.enqueue_head (event); - } - - this->event_dispatch_observer_->dispatch_failure (this, this->retry_count_ ACE_ENV_ARG_PARAMETER); - } } ACE_ENDTRY; } void -TAO_NS_Consumer::dispatch_pending (void) +TAO_NS_Consumer::dispatch_pending (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) { + if (this->is_suspended_ == 1) + return; // Do nothing if we're suspended. + TAO_NS_Event_Collection event_collection_copy; { - ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->lock_); - event_collection_copy = this->event_collection_; // Payload is never copied, this is a collections of _vars. - this->event_collection_.reset (); + ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, *this->proxy_lock ()); + event_collection_copy = *this->event_collection_; // Payload is never copied, this is a collection of _vars. + this->event_collection_->reset (); } TAO_NS_ProxySupplier* proxy_supplier = this->proxy_supplier (); @@ -90,3 +87,19 @@ TAO_NS_Consumer::dispatch_pending (void) } } } + +void +TAO_NS_Consumer::resume (ACE_ENV_SINGLE_ARG_DECL) +{ + this->is_suspended_ = 0; + + this->dispatch_pending (ACE_ENV_SINGLE_ARG_PARAMETER); +} + +void +TAO_NS_Consumer::dispatch_updates_i (const CosNotification::EventTypeSeq& added, const CosNotification::EventTypeSeq& removed + ACE_ENV_ARG_DECL) +{ + if (!CORBA::is_nil (this->publish_.in ())) + this->publish_->offer_change (added, removed ACE_ENV_ARG_PARAMETER); +} diff --git a/TAO/orbsvcs/orbsvcs/Notify/Consumer.h b/TAO/orbsvcs/orbsvcs/Notify/Consumer.h index 1fb9ae776fe..9537e8f3398 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Consumer.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Consumer.h @@ -19,9 +19,13 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#include "ace/Unbounded_Queue.h" +#include "orbsvcs/CosNotifyCommC.h" +#include "orbsvcs/CosNotificationC.h" #include "Peer.h" -#include "Types.h" +#include "Event.h" + +class TAO_NS_ProxySupplier; +class TAO_NS_Proxy; /** * @class TAO_NS_Consumer @@ -48,27 +52,46 @@ public: void push (const TAO_NS_Event_var& event ACE_ENV_ARG_DECL); /// Push to this consumer. - virtual void push (const CosNotification::StructuredEvent & event ACE_ENV_ARG_DECL) = 0; + virtual void push (const CORBA::Any& event ACE_ENV_ARG_DECL) = 0; - /// Set Observer. - void event_dispatch_observer (TAO_NS_Event_Dispatch_Observer* event_dispatch_observer); + /// Push to this consumer. + virtual void push (const CosNotification::StructuredEvent& event ACE_ENV_ARG_DECL) = 0; /// Dispatch the pending events - void dispatch_pending (void); + void dispatch_pending (ACE_ENV_SINGLE_ARG_DECL); + + /// Is the connection suspended? + CORBA::Boolean is_suspended (void); + + /// Suspend Connection + void suspend (ACE_ENV_SINGLE_ARG_DECL); + + /// Resume Connection + void resume (ACE_ENV_SINGLE_ARG_DECL); protected: + // Dispatch updates + virtual void dispatch_updates_i (const CosNotification::EventTypeSeq& added, + const CosNotification::EventTypeSeq& removed + ACE_ENV_ARG_DECL); /// Push Implementation. virtual void push_i (const TAO_NS_Event_var& event ACE_ENV_ARG_DECL) = 0; + /// Get the shared Proxy Lock + TAO_SYNCH_MUTEX* proxy_lock (void); + /// The Proxy that we associate with. TAO_NS_ProxySupplier* proxy_; - /// Observer - TAO_NS_Event_Dispatch_Observer* event_dispatch_observer_; - /// Events pending to be delivered. - TAO_NS_Event_Collection event_collection_; + TAO_NS_Event_Collection* event_collection_; + + /// Suspended Flag. + CORBA::Boolean is_suspended_; + + /// Interface that accepts offer_changes + CosNotifyComm::NotifyPublish_var publish_; }; #if defined (__ACE_INLINE__) diff --git a/TAO/orbsvcs/orbsvcs/Notify/Consumer.inl b/TAO/orbsvcs/orbsvcs/Notify/Consumer.inl index b2d9cde26c9..d2a5a104c85 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Consumer.inl +++ b/TAO/orbsvcs/orbsvcs/Notify/Consumer.inl @@ -1,17 +1,27 @@ // $Id$ -#include "Consumer.h" +#include "ProxySupplier.h" -ACE_INLINE -TAO_NS_ProxySupplier* +ACE_INLINE TAO_SYNCH_MUTEX* +TAO_NS_Consumer::proxy_lock (void) +{ + return &this->proxy_->lock_; +} + +ACE_INLINE TAO_NS_ProxySupplier* TAO_NS_Consumer::proxy_supplier (void) { return this->proxy_; } -ACE_INLINE void -TAO_NS_Consumer::event_dispatch_observer (TAO_NS_Event_Dispatch_Observer* event_dispatch_observer) +ACE_INLINE CORBA::Boolean +TAO_NS_Consumer::is_suspended (void) { - this->event_dispatch_observer_ = event_dispatch_observer; + return this->is_suspended_; } +ACE_INLINE void +TAO_NS_Consumer::suspend (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) +{ + this->is_suspended_ = 1; +} diff --git a/TAO/orbsvcs/orbsvcs/Notify/ConsumerAdmin.cpp b/TAO/orbsvcs/orbsvcs/Notify/ConsumerAdmin.cpp index a968c21be71..458a73b6ad7 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/ConsumerAdmin.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/ConsumerAdmin.cpp @@ -1,12 +1,6 @@ // $Id$ #include "ConsumerAdmin.h" -#include "EventChannel.h" -#include "Builder.h" -#include "Proxy.h" -#include "orbsvcs/ESF/ESF_Proxy_Collection.h" -#include "QoSAdmin.h" -#include "Subscription_Change_Worker.h" #if ! defined (__ACE_INLINE__) #include "ConsumerAdmin.inl" @@ -14,6 +8,17 @@ ACE_RCSID(RT_Notify, TAO_NS_ConsumerAdmin, "$Id$") +#include "ace/Auto_Ptr.h" +#include "orbsvcs/ESF/ESF_Proxy_Collection.h" +#include "Subscription_Change_Worker.h" +#include "Proxy.h" +#include "EventChannel.h" +#include "Properties.h" +#include "Factory.h" +#include "Builder.h" +#include "Find_Worker_T.h" +#include "Seq_Worker_T.h" + TAO_NS_ConsumerAdmin::TAO_NS_ConsumerAdmin (void) { } @@ -22,20 +27,26 @@ TAO_NS_ConsumerAdmin::~TAO_NS_ConsumerAdmin () { } -PortableServer::Servant -TAO_NS_ConsumerAdmin::servant (void) +void +TAO_NS_ConsumerAdmin::init (TAO_NS_EventChannel *ec ACE_ENV_ARG_DECL) { - return this; + TAO_NS_Admin::init (ec ACE_ENV_ARG_PARAMETER); + + const CosNotification::QoSProperties &default_ca_qos = + TAO_NS_PROPERTIES::instance ()->default_consumer_admin_qos_properties (); + + this->set_qos (default_ca_qos ACE_ENV_ARG_PARAMETER); + ACE_CHECK; } void -TAO_NS_ConsumerAdmin::_add_ref (ACE_ENV_SINGLE_ARG_DECL) +TAO_NS_ConsumerAdmin::_add_ref (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) { this->_incr_refcnt (); } void -TAO_NS_ConsumerAdmin::_remove_ref (ACE_ENV_SINGLE_ARG_DECL) +TAO_NS_ConsumerAdmin::_remove_ref (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) { this->_decr_refcnt (); } @@ -53,188 +64,110 @@ TAO_NS_ConsumerAdmin::destroy (ACE_ENV_SINGLE_ARG_DECL) CORBA::SystemException )) { - this->inherited::destroy (this ACE_ENV_ARG_PARAMETER); -} + if (this->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER) == 1) + return; + ACE_CHECK; + + this->ec_->remove (this ACE_ENV_ARG_PARAMETER); + ACE_CHECK; +} -::CosNotifyChannelAdmin::ProxySupplier_ptr +CosNotifyChannelAdmin::ProxySupplier_ptr TAO_NS_ConsumerAdmin::obtain_notification_push_supplier (CosNotifyChannelAdmin::ClientType ctype, CosNotifyChannelAdmin::ProxyID_out proxy_id + ACE_ENV_ARG_DECL ) ACE_THROW_SPEC (( CORBA::SystemException , CosNotifyChannelAdmin::AdminLimitExceeded )) - -{ - return TAO_NS_PROPERTIES::instance()->builder ()->build_notification_push_supplier (this, - ctype, - proxy_id ACE_ENV_ARG_PARAMETER); -} - -CosNotifyChannelAdmin::AdminID -TAO_NS_ConsumerAdmin::MyID ( - - ) - ACE_THROW_SPEC (( - CORBA::SystemException - )) - { - return this->id (); + return TAO_NS_PROPERTIES::instance()->builder()->build_proxy (this + , ctype + , proxy_id + ACE_ENV_ARG_PARAMETER); } -::CosNotifyChannelAdmin::EventChannel_ptr -TAO_NS_ConsumerAdmin::MyChannel ( - - ) +CosEventChannelAdmin::ProxyPushSupplier_ptr +TAO_NS_ConsumerAdmin::obtain_push_supplier (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException )) - { - //Add your implementation here - return 0; + return TAO_NS_PROPERTIES::instance()->builder()->build_proxy (this ACE_ENV_ARG_PARAMETER); } -::CosNotifyChannelAdmin::InterFilterGroupOperator -TAO_NS_ConsumerAdmin::MyOperator (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException - )) -{ - return this->filter_operator_; -} - -::CosNotifyFilter::MappingFilter_ptr TAO_NS_ConsumerAdmin::priority_filter ( - - ) - ACE_THROW_SPEC (( - CORBA::SystemException - )) - -{ - //Add your implementation here - return 0; -} - -void -TAO_NS_ConsumerAdmin::priority_filter (CosNotifyFilter::MappingFilter_ptr priority_filter) +CosNotifyChannelAdmin::AdminID +TAO_NS_ConsumerAdmin::MyID (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) ACE_THROW_SPEC (( CORBA::SystemException )) - { - //Add your implementation here + return this->id (); } -::CosNotifyFilter::MappingFilter_ptr TAO_NS_ConsumerAdmin::lifetime_filter ( - - ) +CosNotifyChannelAdmin::EventChannel_ptr +TAO_NS_ConsumerAdmin::MyChannel (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException )) - { - //Add your implementation here - return 0; + return this->ec_->_this (ACE_ENV_SINGLE_ARG_PARAMETER); } -void -TAO_NS_ConsumerAdmin::lifetime_filter (CosNotifyFilter::MappingFilter_ptr lifetime_filter ACE_ENV_ARG_DECL) +::CosNotifyChannelAdmin::InterFilterGroupOperator +TAO_NS_ConsumerAdmin::MyOperator (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) ACE_THROW_SPEC (( CORBA::SystemException )) - { - //Add your implementation here + return this->filter_operator_; } -::CosNotifyChannelAdmin::ProxyIDSeq * TAO_NS_ConsumerAdmin::pull_suppliers ( - - ) +CosNotifyChannelAdmin::ProxyIDSeq* +TAO_NS_ConsumerAdmin::push_suppliers (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException )) - { - //Add your implementation here - return 0; -} - -::CosNotifyChannelAdmin::ProxyIDSeq * TAO_NS_ConsumerAdmin::push_suppliers ( - - ) - ACE_THROW_SPEC (( - CORBA::SystemException - )) + TAO_NS_Seq_Worker_T seq_worker; -{ - //Add your implementation here - return 0; + return seq_worker.create (*this->proxy_container_ ACE_ENV_ARG_PARAMETER); } -::CosNotifyChannelAdmin::ProxySupplier_ptr TAO_NS_ConsumerAdmin::get_proxy_supplier ( - CosNotifyChannelAdmin::ProxyID proxy_id - ) +CosNotifyChannelAdmin::ProxySupplier_ptr +TAO_NS_ConsumerAdmin::get_proxy_supplier (CosNotifyChannelAdmin::ProxyID proxy_id ACE_ENV_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException , CosNotifyChannelAdmin::ProxyNotFound )) - -{ - //Add your implementation here - return 0; -} - -::CosNotifyChannelAdmin::ProxySupplier_ptr TAO_NS_ConsumerAdmin::obtain_notification_pull_supplier ( - CosNotifyChannelAdmin::ClientType ctype, - CosNotifyChannelAdmin::ProxyID_out proxy_id - ) - ACE_THROW_SPEC (( - CORBA::SystemException - , CosNotifyChannelAdmin::AdminLimitExceeded - )) - { - //Add your implementation here - return 0; -} - -::CosNotification::QoSProperties * TAO_NS_ConsumerAdmin::get_qos ( - - ) - ACE_THROW_SPEC (( - CORBA::SystemException - )) + TAO_NS_Find_Worker_T find_worker; -{ - //Add your implementation here - return 0; + return find_worker.resolve (proxy_id, *this->proxy_container_ ACE_ENV_ARG_PARAMETER); } -void TAO_NS_ConsumerAdmin::set_qos ( - const CosNotification::QoSProperties & qos - ) +void TAO_NS_ConsumerAdmin::set_qos (const CosNotification::QoSProperties & qos ACE_ENV_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException , CosNotification::UnsupportedQoS )) { - this->qos_admin_->apply_qos (this, qos ACE_ENV_ARG_PARAMETER); + this->TAO_NS_Object::set_qos (qos ACE_ENV_ARG_PARAMETER); } -void TAO_NS_ConsumerAdmin::validate_qos (const CosNotification::QoSProperties & required_qos, - CosNotification::NamedPropertyRangeSeq_out available_qos - ACE_ENV_ARG_DECL - ) + +CosNotification::QoSProperties* +TAO_NS_ConsumerAdmin::get_qos (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException - , CosNotification::UnsupportedQoS )) - { - //Add your implementation here + return this->TAO_NS_Object::get_qos (ACE_ENV_SINGLE_ARG_PARAMETER); } void @@ -256,11 +189,11 @@ TAO_NS_ConsumerAdmin::subscription_change (const CosNotification::EventTypeSeq & ACE_CHECK; this->subscribed_types_.init (seq_added, seq_removed); - } - TAO_NS_Subscription_Change_Worker worker (added, removed); + TAO_NS_Subscription_Change_Worker worker (added, removed); - this->collection_->for_each (&worker ACE_ENV_ARG_PARAMETER); + this->proxy_container_->collection()->for_each (&worker ACE_ENV_ARG_PARAMETER); + } } CosNotifyFilter::FilterID @@ -307,29 +240,89 @@ TAO_NS_ConsumerAdmin::remove_all_filters (ACE_ENV_SINGLE_ARG_DECL) CORBA::SystemException )) { - this->filter_admin_.get_all_filters (ACE_ENV_SINGLE_ARG_PARAMETER); + this->filter_admin_.remove_all_filters (ACE_ENV_SINGLE_ARG_PARAMETER); +} + +/************ UNIMPLMENTED METHODS *************************/ + +CosNotifyFilter::MappingFilter_ptr +TAO_NS_ConsumerAdmin::priority_filter (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException + )) +{ + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), CosNotifyFilter::MappingFilter::_nil ()); +} + +void +TAO_NS_ConsumerAdmin::priority_filter (CosNotifyFilter::MappingFilter_ptr /*priority_filter*/ ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException + )) + +{ + ACE_THROW (CORBA::NO_IMPLEMENT ()); } -::CosEventChannelAdmin::ProxyPushSupplier_ptr TAO_NS_ConsumerAdmin::obtain_push_supplier ( +CosNotifyFilter::MappingFilter_ptr +TAO_NS_ConsumerAdmin::lifetime_filter (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException + )) + +{ + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), CosNotifyFilter::MappingFilter::_nil ()); +} - ) +void +TAO_NS_ConsumerAdmin::lifetime_filter (CosNotifyFilter::MappingFilter_ptr /*lifetime_filter*/ ACE_ENV_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException )) +{ + ACE_THROW (CORBA::NO_IMPLEMENT ()); +} +::CosNotifyChannelAdmin::ProxyIDSeq* +TAO_NS_ConsumerAdmin::pull_suppliers (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException + )) { - //Add your implementation here - return 0; + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); } -::CosEventChannelAdmin::ProxyPullSupplier_ptr TAO_NS_ConsumerAdmin::obtain_pull_supplier ( +CosNotifyChannelAdmin::ProxySupplier_ptr +TAO_NS_ConsumerAdmin::obtain_notification_pull_supplier (CosNotifyChannelAdmin::ClientType /*ctype*/, + CosNotifyChannelAdmin::ProxyID_out /*proxy_id*/ + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotifyChannelAdmin::AdminLimitExceeded + )) + +{ + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), CosNotifyChannelAdmin::ProxySupplier::_nil ()); +} - ) +void +TAO_NS_ConsumerAdmin::validate_qos (const CosNotification::QoSProperties & /*required_qos*/, + CosNotification::NamedPropertyRangeSeq_out /*available_qos*/ + ACE_ENV_ARG_DECL + ) ACE_THROW_SPEC (( CORBA::SystemException + , CosNotification::UnsupportedQoS )) +{ + ACE_THROW (CORBA::NO_IMPLEMENT ()); +} +CosEventChannelAdmin::ProxyPullSupplier_ptr +TAO_NS_ConsumerAdmin::obtain_pull_supplier (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException + )) { - //Add your implementation here - return 0; + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), CosEventChannelAdmin::ProxyPullSupplier::_nil ()); } diff --git a/TAO/orbsvcs/orbsvcs/Notify/ConsumerAdmin.h b/TAO/orbsvcs/orbsvcs/Notify/ConsumerAdmin.h index 0096fddd78d..4c4244c5a4f 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/ConsumerAdmin.h +++ b/TAO/orbsvcs/orbsvcs/Notify/ConsumerAdmin.h @@ -21,7 +21,13 @@ #include "orbsvcs/CosNotifyChannelAdminS.h" #include "Admin.h" -#include "Destroy_Callback.h" + +#if defined(_MSC_VER) +#if (_MSC_VER >= 1200) +#pragma warning(push) +#endif /* _MSC_VER >= 1200 */ +#pragma warning(disable:4250) +#endif /* _MSC_VER */ /** * @class TAO_NS_ConsumerAdmin @@ -29,38 +35,35 @@ * @brief Implementation of CosNotifyChannelAdmin::ConsumerAdmin * */ -class TAO_Notify_Export TAO_NS_ConsumerAdmin : public POA_CosNotifyChannelAdmin::ConsumerAdmin, public TAO_NS_Admin, public TAO_NS_Destroy_Callback +class TAO_Notify_Export TAO_NS_ConsumerAdmin : public POA_CosNotifyChannelAdmin::ConsumerAdmin + , public virtual TAO_NS_Admin { - friend class TAO_NS_Builder; public: - /// Constuctor TAO_NS_ConsumerAdmin (void); /// Destructor ~TAO_NS_ConsumerAdmin (); - /// Return servant - virtual PortableServer::Servant servant (void); + /// Init + void init (TAO_NS_EventChannel *ec ACE_ENV_ARG_DECL); /// ServantBase refcount methods. virtual void _add_ref (ACE_ENV_SINGLE_ARG_DECL); virtual void _remove_ref (ACE_ENV_SINGLE_ARG_DECL); - /// TAO_NS_Destroy_Callback methods + /// Release this object. virtual void release (void); protected: - /// = CosNotifyChannelAdmin::ConsumerAdmin methods - virtual CosNotifyChannelAdmin::AdminID MyID ( - - ) + /// = CosNotifyChannelAdmin::ConsumerAdmin methods + virtual CosNotifyChannelAdmin::AdminID MyID (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException )); - virtual ::CosNotifyChannelAdmin::EventChannel_ptr MyChannel ( + virtual ::CosNotifyChannelAdmin::EventChannel_ptr MyChannel (ACE_ENV_SINGLE_ARG_DECL ) ACE_THROW_SPEC (( @@ -72,167 +75,139 @@ protected: CORBA::SystemException )); - virtual ::CosNotifyFilter::MappingFilter_ptr priority_filter ( + virtual ::CosNotifyFilter::MappingFilter_ptr priority_filter (ACE_ENV_SINGLE_ARG_DECL ) ACE_THROW_SPEC (( CORBA::SystemException )); - virtual void priority_filter ( - CosNotifyFilter::MappingFilter_ptr priority_filter - ) + virtual void priority_filter (CosNotifyFilter::MappingFilter_ptr priority_filter ACE_ENV_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException )); - virtual ::CosNotifyFilter::MappingFilter_ptr lifetime_filter ( - - ) + virtual ::CosNotifyFilter::MappingFilter_ptr lifetime_filter (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException )); - virtual void lifetime_filter ( - CosNotifyFilter::MappingFilter_ptr lifetime_filter - ) + virtual void lifetime_filter (CosNotifyFilter::MappingFilter_ptr lifetime_filter + ACE_ENV_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException )); - virtual ::CosNotifyChannelAdmin::ProxyIDSeq * pull_suppliers ( - - ) + virtual ::CosNotifyChannelAdmin::ProxyIDSeq * pull_suppliers (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException )); - virtual ::CosNotifyChannelAdmin::ProxyIDSeq * push_suppliers ( - - ) + virtual ::CosNotifyChannelAdmin::ProxyIDSeq * push_suppliers (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException )); - virtual ::CosNotifyChannelAdmin::ProxySupplier_ptr get_proxy_supplier ( - CosNotifyChannelAdmin::ProxyID proxy_id - ) + virtual ::CosNotifyChannelAdmin::ProxySupplier_ptr get_proxy_supplier (CosNotifyChannelAdmin::ProxyID proxy_id + ACE_ENV_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException , CosNotifyChannelAdmin::ProxyNotFound )); - virtual ::CosNotifyChannelAdmin::ProxySupplier_ptr obtain_notification_pull_supplier ( - CosNotifyChannelAdmin::ClientType ctype, - CosNotifyChannelAdmin::ProxyID_out proxy_id - ) + virtual ::CosNotifyChannelAdmin::ProxySupplier_ptr + obtain_notification_pull_supplier (CosNotifyChannelAdmin::ClientType ctype, + CosNotifyChannelAdmin::ProxyID_out proxy_id + ACE_ENV_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException , CosNotifyChannelAdmin::AdminLimitExceeded )); - virtual ::CosNotifyChannelAdmin::ProxySupplier_ptr obtain_notification_push_supplier ( - CosNotifyChannelAdmin::ClientType ctype, - CosNotifyChannelAdmin::ProxyID_out proxy_id - ) + virtual ::CosNotifyChannelAdmin::ProxySupplier_ptr + obtain_notification_push_supplier (CosNotifyChannelAdmin::ClientType ctype, + CosNotifyChannelAdmin::ProxyID_out proxy_id + ACE_ENV_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException , CosNotifyChannelAdmin::AdminLimitExceeded )); - virtual void destroy ( - - ) + virtual void destroy (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException )); - virtual ::CosNotification::QoSProperties * get_qos ( - - ) + virtual ::CosNotification::QoSProperties * get_qos (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException )); - virtual void set_qos ( - const CosNotification::QoSProperties & qos - ) + virtual void set_qos (const CosNotification::QoSProperties & qos + ACE_ENV_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException , CosNotification::UnsupportedQoS )); - virtual void validate_qos ( - const CosNotification::QoSProperties & required_qos, + virtual void validate_qos (const CosNotification::QoSProperties & required_qos, CosNotification::NamedPropertyRangeSeq_out available_qos - ) + ACE_ENV_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException , CosNotification::UnsupportedQoS )); - virtual void subscription_change ( - const CosNotification::EventTypeSeq & added, + virtual void subscription_change (const CosNotification::EventTypeSeq & added, const CosNotification::EventTypeSeq & removed - ) + ACE_ENV_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException , CosNotifyComm::InvalidEventType )); - virtual CosNotifyFilter::FilterID add_filter ( - CosNotifyFilter::Filter_ptr new_filter - ) + virtual CosNotifyFilter::FilterID add_filter (CosNotifyFilter::Filter_ptr new_filter ACE_ENV_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException )); - virtual void remove_filter ( - CosNotifyFilter::FilterID filter - ) + virtual void remove_filter (CosNotifyFilter::FilterID filter ACE_ENV_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException , CosNotifyFilter::FilterNotFound )); - virtual ::CosNotifyFilter::Filter_ptr get_filter ( - CosNotifyFilter::FilterID filter - ) + virtual ::CosNotifyFilter::Filter_ptr get_filter (CosNotifyFilter::FilterID filter ACE_ENV_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException , CosNotifyFilter::FilterNotFound )); - virtual ::CosNotifyFilter::FilterIDSeq * get_all_filters ( - - ) + virtual ::CosNotifyFilter::FilterIDSeq * get_all_filters (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException )); - virtual void remove_all_filters ( - - ) + virtual void remove_all_filters (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException )); - virtual ::CosEventChannelAdmin::ProxyPushSupplier_ptr obtain_push_supplier ( - - ) + virtual ::CosEventChannelAdmin::ProxyPushSupplier_ptr obtain_push_supplier (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException )); - virtual ::CosEventChannelAdmin::ProxyPullSupplier_ptr obtain_pull_supplier ( - - ) + virtual ::CosEventChannelAdmin::ProxyPullSupplier_ptr obtain_pull_supplier (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException )); }; +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +#pragma warning(pop) +#endif /* _MSC_VER */ #if defined (__ACE_INLINE__) #include "ConsumerAdmin.inl" diff --git a/TAO/orbsvcs/orbsvcs/Notify/ConsumerAdmin.inl b/TAO/orbsvcs/orbsvcs/Notify/ConsumerAdmin.inl index 5e07de81911..cfa1da318d3 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/ConsumerAdmin.inl +++ b/TAO/orbsvcs/orbsvcs/Notify/ConsumerAdmin.inl @@ -1,3 +1 @@ // $Id$ - -#include "ConsumerAdmin.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/Consumer_Map.h b/TAO/orbsvcs/orbsvcs/Notify/Consumer_Map.h new file mode 100644 index 00000000000..ca248f949a4 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Consumer_Map.h @@ -0,0 +1,36 @@ +/* -*- C++ -*- */ +/** + * @file Consumer_Map.h + * + * $Id$ + * + * @author Pradeep Gore + * + * + */ + +#ifndef TAO_NS_CONSUMER_MAP_H +#define TAO_NS_CONSUMER_MAP_H +#include "ace/pre.h" + +#include "notify_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + + +#include "Event_Map_T.h" +#include "ProxySupplier.h" + +/** + * @class TAO_NS_Consumer_Map + * + * @brief The Event Map for Consumers. + * + */ + +typedef TAO_NS_Event_Map_T TAO_NS_Consumer_Map; + +#include "ace/post.h" +#endif /* TAO_NS_CONSUMER_MAP_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Container_T.cpp b/TAO/orbsvcs/orbsvcs/Notify/Container_T.cpp index dce3ccb625c..ad43477e2da 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Container_T.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Container_T.cpp @@ -17,52 +17,46 @@ ACE_RCSID(RT_Notify, TAO_NS_Container_T, "$Id$") -template -TAO_NS_Container_T::TAO_NS_Container_T (void) +template +TAO_NS_Container_T::TAO_NS_Container_T (void) : collection_ (0) { } -template -TAO_NS_Container_T::~TAO_NS_Container_T () +template +TAO_NS_Container_T::~TAO_NS_Container_T () { - /// delete collection_; } -template void -TAO_NS_Container_T::shutdown (ACE_ENV_SINGLE_ARG_DECL) +template void +TAO_NS_Container_T::shutdown (ACE_ENV_SINGLE_ARG_DECL) { - TAO_NS_Object_T::shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - TAO_ESF_Shutdown_Proxy shutdown_worker; this->collection_->for_each (&shutdown_worker ACE_ENV_ARG_PARAMETER); - - /// shutdown Container - this->cleanup (ACE_ENV_SINGLE_ARG_PARAMETER); } -template void -TAO_NS_Container_T::insert (TYPE* type ACE_ENV_ARG_DECL) +template void +TAO_NS_Container_T::insert (TYPE* type ACE_ENV_ARG_DECL) { this->collection_->connected (type ACE_ENV_ARG_PARAMETER); } -template void -TAO_NS_Container_T::remove (TYPE* type ACE_ENV_ARG_DECL) +template void +TAO_NS_Container_T::remove (TYPE* type ACE_ENV_ARG_DECL) { this->collection_->disconnected (type ACE_ENV_ARG_PARAMETER); } -template void -TAO_NS_Container_T::init_collection (ACE_ENV_SINGLE_ARG_DECL) +template void +TAO_NS_Container_T::init (ACE_ENV_SINGLE_ARG_DECL) { // get the factory TAO_NS_Factory* factory = TAO_NS_PROPERTIES::instance ()->factory (); // Init variables - factory->create (this->collection_ ACE_ENV_SINGLE_ARG_PARAMETER); + factory->create (this->collection_ ACE_ENV_ARG_PARAMETER); } + #endif /* TAO_NS_CONTAINER_T_CPP */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Container_T.h b/TAO/orbsvcs/orbsvcs/Notify/Container_T.h index b140f4c84af..003bcf55a7d 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Container_T.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Container_T.h @@ -19,41 +19,43 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#include "Container.h" -#include "Object_T.h" +#include "orbsvcs/ESF/ESF_Proxy_Collection.h" /** * @class TAO_NS_Container_T * - * @brief A template class that manages a collection. - * TYPE = type of collection, OBJECT = the object, PARENT = parent of object (grandparent of TYPE) + * @brief A template class that manages a collection. + * TYPE = type of collection * */ -template -class TAO_Notify_Export TAO_NS_Container_T : public TAO_NS_Object_T, public virtual TAO_NS_Container +template +class TAO_Notify_Export TAO_NS_Container_T { -public: + typedef TAO_ESF_Proxy_Collection COLLECTION; + public: + /// Constuctor TAO_NS_Container_T (void); /// Destructor - virtual ~TAO_NS_Container_T (); + virtual ~TAO_NS_Container_T (); + + /// Init this object. + void init (ACE_ENV_SINGLE_ARG_DECL); /// Insert object to this container. - void insert (TYPE* type ACE_ENV_ARG_DECL); + virtual void insert (TYPE* type ACE_ENV_ARG_DECL); /// Remove type from container_ - void remove (TYPE* type ACE_ENV_ARG_DECL); - - /// Init this object. - void init_collection (ACE_ENV_SINGLE_ARG_DECL); + virtual void remove (TYPE* type ACE_ENV_ARG_DECL); /// Shutdown virtual void shutdown (ACE_ENV_SINGLE_ARG_DECL); -protected: - typedef TAO_ESF_Proxy_Collection COLLECTION; + /// Collection + COLLECTION* collection (void); +protected: /// The collection data structure that we add objects to. COLLECTION* collection_; }; diff --git a/TAO/orbsvcs/orbsvcs/Notify/Container_T.inl b/TAO/orbsvcs/orbsvcs/Notify/Container_T.inl index 6465cd06ad7..3bb19f4afb4 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Container_T.inl +++ b/TAO/orbsvcs/orbsvcs/Notify/Container_T.inl @@ -1,3 +1,7 @@ // $Id$ -#include "Container_T.h" +template ACE_INLINE TAO_NS_Container_T::COLLECTION* +TAO_NS_Container_T:: collection (void) +{ + return this->collection_; +} diff --git a/TAO/orbsvcs/orbsvcs/Notify/CosNotify_Initializer.cpp b/TAO/orbsvcs/orbsvcs/Notify/CosNotify_Initializer.cpp index 7794ee10956..7714f21d186 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/CosNotify_Initializer.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/CosNotify_Initializer.cpp @@ -4,10 +4,10 @@ ACE_RCSID(Notify, TAO_NS_CosNotify_Initializer, "$id$") -#include "Notify_Service.h" +#include "CosNotify_Service.h" TAO_NS_CosNotify_Initializer::TAO_NS_CosNotify_Initializer (void) { - ACE_Service_Config::static_svcs ()->insert (&ace_svc_desc_TAO_NS_Notify_Service); + // ACE_Service_Config::static_svcs ()->insert (&ace_svc_desc_TAO_NS_CosNotify_Service); ACE_Service_Config::static_svcs ()->insert (&ace_svc_desc_TAO_Notify_Default_EMO_Factory_OLD); } diff --git a/TAO/orbsvcs/orbsvcs/Notify/CosNotify_Service.cpp b/TAO/orbsvcs/orbsvcs/Notify/CosNotify_Service.cpp new file mode 100644 index 00000000000..722802d9273 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/CosNotify_Service.cpp @@ -0,0 +1,327 @@ +// $Id$ + +#include "CosNotify_Service.h" +#include "Properties.h" +#include "Default_Factory.h" +#include "Builder.h" +#include "ace/Sched_Params.h" +#include "ace/Arg_Shifter.h" +#include "ace/Dynamic_Service.h" +#include "tao/ORB_Core.h" +#include "orbsvcs/NotifyExtC.h" +#include "tao/debug.h" + +ACE_RCSID(RT_Notify, TAO_NS_CosNotify_Service, "$Id$") + +TAO_NS_CosNotify_Service::TAO_NS_CosNotify_Service (void) + : factory_ (0) + , builder_ (0) +{ +} + +TAO_NS_CosNotify_Service::~TAO_NS_CosNotify_Service () +{ + delete this->factory_; + delete this->builder_; +} + +int +TAO_NS_CosNotify_Service::init (int argc, char *argv[]) +{ + ACE_Arg_Shifter arg_shifter (argc, argv); + + const ACE_TCHAR *current_arg = 0; + + // Default to an all reactive system. + int ec_threads = 0; + int dispatching_threads = 0; + int listener_threads = 0; + int source_threads = 0; + int lookup_threads = 0; + + int task_per_proxy = 0; + + TAO_NS_Properties *properties = TAO_NS_PROPERTIES::instance(); + + while (arg_shifter.is_anything_left ()) + { + if (arg_shifter.cur_arg_strncasecmp (ACE_LIB_TEXT("-MTDispatching")) == 0) + { + // If Dispatching Threads are initalized, the option is implicit. + arg_shifter.consume_arg (); + } + else if ((current_arg = arg_shifter.get_the_parameter (ACE_LIB_TEXT("-DispatchingThreads")))) + { + dispatching_threads = ACE_OS::atoi (current_arg); + arg_shifter.consume_arg (); + } + else if (arg_shifter.cur_arg_strncasecmp (ACE_LIB_TEXT("-MTSourceEval")) == 0) + { + // If Source Threads are initalized, the option is implicit. + arg_shifter.consume_arg (); + } + else if ((current_arg = arg_shifter.get_the_parameter (ACE_LIB_TEXT("-SourceThreads")))) + { + source_threads = ACE_OS::atoi (current_arg); + arg_shifter.consume_arg (); + } + else if (arg_shifter.cur_arg_strncasecmp (ACE_LIB_TEXT("-MTLookup")) == 0) + { + // If Source Threads are initalized, the option is implicit. + arg_shifter.consume_arg (); + } + else if ((current_arg = arg_shifter.get_the_parameter (ACE_LIB_TEXT("-LookupThreads")))) + { + lookup_threads = ACE_OS::atoi (current_arg); + arg_shifter.consume_arg (); + } + else if (arg_shifter.cur_arg_strncasecmp (ACE_LIB_TEXT("-MTListenerEval")) == 0) + { + // If Source Threads are initalized, the option is implicit. + arg_shifter.consume_arg (); + } + else if ((current_arg = arg_shifter.get_the_parameter (ACE_LIB_TEXT("-ListenerThreads")))) + { + listener_threads = ACE_OS::atoi (current_arg); + arg_shifter.consume_arg (); + } + else if (arg_shifter.cur_arg_strncasecmp (ACE_LIB_TEXT("-AsynchUpdates")) == 0) + { + arg_shifter.consume_arg (); + + properties->asynch_updates (1); + } + else if (arg_shifter.cur_arg_strncasecmp (ACE_LIB_TEXT("-AllocateTaskperProxy")) == 0) + { + task_per_proxy = 1; + arg_shifter.consume_arg (); + } + } + + // Init the EC QoS + { + CosNotification::QoSProperties qos; + this->set_threads (qos, ec_threads); + properties->default_event_channel_qos_properties (qos); + } + + if (task_per_proxy == 0) + { + // Set the per ConsumerAdmin QoS + { + CosNotification::QoSProperties qos; + this->set_threads (qos, dispatching_threads + listener_threads); + properties->default_consumer_admin_qos_properties (qos); + } + + // Set the per SupplierAdmin QoS + { + CosNotification::QoSProperties qos; + this->set_threads (qos, lookup_threads + source_threads); + properties->default_supplier_admin_qos_properties (qos); + } + } + else + { + // Set the per ProxyConsumer QoS + { + CosNotification::QoSProperties qos; + this->set_threads (qos, dispatching_threads + listener_threads); + properties->default_proxy_consumer_qos_properties (qos); + } + + // Set the per ProxySupplier QoS + { + CosNotification::QoSProperties qos; + this->set_threads (qos, source_threads); // lookup thread per proxy doesn't make sense. + properties->default_proxy_supplier_qos_properties (qos); + } + } + + return 0; +} + +void +TAO_NS_CosNotify_Service::set_threads (CosNotification::QoSProperties &qos, int threads) +{ + NotifyExt::ThreadPoolParams tp_params = + {0, (unsigned)threads, 0, 0, 0, 0, 0 }; + + qos.length (1); + qos[0].name = CORBA::string_dup (NotifyExt::ThreadPool); + qos[0].value <<= tp_params; +} + +int +TAO_NS_CosNotify_Service::fini (void) +{ + return 0; +} + +void +TAO_NS_CosNotify_Service::init (CORBA::ORB_ptr orb ACE_ENV_ARG_DECL) +{ + ACE_DEBUG ((LM_DEBUG, "Loading the Cos Notification Service...\n")); + + this->init_i (orb ACE_ENV_ARG_PARAMETER); + ACE_CHECK; +} + +void +TAO_NS_CosNotify_Service::init_i (CORBA::ORB_ptr orb ACE_ENV_ARG_DECL) +{ + /// first, init the main thread. + //this->init_main_thread (orb ACE_ENV_ARG_PARAMETER); + //ACE_CHECK; + + // Obtain the Root POA + CORBA::Object_var object = + orb->resolve_initial_references("RootPOA" ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (CORBA::is_nil (object.in ())) + ACE_ERROR ((LM_ERROR, + " (%P|%t) Unable to resolve the RootPOA.\n")); + + PortableServer::POA_var default_poa = PortableServer::POA::_narrow (object.in () ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + /// Set the properties + TAO_NS_Properties* properties = TAO_NS_PROPERTIES::instance(); + + properties->orb (orb); + properties->default_poa (default_poa.in ()); + properties->sched_policy (orb->orb_core ()->orb_params ()->sched_policy ()); + properties->scope_policy (orb->orb_core ()->orb_params ()->scope_policy ()); + + // Init the factory + this->init_factory (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + this->init_builder (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; +} + +void +TAO_NS_CosNotify_Service::init_main_thread (CORBA::ORB_ptr orb ACE_ENV_ARG_DECL_NOT_USED) +{ + ACE_Sched_Params::Policy sched_policy; + long thr_sched_policy = orb->orb_core ()->orb_params ()->sched_policy (); + + //long thr_scope_policy = orb->orb_core ()->orb_params ()->scope_policy (); + + if (thr_sched_policy == THR_SCHED_FIFO) + { + if (TAO_debug_level > 0) + ACE_DEBUG ((LM_DEBUG, "Sched policy = THR_SCHED_FIFO\n")); + + sched_policy = ACE_SCHED_FIFO; + } + else if (thr_sched_policy == THR_SCHED_RR) + { + if (TAO_debug_level > 0) + ACE_DEBUG ((LM_DEBUG, "Sched policy = THR_SCHED_RR\n")); + + sched_policy = ACE_SCHED_RR; + } + else + { + if (TAO_debug_level > 0) + ACE_DEBUG ((LM_DEBUG, "Sched policy = THR_SCHED_OTHER\n")); + + sched_policy = ACE_SCHED_OTHER; + } + + /// Check sched. + int min_priority = ACE_Sched_Params::priority_min (sched_policy); + int max_priority = ACE_Sched_Params::priority_max (sched_policy); + + if (TAO_debug_level > 0) + { + ACE_DEBUG ((LM_DEBUG, "max_priority = %d, min_priority = %d\n", + max_priority, min_priority)); + + if (max_priority == min_priority) + { + ACE_DEBUG ((LM_DEBUG,"Detected max_priority == min_priority\n")); + } + } + + // Set the main thread to min priority... + int priority = min_priority; + + if (ACE_OS::sched_params (ACE_Sched_Params (sched_policy , + priority, + ACE_SCOPE_PROCESS)) != 0) + { + if (ACE_OS::last_error () == EPERM) + { + ACE_DEBUG ((LM_DEBUG, + "(%P|%t): user is not superuser, " + "test runs in time-shared class\n")); + } + else + ACE_ERROR ((LM_ERROR, + "(%P|%t): sched_params failed\n")); + } +} + +void +TAO_NS_CosNotify_Service::init_factory (ACE_ENV_SINGLE_ARG_DECL) +{ + this->factory_ = ACE_Dynamic_Service::instance ("TAO_NS_Factory"); + + if (this->factory_ == 0) + ACE_NEW_THROW_EX (this->factory_, + TAO_NS_Default_Factory (), + CORBA::NO_MEMORY ()); + ACE_CHECK; + + TAO_NS_PROPERTIES::instance()->factory (this->factory_); +} + +void +TAO_NS_CosNotify_Service::init_builder (ACE_ENV_SINGLE_ARG_DECL) +{ + ACE_NEW_THROW_EX (this->builder_, + TAO_NS_Builder (), + CORBA::NO_MEMORY ()); + ACE_CHECK; + + TAO_NS_PROPERTIES::instance()->builder (this->builder_); +} + +CosNotifyChannelAdmin::EventChannelFactory_ptr +TAO_NS_CosNotify_Service::create (PortableServer::POA_ptr poa ACE_ENV_ARG_DECL) +{ + return this->builder_->build_event_channel_factory (poa ACE_ENV_ARG_PARAMETER); +} + +void +TAO_NS_CosNotify_Service::remove (TAO_NS_EventChannelFactory* /*ecf*/ ACE_ENV_ARG_DECL_NOT_USED) +{ + // NOP. +} + +/*********************************************************************************************************************/ + +ACE_STATIC_SVC_DEFINE (TAO_Notify_Default_EMO_Factory_OLD, + ACE_TEXT (TAO_NOTIFY_DEF_EMO_FACTORY_NAME), + ACE_SVC_OBJ_T, + &ACE_SVC_NAME (TAO_NS_CosNotify_Service), + ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ, + 0) + +/*********************************************************************************************************************/ +/* +ACE_STATIC_SVC_DEFINE (TAO_NS_CosNotify_Service, + ACE_TEXT (TAO_NS_COS_NOTIFICATION_SERVICE_NAME), + ACE_SVC_OBJ_T, + &ACE_SVC_NAME (TAO_NS_CosNotify_Service), + ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ, + 0) + +*/ +ACE_FACTORY_DEFINE (TAO_Notify, TAO_NS_CosNotify_Service) + +/*********************************************************************************************************************/ diff --git a/TAO/orbsvcs/orbsvcs/Notify/CosNotify_Service.h b/TAO/orbsvcs/orbsvcs/Notify/CosNotify_Service.h new file mode 100644 index 00000000000..fd29b69d2a8 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/CosNotify_Service.h @@ -0,0 +1,90 @@ +/* -*- C++ -*- */ +/** + * @file CosNotify_Service.h + * + * $Id$ + * + * @author Pradeep Gore + * + * + */ + +#ifndef TAO_NS_COSNOTIFY_SERVICE_H +#define TAO_NS_COSNOTIFY_SERVICE_H +#include "ace/pre.h" + +#include "notify_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "Service.h" + +class TAO_NS_Factory; +class TAO_NS_Builder; +class TAO_NS_Properties; +class TAO_NS_EventChannelFactory; + +/** + * @class TAO_NS_CosNotify_Service + * + * @brief A service object for creating the Notify Service Factory. + * + */ +class TAO_Notify_Export TAO_NS_CosNotify_Service : public TAO_NS_Service +{ +public: + /// Constuctor + TAO_NS_CosNotify_Service (void); + + /// Destructor + virtual ~TAO_NS_CosNotify_Service (); + + /// = Service_Object virtual method overloads. + virtual int init (int argc, char *argv[]); + virtual int fini (void); + + /// Init + virtual void init (CORBA::ORB_ptr orb ACE_ENV_ARG_DECL); + + /// Create the Channel Factory. + virtual CosNotifyChannelAdmin::EventChannelFactory_ptr create (PortableServer::POA_ptr default_POA ACE_ENV_ARG_DECL); + + /// Called by the factory when it is destroyed. + virtual void remove (TAO_NS_EventChannelFactory* ecf ACE_ENV_ARG_DECL); + +protected: + /// Init the data members + virtual void init_i (CORBA::ORB_ptr orb ACE_ENV_ARG_DECL); + + /// Create the Factory for Notify objects. + virtual void init_factory (ACE_ENV_SINGLE_ARG_DECL); + + /// Create the Builder for Notify objects. + virtual void init_builder (ACE_ENV_SINGLE_ARG_DECL); + + /// Apply ORB Scheduling policy to main thread and set its priority to the lowest available. + void init_main_thread (CORBA::ORB_ptr orb ACE_ENV_ARG_DECL); + + /// Set thread options on . + void set_threads (CosNotification::QoSProperties &qos, int threads); + + /// Service component for object factory operations. + TAO_NS_Factory* factory_; + + /// Service component for building NS participants. + TAO_NS_Builder* builder_; +}; + +//ACE_STATIC_SVC_DECLARE (TAO_NS_CosNotify_Service) +ACE_FACTORY_DECLARE (TAO_Notify, TAO_NS_CosNotify_Service) + +ACE_STATIC_SVC_DECLARE (TAO_Notify_Default_EMO_Factory_OLD) + +#if defined (__ACE_INLINE__) +#include "CosNotify_Service.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* TAO_NS_COSNOTIFY_SERVICE_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/CosNotify_Service.inl b/TAO/orbsvcs/orbsvcs/Notify/CosNotify_Service.inl new file mode 100644 index 00000000000..cfa1da318d3 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/CosNotify_Service.inl @@ -0,0 +1 @@ +// $Id$ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Default_Factory.cpp b/TAO/orbsvcs/orbsvcs/Notify/Default_Factory.cpp new file mode 100644 index 00000000000..e7d26a9d90a --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Default_Factory.cpp @@ -0,0 +1,395 @@ +// $Id$ + +#include "Default_Factory.h" + +#if ! defined (__ACE_INLINE__) +#include "Default_Factory.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(RN_Notify, TAO_NS_Default_Factory, "$Id$") + +#include "orbsvcs/ESF/ESF_Proxy_List.h" +#include "orbsvcs/ESF/ESF_Copy_On_Write.h" + +#include "EventChannelFactory.h" +#include "EventChannel.h" +#include "Admin.h" +#include "Proxy.h" +#include "SupplierAdmin.h" +#include "ConsumerAdmin.h" +#include "Structured/StructuredProxyPushConsumer.h" +#include "Structured/StructuredProxyPushSupplier.h" +#include "Any/ProxyPushConsumer.h" +#include "Any/ProxyPushSupplier.h" +#include "Any/CosEC_ProxyPushConsumer.h" +#include "Any/CosEC_ProxyPushSupplier.h" +#include "Sequence/SequenceProxyPushConsumer.h" +#include "Sequence/SequenceProxyPushSupplier.h" +#include "Supplier.h" + +template +class COW_Collection_Default_Factory +{ +public: + typedef TAO_ESF_Proxy_List::Iterator PROXY_ITER; + typedef TAO_ESF_Copy_On_Write,PROXY_ITER, ACE_SYNCH> COLLECTION; + typedef TAO_ESF_Proxy_Collection BASE_COLLECTION; + + void create (BASE_COLLECTION* &collection ACE_ENV_ARG_DECL) + { + ACE_NEW_THROW_EX (collection, + COLLECTION (), + CORBA::INTERNAL ()); + } +}; + +TAO_NS_Default_Factory::TAO_NS_Default_Factory (void) +{ +} + +TAO_NS_Default_Factory::~TAO_NS_Default_Factory () +{ +} + +void +TAO_NS_Default_Factory::create (TAO_NS_ProxySupplier_Collection* &collection ACE_ENV_ARG_DECL) +{ + COW_Collection_Default_Factory f; + f.create (collection ACE_ENV_ARG_PARAMETER); +} + +void +TAO_NS_Default_Factory::create (TAO_NS_ProxyConsumer_Collection* &collection ACE_ENV_ARG_DECL) +{ + COW_Collection_Default_Factory f; + f.create (collection ACE_ENV_ARG_PARAMETER); +} + +void +TAO_NS_Default_Factory::create (TAO_NS_EventChannel_Collection* &collection ACE_ENV_ARG_DECL) +{ + COW_Collection_Default_Factory f; + f.create (collection ACE_ENV_ARG_PARAMETER); +} + +void +TAO_NS_Default_Factory::create (TAO_NS_ConsumerAdmin_Collection* &collection ACE_ENV_ARG_DECL) +{ + COW_Collection_Default_Factory f; + f.create (collection ACE_ENV_ARG_PARAMETER); +} + +void +TAO_NS_Default_Factory::create (TAO_NS_SupplierAdmin_Collection* &collection ACE_ENV_ARG_DECL) +{ + COW_Collection_Default_Factory f; + f.create (collection ACE_ENV_ARG_PARAMETER); +} + +void +TAO_NS_Default_Factory::create (TAO_NS_Proxy_Collection* &collection ACE_ENV_ARG_DECL) +{ + COW_Collection_Default_Factory f; + f.create (collection ACE_ENV_ARG_PARAMETER); +} + +void +TAO_NS_Default_Factory::create (TAO_NS_EventChannelFactory*& factory ACE_ENV_ARG_DECL) +{ + ACE_NEW_THROW_EX (factory, + TAO_NS_EventChannelFactory (), + CORBA::NO_MEMORY ()); +} + +void +TAO_NS_Default_Factory::create (TAO_NS_EventChannel*& channel ACE_ENV_ARG_DECL) +{ + ACE_NEW_THROW_EX (channel, + TAO_NS_EventChannel (), + CORBA::NO_MEMORY ()); +} + + +void +TAO_NS_Default_Factory::create (TAO_NS_SupplierAdmin*& admin ACE_ENV_ARG_DECL) +{ + ACE_NEW_THROW_EX (admin, + TAO_NS_SupplierAdmin (), + CORBA::NO_MEMORY ()); +} + +void +TAO_NS_Default_Factory::create (TAO_NS_ConsumerAdmin*& admin ACE_ENV_ARG_DECL) +{ + ACE_NEW_THROW_EX (admin, + TAO_NS_ConsumerAdmin (), + CORBA::NO_MEMORY ()); +} + +void +TAO_NS_Default_Factory::create (TAO_NS_StructuredProxyPushConsumer*& proxy ACE_ENV_ARG_DECL) +{ + ACE_NEW_THROW_EX (proxy, + TAO_NS_StructuredProxyPushConsumer (), + CORBA::NO_MEMORY ()); +} + +void +TAO_NS_Default_Factory::create (TAO_NS_StructuredProxyPushSupplier*& proxy ACE_ENV_ARG_DECL) +{ + ACE_NEW_THROW_EX (proxy, + TAO_NS_StructuredProxyPushSupplier (), + CORBA::NO_MEMORY ()); +} + +void +TAO_NS_Default_Factory::create (TAO_NS_ProxyPushConsumer*& proxy ACE_ENV_ARG_DECL) +{ + ACE_NEW_THROW_EX (proxy, + TAO_NS_ProxyPushConsumer (), + CORBA::NO_MEMORY ()); +} + +void +TAO_NS_Default_Factory::create (TAO_NS_ProxyPushSupplier*& proxy ACE_ENV_ARG_DECL) +{ + ACE_NEW_THROW_EX (proxy, + TAO_NS_ProxyPushSupplier (), + CORBA::NO_MEMORY ()); +} + +void +TAO_NS_Default_Factory::create (TAO_NS_CosEC_ProxyPushConsumer*& proxy ACE_ENV_ARG_DECL) +{ + ACE_NEW_THROW_EX (proxy, + TAO_NS_CosEC_ProxyPushConsumer (), + CORBA::NO_MEMORY ()); +} + +void +TAO_NS_Default_Factory::create (TAO_NS_CosEC_ProxyPushSupplier*& proxy ACE_ENV_ARG_DECL) +{ + ACE_NEW_THROW_EX (proxy, + TAO_NS_CosEC_ProxyPushSupplier (), + CORBA::NO_MEMORY ()); +} + +void +TAO_NS_Default_Factory::create (TAO_NS_SequenceProxyPushConsumer*& proxy ACE_ENV_ARG_DECL) +{ + ACE_NEW_THROW_EX (proxy, + TAO_NS_SequenceProxyPushConsumer (), + CORBA::NO_MEMORY ()); +} + +void +TAO_NS_Default_Factory::create (TAO_NS_SequenceProxyPushSupplier*& proxy ACE_ENV_ARG_DECL) +{ + ACE_NEW_THROW_EX (proxy, + TAO_NS_SequenceProxyPushSupplier (), + CORBA::NO_MEMORY ()); +} + +ACE_FACTORY_DECLARE (TAO_Notify, TAO_NS_Default_Factory) + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) + +template class TAO_NS_ProxySupplier_T ; +template class TAO_NS_Proxy_T ; +template class TAO_NS_ProxySupplier_T ; +template class TAO_NS_Proxy_T ; +template class TAO_NS_ProxySupplier_T ; +template class TAO_NS_Proxy_T ; +template class TAO_NS_ProxySupplier_T ; +template class TAO_NS_Proxy_T ; + +template class TAO_NS_ProxyConsumer_T ; +template class TAO_NS_Proxy_T ; +template class TAO_NS_ProxyConsumer_T ; +template class TAO_NS_Proxy_T ; +template class TAO_NS_ProxyConsumer_T ; +template class TAO_NS_Proxy_T ; +template class TAO_NS_ProxyConsumer_T ; +template class TAO_NS_Proxy_T ; + +template class TAO_ESF_Proxy_Collection; +template class TAO_ESF_Proxy_Collection; +template class TAO_ESF_Proxy_Collection; +template class TAO_ESF_Proxy_Collection; +template class TAO_ESF_Proxy_Collection; +template class TAO_ESF_Proxy_Collection; +template class TAO_ESF_Proxy_Collection; +template class TAO_ESF_Proxy_Collection; + +template class ACE_Unbounded_Set; +//template class ACE_Unbounded_Set; +template class ACE_Unbounded_Set; + +template class ACE_Unbounded_Set_Const_Iterator; +template class ACE_Unbounded_Set_Iterator; + +template class TAO_ESF_Copy_On_Write, ACE_Unbounded_Set_Iterator, ACE_SYNCH>; +template class TAO_ESF_Copy_On_Write, ACE_Unbounded_Set_Iterator, ACE_SYNCH>; +template class TAO_ESF_Copy_On_Write, ACE_Unbounded_Set_Iterator, ACE_SYNCH>; +template class TAO_ESF_Copy_On_Write, ACE_Unbounded_Set_Iterator, ACE_SYNCH>; +template class TAO_ESF_Copy_On_Write, ACE_Unbounded_Set_Iterator, ACE_SYNCH>; +template class TAO_ESF_Copy_On_Write, ACE_Unbounded_Set_Iterator, ACE_SYNCH>; +template class TAO_ESF_Copy_On_Write, ACE_Unbounded_Set_Iterator, ACE_SYNCH>; +template class TAO_ESF_Copy_On_Write, ACE_Unbounded_Set_Iterator, ACE_SYNCH>; + +template class TAO_ESF_Copy_On_Write_Read_Guard,ACE_Unbounded_Set_Iterator,ACE_SYNCH>; +template class TAO_ESF_Copy_On_Write_Read_Guard,ACE_Unbounded_Set_Iterator,ACE_SYNCH>; +template class TAO_ESF_Copy_On_Write_Read_Guard,ACE_Unbounded_Set_Iterator,ACE_SYNCH>; +template class TAO_ESF_Copy_On_Write_Read_Guard,ACE_Unbounded_Set_Iterator,ACE_SYNCH>; +template class TAO_ESF_Copy_On_Write_Read_Guard,ACE_Unbounded_Set_Iterator,ACE_SYNCH>; +template class TAO_ESF_Copy_On_Write_Read_Guard,ACE_Unbounded_Set_Iterator,ACE_SYNCH>; +template class TAO_ESF_Copy_On_Write_Read_Guard,ACE_Unbounded_Set_Iterator,ACE_SYNCH>; +template class TAO_ESF_Copy_On_Write_Read_Guard,ACE_Unbounded_Set_Iterator,ACE_SYNCH>; + + + +template class TAO_ESF_Proxy_List; +template class TAO_ESF_Proxy_List; +template class TAO_ESF_Proxy_List; +template class TAO_ESF_Proxy_List; +template class TAO_ESF_Proxy_List; +template class TAO_ESF_Proxy_List; +template class TAO_ESF_Proxy_List; +template class TAO_ESF_Proxy_List; + +template class ACE_Unbounded_Set; +template class ACE_Unbounded_Set; +template class ACE_Unbounded_Set; +template class ACE_Unbounded_Set; +template class ACE_Unbounded_Set; +template class ACE_Unbounded_Set; +template class ACE_Unbounded_Set; + +template class ACE_Unbounded_Set_Iterator; +template class ACE_Unbounded_Set_Iterator; +template class ACE_Unbounded_Set_Iterator; +template class ACE_Unbounded_Set_Iterator; +template class ACE_Unbounded_Set_Iterator; +template class ACE_Unbounded_Set_Iterator; +template class ACE_Unbounded_Set_Iterator; +template class ACE_Unbounded_Set_Iterator; + +template class TAO_ESF_Copy_On_Write_Write_Guard, ACE_Unbounded_Set_Iterator, ACE_SYNCH>; +template class TAO_ESF_Copy_On_Write_Write_Guard, ACE_Unbounded_Set_Iterator, ACE_SYNCH>; +template class TAO_ESF_Copy_On_Write_Write_Guard, ACE_Unbounded_Set_Iterator, ACE_SYNCH>; +template class TAO_ESF_Copy_On_Write_Write_Guard, ACE_Unbounded_Set_Iterator, ACE_SYNCH>; +template class TAO_ESF_Copy_On_Write_Write_Guard, ACE_Unbounded_Set_Iterator, ACE_SYNCH>; +template class TAO_ESF_Copy_On_Write_Write_Guard, ACE_Unbounded_Set_Iterator, ACE_SYNCH>; +template class TAO_ESF_Copy_On_Write_Write_Guard, ACE_Unbounded_Set_Iterator, ACE_SYNCH>; +template class TAO_ESF_Copy_On_Write_Write_Guard, ACE_Unbounded_Set_Iterator, ACE_SYNCH>; + +template class TAO_ESF_Copy_On_Write_Collection, ACE_Unbounded_Set_Iterator >; +template class TAO_ESF_Copy_On_Write_Collection, ACE_Unbounded_Set_Iterator >; +template class TAO_ESF_Copy_On_Write_Collection, ACE_Unbounded_Set_Iterator >; +template class TAO_ESF_Copy_On_Write_Collection, ACE_Unbounded_Set_Iterator >; +template class TAO_ESF_Copy_On_Write_Collection, ACE_Unbounded_Set_Iterator >; +template class TAO_ESF_Copy_On_Write_Collection, ACE_Unbounded_Set_Iterator >; +template class TAO_ESF_Copy_On_Write_Collection, ACE_Unbounded_Set_Iterator >; +template class TAO_ESF_Copy_On_Write_Collection, ACE_Unbounded_Set_Iterator >; + +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) + +#pragma instantiate TAO_NS_ProxySupplier_T +#pragma instantiate TAO_NS_Proxy_T +#pragma instantiate TAO_NS_ProxySupplier_T +#pragma instantiate TAO_NS_Proxy_T +#pragma instantiate TAO_NS_ProxySupplier_T +#pragma instantiate TAO_NS_Proxy_T +#pragma instantiate TAO_NS_ProxySupplier_T +#pragma instantiate TAO_NS_Proxy_T + +#pragma instantiate TAO_NS_ProxyConsumer_T +#pragma instantiate TAO_NS_Proxy_T +#pragma instantiate TAO_NS_ProxyConsumer_T +#pragma instantiate TAO_NS_Proxy_T +#pragma instantiate TAO_NS_ProxyConsumer_T +#pragma instantiate TAO_NS_Proxy_T +#pragma instantiate TAO_NS_ProxyConsumer_T +#pragma instantiate TAO_NS_Proxy_T + +#pragma instantiate TAO_ESF_Proxy_Collection +#pragma instantiate TAO_ESF_Proxy_Collection +#pragma instantiate TAO_ESF_Proxy_Collection +#pragma instantiate TAO_ESF_Proxy_Collection +#pragma instantiate TAO_ESF_Proxy_Collection +#pragma instantiate TAO_ESF_Proxy_Collection +#pragma instantiate TAO_ESF_Proxy_Collection +#pragma instantiate TAO_ESF_Proxy_Collection + +#pragma instantiate ACE_Unbounded_Set +#pragma instantiate ACE_Unbounded_Set +#pragma instantiate ACE_Unbounded_Set + +#pragma instantiate ACE_Unbounded_Set_Const_Iterator +#pragma instantiate ACE_Unbounded_Set_Iterator + +#pragma instantiate TAO_ESF_Copy_On_Write, ACE_Unbounded_Set_Iterator, ACE_SYNCH> +#pragma instantiate TAO_ESF_Copy_On_Write, ACE_Unbounded_Set_Iterator, ACE_SYNCH> +#pragma instantiate TAO_ESF_Copy_On_Write, ACE_Unbounded_Set_Iterator, ACE_SYNCH> +#pragma instantiate TAO_ESF_Copy_On_Write, ACE_Unbounded_Set_Iterator, ACE_SYNCH> +#pragma instantiate TAO_ESF_Copy_On_Write, ACE_Unbounded_Set_Iterator, ACE_SYNCH> +#pragma instantiate TAO_ESF_Copy_On_Write, ACE_Unbounded_Set_Iterator, ACE_SYNCH> +#pragma instantiate TAO_ESF_Copy_On_Write, ACE_Unbounded_Set_Iterator, ACE_SYNCH> +#pragma instantiate TAO_ESF_Copy_On_Write, ACE_Unbounded_Set_Iterator, ACE_SYNCH> + +#pragma instantiate TAO_ESF_Copy_On_Write_Read_Guard,ACE_Unbounded_Set_Iterator,ACE_SYNCH> +#pragma instantiate TAO_ESF_Copy_On_Write_Read_Guard,ACE_Unbounded_Set_Iterator,ACE_SYNCH> +#pragma instantiate TAO_ESF_Copy_On_Write_Read_Guard,ACE_Unbounded_Set_Iterator,ACE_SYNCH> +#pragma instantitae TAO_ESF_Copy_On_Write_Read_Guard,ACE_Unbounded_Set_Iterator,ACE_SYNCH> +#pragma instantiate TAO_ESF_Copy_On_Write_Read_Guard,ACE_Unbounded_Set_Iterator,ACE_SYNCH> +#pragma instantiate TAO_ESF_Copy_On_Write_Read_Guard,ACE_Unbounded_Set_Iterator,ACE_SYNCH> +#pragma instantiate TAO_ESF_Copy_On_Write_Read_Guard,ACE_Unbounded_Set_Iterator,ACE_SYNCH> +#pragma instantiate TAO_ESF_Copy_On_Write_Read_Guard,ACE_Unbounded_Set_Iterator,ACE_SYNCH> + + + +#pragma instantiate TAO_ESF_Proxy_List +#pragma instantiate TAO_ESF_Proxy_List +#pragma instantiate TAO_ESF_Proxy_List +#pragma instantiate TAO_ESF_Proxy_List +#pragma instantiate TAO_ESF_Proxy_List +#pragma instantiate TAO_ESF_Proxy_List +#pragma instantiate TAO_ESF_Proxy_List +#pragma instantiate TAO_ESF_Proxy_List + +#pragma instantiate ACE_Unbounded_Set +#pragma instantiate ACE_Unbounded_Set +#pragma instantiate ACE_Unbounded_Set +#pragma instantiate ACE_Unbounded_Set +#pragma instantiate ACE_Unbounded_Set +#pragma instantiate ACE_Unbounded_Set +#pragma instantiate ACE_Unbounded_Set + +#pragma instantiate ACE_Unbounded_Set_Iterator +#pragma instantiate ACE_Unbounded_Set_Iterator +#pragma instantiate ACE_Unbounded_Set_Iterator +#pragma instantiate ACE_Unbounded_Set_Iterator +#pragma instantiate ACE_Unbounded_Set_Iterator +#pragma instantiate ACE_Unbounded_Set_Iterator +#pragma instantiate ACE_Unbounded_Set_Iterator +#pragma instantiate ACE_Unbounded_Set_Iterator + +#pragma instantiate TAO_ESF_Copy_On_Write_Write_Guard, ACE_Unbounded_Set_Iterator, ACE_SYNCH> +#pragma instantiate TAO_ESF_Copy_On_Write_Write_Guard, ACE_Unbounded_Set_Iterator, ACE_SYNCH> +#pragma instantiate TAO_ESF_Copy_On_Write_Write_Guard, ACE_Unbounded_Set_Iterator, ACE_SYNCH> +#pragma instantiate TAO_ESF_Copy_On_Write_Write_Guard, ACE_Unbounded_Set_Iterator, ACE_SYNCH> +#pragma instantiate TAO_ESF_Copy_On_Write_Write_Guard, ACE_Unbounded_Set_Iterator, ACE_SYNCH> +#pragma instantiate TAO_ESF_Copy_On_Write_Write_Guard, ACE_Unbounded_Set_Iterator, ACE_SYNCH> +#pragma instantiate TAO_ESF_Copy_On_Write_Write_Guard, ACE_Unbounded_Set_Iterator, ACE_SYNCH> +#pragma instantiate TAO_ESF_Copy_On_Write_Write_Guard, ACE_Unbounded_Set_Iterator, ACE_SYNCH> + +#pragma instantiate TAO_ESF_Copy_On_Write_Collection, ACE_Unbounded_Set_Iterator > +#pragma instantiate TAO_ESF_Copy_On_Write_Collection, ACE_Unbounded_Set_Iterator > +#pragma instantiate TAO_ESF_Copy_On_Write_Collection, ACE_Unbounded_Set_Iterator > +#pragma instantiate TAO_ESF_Copy_On_Write_Collection, ACE_Unbounded_Set_Iterator > +#pragma instantiate TAO_ESF_Copy_On_Write_Collection, ACE_Unbounded_Set_Iterator > +#pragma instantiate TAO_ESF_Copy_On_Write_Collection, ACE_Unbounded_Set_Iterator > +#pragma instantiate TAO_ESF_Copy_On_Write_Collection, ACE_Unbounded_Set_Iterator > +#pragma instantiate TAO_ESF_Copy_On_Write_Collection, ACE_Unbounded_Set_Iterator > + +#endif /*ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Default_Factory.h b/TAO/orbsvcs/orbsvcs/Notify/Default_Factory.h new file mode 100644 index 00000000000..61f7086bf5e --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Default_Factory.h @@ -0,0 +1,101 @@ +/* -*- C++ -*- */ +/** + * @file Default_Factory.h + * + * $Id$ + * + * @author Pradeep Gore + * + * + */ + +#ifndef TAO_NS_DEFAULT_FACTORY_H +#define TAO_NS_DEFAULT_FACTORY_H +#include "ace/pre.h" + +#include "notify_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "Factory.h" + +/** + * @class TAO_NS_Default_Factory + * + * @brief Default_Factory interface for creating Notify Objects. + * + */ +class TAO_Notify_Export TAO_NS_Default_Factory : public TAO_NS_Factory +{ +public: + /// Constructor + TAO_NS_Default_Factory (void); + + /// Destructor + virtual ~TAO_NS_Default_Factory (); + + /// Create ProxySupplier Collection + virtual void create (TAO_NS_ProxySupplier_Collection*& collection ACE_ENV_ARG_DECL); + + /// Create ProxyConsumer Collection + virtual void create (TAO_NS_ProxyConsumer_Collection*& collection ACE_ENV_ARG_DECL); + + /// Create EventChannel Collection + virtual void create (TAO_NS_EventChannel_Collection*& collection ACE_ENV_ARG_DECL); + + /// Create ConsumerAdmin Collection + virtual void create (TAO_NS_ConsumerAdmin_Collection*& collection ACE_ENV_ARG_DECL); + + /// Create SupplierAdmin Collection + virtual void create (TAO_NS_SupplierAdmin_Collection*& collection ACE_ENV_ARG_DECL); + + /// Create Proxy Collection + virtual void create (TAO_NS_Proxy_Collection*& collection ACE_ENV_ARG_DECL); + + /// Create EventChannelDefault_Factory + virtual void create (TAO_NS_EventChannelFactory*& channel_factory ACE_ENV_ARG_DECL); + + /// Create EventChannel + virtual void create (TAO_NS_EventChannel*& channel ACE_ENV_ARG_DECL); + + /// Create SupplierAdmin + virtual void create (TAO_NS_SupplierAdmin*& admin ACE_ENV_ARG_DECL); + + /// Create ConsumerAdmin + virtual void create (TAO_NS_ConsumerAdmin*& admin ACE_ENV_ARG_DECL); + + /// Create ProxyPushConsumer + virtual void create (TAO_NS_ProxyPushConsumer*& proxy ACE_ENV_ARG_DECL); + + /// Create ProxyPushSupplier + virtual void create (TAO_NS_ProxyPushSupplier*& proxy ACE_ENV_ARG_DECL); + + /// Create CosEC_ProxyPushConsumer + virtual void create (TAO_NS_CosEC_ProxyPushConsumer*& proxy ACE_ENV_ARG_DECL); + + /// Create CosEC_ProxyPushSupplier + virtual void create (TAO_NS_CosEC_ProxyPushSupplier*& proxy ACE_ENV_ARG_DECL); + + /// Create StructuredProxyPushConsumer + virtual void create (TAO_NS_StructuredProxyPushConsumer*& proxy ACE_ENV_ARG_DECL); + + /// Create StructuredProxyPushSupplier + virtual void create (TAO_NS_StructuredProxyPushSupplier*& proxy ACE_ENV_ARG_DECL); + + /// Create SequenceProxyPushConsumer + virtual void create (TAO_NS_SequenceProxyPushConsumer*& proxy ACE_ENV_ARG_DECL); + + /// Create SequenceProxyPushSupplier + virtual void create (TAO_NS_SequenceProxyPushSupplier*& proxy ACE_ENV_ARG_DECL); +}; + +ACE_FACTORY_DECLARE (TAO_Notify, TAO_NS_Default_Factory) + +#if defined (__ACE_INLINE__) +#include "Default_Factory.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* TAO_NS_DEFAULT_FACTORY_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Default_Factory.inl b/TAO/orbsvcs/orbsvcs/Notify/Default_Factory.inl new file mode 100644 index 00000000000..cfa1da318d3 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Default_Factory.inl @@ -0,0 +1 @@ +// $Id$ diff --git a/TAO/orbsvcs/orbsvcs/Notify/ETCL_Filter.cpp b/TAO/orbsvcs/orbsvcs/Notify/ETCL_Filter.cpp index 562a6f9d6a0..84046b5f46d 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/ETCL_Filter.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/ETCL_Filter.cpp @@ -10,7 +10,7 @@ ACE_RCSID(Notify, TAO_ETCL_Filter, "$id$") #include "ace/Auto_Ptr.h" #include "tao/debug.h" -#include "Constraint_Visitors.h" +#include "Notify_Constraint_Visitors.h" TAO_NS_ETCL_Filter::TAO_NS_ETCL_Filter (void) { @@ -18,14 +18,22 @@ TAO_NS_ETCL_Filter::TAO_NS_ETCL_Filter (void) TAO_NS_ETCL_Filter::~TAO_NS_ETCL_Filter () { - ACE_DECLARE_NEW_CORBA_ENV; - this->remove_all_constraints (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - if (TAO_debug_level > 0) + ACE_TRY_NEW_ENV { - ACE_DEBUG ((LM_DEBUG, "Filter Destroyed\n")); + this->remove_all_constraints (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + } + ACE_CATCHANY + { + if (TAO_debug_level) + ACE_DEBUG ((LM_DEBUG, "Error in Filter dtor\n")); + + // @@ eat exception. } + ACE_ENDTRY; + + if (TAO_debug_level > 1) + ACE_DEBUG ((LM_DEBUG, "Filter Destroyed\n")); } char* @@ -39,55 +47,40 @@ TAO_NS_ETCL_Filter::constraint_grammar (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) void TAO_NS_ETCL_Filter::add_constraints_i (const CosNotifyFilter::ConstraintInfoSeq& constraint_info_seq - ACE_ENV_ARG_DECL - ) + ACE_ENV_ARG_DECL + ) ACE_THROW_SPEC (( CORBA::SystemException, CosNotifyFilter::InvalidConstraint )) { - for (CORBA::ULong index = 0; - index < constraint_info_seq.length (); - ++index) + for (CORBA::ULong index = 0; index < constraint_info_seq.length (); ++index) { TAO_NS_Constraint_Expr* notify_constr_expr; - ACE_TRY - { - ACE_NEW_THROW_EX (notify_constr_expr, - TAO_NS_Constraint_Expr (), - CORBA::NO_MEMORY ()); + ACE_NEW_THROW_EX (notify_constr_expr, + TAO_NS_Constraint_Expr (), + CORBA::NO_MEMORY ()); + auto_ptr auto_expr (notify_constr_expr); - const CosNotifyFilter::ConstraintExp& expr = - constraint_info_seq[index].constraint_expression; + const CosNotifyFilter::ConstraintExp& expr = + constraint_info_seq[index].constraint_expression; - notify_constr_expr->interpreter.build_tree ( - expr.constraint_expr.in () - ACE_ENV_ARG_PARAMETER - ); - ACE_TRY_CHECK; + notify_constr_expr->interpreter. + build_tree (expr.constraint_expr.in () ACE_ENV_ARG_PARAMETER); + ACE_CHECK; - notify_constr_expr->constr_expr = expr; + notify_constr_expr->constr_expr = expr; - CosNotifyFilter::ConstraintID cnstr_id = ++constraint_expr_ids_; + CosNotifyFilter::ConstraintID cnstr_id = ++constraint_expr_ids_; - if (this->constraint_expr_list_.bind (cnstr_id, notify_constr_expr) - == -1) - { - ACE_THROW (CORBA::NO_RESOURCES ()); - } + if (this->constraint_expr_list_.bind (cnstr_id, notify_constr_expr) == -1) + ACE_THROW (CORBA::INTERNAL ()); - if (TAO_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, "Added constraint to filter %x\n", this, expr.constraint_expr.in ())); - } - ACE_CATCHANY - { - // Delete the one that failed us. - delete notify_constr_expr; - ACE_RE_THROW; - } - ACE_ENDTRY; - ACE_CHECK; + if (TAO_debug_level > 1) + ACE_DEBUG ((LM_DEBUG, "Added constraint to filter %x\n", this, expr.constraint_expr.in ())); + + auto_expr.release (); } } @@ -100,30 +93,30 @@ TAO_NS_ETCL_Filter::add_constraints (const CosNotifyFilter::ConstraintExpSeq& co CosNotifyFilter::InvalidConstraint )) { + ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, ace_mon, this->lock_, + CORBA::INTERNAL ()); + ACE_CHECK_RETURN (0); + CORBA::ULong constraint_length = constraint_list.length (); if (TAO_debug_level > 0) - { - ACE_DEBUG ((LM_DEBUG, - "constraint_length = %d\n", + ACE_DEBUG ((LM_DEBUG, "constraint_length = %d\n", constraint_length)); - } // Create the list that goes out. - CosNotifyFilter::ConstraintInfoSeq *infoseq; - ACE_NEW_THROW_EX (infoseq, + CosNotifyFilter::ConstraintInfoSeq* infoseq_ptr; + ACE_NEW_THROW_EX (infoseq_ptr, CosNotifyFilter::ConstraintInfoSeq (constraint_length), CORBA::NO_MEMORY ()); ACE_CHECK_RETURN (0); + CosNotifyFilter::ConstraintInfoSeq_var infoseq (infoseq_ptr); infoseq->length (constraint_length); - auto_ptr auto_infoseq (infoseq); - // Populate infoseq. for (CORBA::ULong pop_index = 0; pop_index < constraint_length; ++pop_index) { - (*infoseq)[pop_index].constraint_expression = + infoseq[pop_index].constraint_expression = constraint_list [pop_index]; if (TAO_debug_level > 0) @@ -135,13 +128,10 @@ TAO_NS_ETCL_Filter::add_constraints (const CosNotifyFilter::ConstraintExpSeq& co } } - this->add_constraints_i (*infoseq - ACE_ENV_ARG_PARAMETER); + this->add_constraints_i (infoseq.in () ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (0); - auto_infoseq.release (); - - return infoseq; + return infoseq._retn (); } void @@ -155,6 +145,10 @@ TAO_NS_ETCL_Filter::modify_constraints (const CosNotifyFilter::ConstraintIDSeq & CosNotifyFilter::ConstraintNotFound )) { + ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, ace_mon, this->lock_, + CORBA::INTERNAL ()); + ACE_CHECK; + // First check if all the ids are valid. u_int index; @@ -230,21 +224,25 @@ TAO_NS_ETCL_Filter::modify_constraints (const CosNotifyFilter::ConstraintIDSeq & } } -CosNotifyFilter::ConstraintInfoSeq * +CosNotifyFilter::ConstraintInfoSeq* TAO_NS_ETCL_Filter::get_constraints (const CosNotifyFilter::ConstraintIDSeq & id_list ACE_ENV_ARG_DECL ) ACE_THROW_SPEC ((CORBA::SystemException, CosNotifyFilter::ConstraintNotFound)) { + ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, ace_mon, this->lock_, + CORBA::INTERNAL ()); + ACE_CHECK; + // Create the list that goes out. - CosNotifyFilter::ConstraintInfoSeq *infoseq; - ACE_NEW_THROW_EX (infoseq, + CosNotifyFilter::ConstraintInfoSeq *infoseq_ptr; + ACE_NEW_THROW_EX (infoseq_ptr, CosNotifyFilter::ConstraintInfoSeq (id_list.length ()), CORBA::NO_MEMORY ()); ACE_CHECK_RETURN (0); - auto_ptr auto_infoseq (infoseq); + CosNotifyFilter::ConstraintInfoSeq_var infoseq (infoseq_ptr); TAO_NS_Constraint_Expr *notify_constr_expr = 0; @@ -255,33 +253,39 @@ TAO_NS_ETCL_Filter::get_constraints (const CosNotifyFilter::ConstraintIDSeq & id ACE_THROW_RETURN (CosNotifyFilter::ConstraintNotFound (id_list[index]), 0); - (*infoseq)[index].constraint_expression = + infoseq[index].constraint_expression = notify_constr_expr->constr_expr; // Get an id. - (*infoseq)[index].constraint_id = id_list[index]; + infoseq[index].constraint_id = id_list[index]; } - auto_infoseq.release (); - return infoseq; + return infoseq._retn (); } CosNotifyFilter::ConstraintInfoSeq * TAO_NS_ETCL_Filter::get_all_constraints (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { + ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, ace_mon, this->lock_, + CORBA::INTERNAL ()); + ACE_CHECK; + size_t current_size = this->constraint_expr_list_.current_size (); // Create the list that goes out. - CosNotifyFilter::ConstraintInfoSeq *infoseq; - ACE_NEW_THROW_EX (infoseq, + CosNotifyFilter::ConstraintInfoSeq *infoseq_ptr; + ACE_NEW_THROW_EX (infoseq_ptr, CosNotifyFilter::ConstraintInfoSeq (current_size), CORBA::NO_MEMORY ()); ACE_CHECK_RETURN (0); + CosNotifyFilter::ConstraintInfoSeq_var infoseq (infoseq_ptr); + infoseq->length (current_size); - CONSTRAINT_EXPR_LIST_ITER iter (this->constraint_expr_list_); - CONSTRAINT_EXPR_ENTRY *entry; + + CONSTRAINT_EXPR_LIST::ITERATOR iter (this->constraint_expr_list_); + CONSTRAINT_EXPR_LIST::ENTRY *entry; for (u_int index = 0; iter.done () == 0; iter.advance (), ++index) { @@ -291,23 +295,34 @@ TAO_NS_ETCL_Filter::get_all_constraints (ACE_ENV_SINGLE_ARG_DECL) // We want to force the TAO_String_Manager to make a // copy of the string. It wouldn't unless we coax it to use // the correct assignment operator. - (*infoseq)[index].constraint_expression = + infoseq[index].constraint_expression = ACE_static_cast (const CosNotifyFilter::ConstraintExp, entry->int_id_->constr_expr); - (*infoseq)[index].constraint_id = entry->ext_id_; + infoseq[index].constraint_id = entry->ext_id_; } } - return infoseq; + return infoseq._retn (); +} + +void +TAO_NS_ETCL_Filter::remove_all_constraints (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC ((CORBA::SystemException)) +{ + ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, ace_mon, this->lock_, + CORBA::INTERNAL ()); + ACE_CHECK; + + this->remove_all_constraints_i (ACE_ENV_SINGLE_ARG_PARAMETER); } void -TAO_NS_ETCL_Filter::remove_all_constraints (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) +TAO_NS_ETCL_Filter::remove_all_constraints_i (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) ACE_THROW_SPEC ((CORBA::SystemException)) { - CONSTRAINT_EXPR_LIST_ITER iter (this->constraint_expr_list_); - CONSTRAINT_EXPR_ENTRY *entry; + CONSTRAINT_EXPR_LIST::ITERATOR iter (this->constraint_expr_list_); + CONSTRAINT_EXPR_LIST::ENTRY *entry; u_int index; @@ -326,7 +341,11 @@ void TAO_NS_ETCL_Filter::destroy (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { - this->remove_all_constraints (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, ace_mon, this->lock_, + CORBA::INTERNAL ()); + ACE_CHECK; + + this->remove_all_constraints_i (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK; PortableServer::POA_var my_POA = _default_POA (); @@ -338,7 +357,7 @@ TAO_NS_ETCL_Filter::destroy (ACE_ENV_SINGLE_ARG_DECL) CORBA::Boolean TAO_NS_ETCL_Filter::match (const CORBA::Any & /*filterable_data */ - ACE_ENV_ARG_DECL) + ACE_ENV_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException, CosNotifyFilter::UnsupportedFilterableData)) { @@ -353,9 +372,13 @@ TAO_NS_ETCL_Filter::match_structured (const CosNotification::StructuredEvent & f ACE_THROW_SPEC ((CORBA::SystemException, CosNotifyFilter::UnsupportedFilterableData)) { + ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, ace_mon, this->lock_, + CORBA::INTERNAL ()); + ACE_CHECK; + // We want to return true if at least one constraint matches. - CONSTRAINT_EXPR_LIST_ITER iter (this->constraint_expr_list_); - CONSTRAINT_EXPR_ENTRY *entry; + CONSTRAINT_EXPR_LIST::ITERATOR iter (this->constraint_expr_list_); + CONSTRAINT_EXPR_LIST::ENTRY *entry; TAO_NS_Constraint_Visitor visitor; diff --git a/TAO/orbsvcs/orbsvcs/Notify/ETCL_Filter.h b/TAO/orbsvcs/orbsvcs/Notify/ETCL_Filter.h index 91163631b38..07448213366 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/ETCL_Filter.h +++ b/TAO/orbsvcs/orbsvcs/Notify/ETCL_Filter.h @@ -13,7 +13,7 @@ #define TAO_NS_ETCL_FILTER_H #include "ace/pre.h" -#include "etcl_notify_filtering_export.h" +#include "notify_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -23,7 +23,7 @@ #include "ace/Hash_Map_Manager.h" #include "ace/Atomic_Op.h" #include "orbsvcs/CosNotifyFilterS.h" -#include "Constraint_Interpreter.h" +#include "Notify_Constraint_Interpreter.h" #if defined(_MSC_VER) #if (_MSC_VER >= 1200) @@ -35,10 +35,10 @@ /** * @class TAO_ETCL_Filter * - * @brief + * @brief Implementation of CosNotifyFilter::Filter servant. * */ -class ETCL_Notify_Filtering_Export TAO_NS_ETCL_Filter : public POA_CosNotifyFilter::Filter, public PortableServer::RefCountServantBase +class TAO_Notify_Export TAO_NS_ETCL_Filter : public POA_CosNotifyFilter::Filter, public PortableServer::RefCountServantBase { public: /// Constuctor @@ -131,6 +131,11 @@ private: CosNotifyFilter::InvalidConstraint )); + void remove_all_constraints_i (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + struct TAO_NS_Constraint_Expr { // = DESCRIPTION @@ -143,24 +148,19 @@ private: // Constraint Interpreter. }; + /// Lock to serialize access to data members. + TAO_SYNCH_MUTEX lock_; + /// Id generator for ConstraintInfo's. - ACE_Atomic_Op constraint_expr_ids_; + ACE_Atomic_Op constraint_expr_ids_; /// A list of the constraints stored in this filter. - ACE_Hash_Map_Manager - constraint_expr_list_; - - typedef ACE_Hash_Map_Iterator - CONSTRAINT_EXPR_LIST_ITER; - - typedef ACE_Hash_Map_Entry - CONSTRAINT_EXPR_ENTRY; + typedef ACE_Hash_Map_Manager + CONSTRAINT_EXPR_LIST; + + CONSTRAINT_EXPR_LIST constraint_expr_list_; }; #if defined(_MSC_VER) && (_MSC_VER >= 1200) diff --git a/TAO/orbsvcs/orbsvcs/Notify/ETCL_Filter.inl b/TAO/orbsvcs/orbsvcs/Notify/ETCL_Filter.inl index 0d107de49d5..cfa1da318d3 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/ETCL_Filter.inl +++ b/TAO/orbsvcs/orbsvcs/Notify/ETCL_Filter.inl @@ -1,3 +1 @@ // $Id$ - -#include "ETCL_Filter.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/ETCL_FilterFactory.cpp b/TAO/orbsvcs/orbsvcs/Notify/ETCL_FilterFactory.cpp index 6177bc0c7ed..91f08daa78f 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/ETCL_FilterFactory.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/ETCL_FilterFactory.cpp @@ -19,8 +19,12 @@ TAO_NS_ETCL_FilterFactory::~TAO_NS_ETCL_FilterFactory () } CosNotifyFilter::FilterFactory_ptr -TAO_NS_ETCL_FilterFactory::create (ACE_ENV_SINGLE_ARG_DECL) +TAO_NS_ETCL_FilterFactory::create (PortableServer::POA_var& filter_poa ACE_ENV_ARG_DECL) { + this->filter_poa_ = filter_poa; // save the filter poa. + + PortableServer::ServantBase_var servant_var (this); + return _this (ACE_ENV_SINGLE_ARG_PARAMETER); } @@ -33,7 +37,8 @@ TAO_NS_ETCL_FilterFactory::create_filter (const char *constraint_grammar ACE_ENV { // @@: change to "ExTCL" later. if (ACE_OS::strcmp (constraint_grammar, "TCL") != 0 && - ACE_OS::strcmp (constraint_grammar, "ETCL") != 0) + ACE_OS::strcmp (constraint_grammar, "ETCL") != 0 && + ACE_OS::strcmp (constraint_grammar, "EXTENDED_TCL") != 0) ACE_THROW_RETURN (CosNotifyFilter::InvalidGrammar (), 0); @@ -44,18 +49,16 @@ TAO_NS_ETCL_FilterFactory::create_filter (const char *constraint_grammar ACE_ENV TAO_NS_ETCL_Filter (), CORBA::NO_MEMORY ()); - PortableServer::POA_var my_POA = _default_POA (); - PortableServer::ServantBase_var filter_var (filter); PortableServer::ObjectId_var oid = - my_POA->activate_object (filter - ACE_ENV_ARG_PARAMETER); + this->filter_poa_->activate_object (filter + ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (CosNotifyFilter::Filter::_nil ()); CORBA::Object_var obj = - my_POA->id_to_reference (oid.in () - ACE_ENV_ARG_PARAMETER); + this->filter_poa_->id_to_reference (oid.in () + ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (CosNotifyFilter::Filter::_nil ()); return CosNotifyFilter::Filter::_narrow (obj.in () @@ -65,14 +68,14 @@ TAO_NS_ETCL_FilterFactory::create_filter (const char *constraint_grammar ACE_ENV CosNotifyFilter::MappingFilter_ptr TAO_NS_ETCL_FilterFactory::create_mapping_filter (const char * /*constraint_grammar*/, const CORBA::Any & /*default_value*/ - ACE_ENV_ARG_DECL_NOT_USED //ACE_ENV_SINGLE_ARG_PARAMETER + ACE_ENV_ARG_DECL ) ACE_THROW_SPEC (( CORBA::SystemException, CosNotifyFilter::InvalidGrammar )) { - ACE_THROW ((CORBA::NO_IMPLEMENT ())); + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), CosNotifyFilter::MappingFilter::_nil ()); } -ACE_FACTORY_DEFINE (ETCL_Notify_Filtering, TAO_NS_ETCL_FilterFactory) +ACE_FACTORY_DEFINE (TAO_Notify, TAO_NS_ETCL_FilterFactory) diff --git a/TAO/orbsvcs/orbsvcs/Notify/ETCL_FilterFactory.h b/TAO/orbsvcs/orbsvcs/Notify/ETCL_FilterFactory.h index cdfb7bdb500..2257259fc0a 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/ETCL_FilterFactory.h +++ b/TAO/orbsvcs/orbsvcs/Notify/ETCL_FilterFactory.h @@ -13,22 +13,31 @@ #define TAO_NS_ETCL_FILTERFACTORY_H #include "ace/pre.h" -#include "etcl_notify_filtering_export.h" +#include "notify_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#include "orbsvcs/orbsvcs/CosNotifyFilterS.h" +#include "orbsvcs/CosNotifyFilterS.h" #include "FilterFactory.h" +#if defined(_MSC_VER) +#if (_MSC_VER >= 1200) +#pragma warning(push) +#endif /* _MSC_VER >= 1200 */ +#pragma warning(disable:4250) +#endif /* _MSC_VER */ + /** * @class TAO_NS_ETCL_FilterFactory * * @brief * */ -class ETCL_Notify_Filtering_Export TAO_NS_ETCL_FilterFactory : public POA_CosNotifyFilter::FilterFactory, public TAO_NS_FilterFactory +class TAO_Notify_Export TAO_NS_ETCL_FilterFactory : public virtual PortableServer::RefCountServantBase + , public virtual POA_CosNotifyFilter::FilterFactory + , public TAO_NS_FilterFactory { public: /// Constuctor @@ -39,7 +48,7 @@ public: ///= TAO_NS_FilterFactory methods. - virtual CosNotifyFilter::FilterFactory_ptr create (ACE_ENV_SINGLE_ARG_DECL); + virtual CosNotifyFilter::FilterFactory_ptr create (PortableServer::POA_var& filter_poa ACE_ENV_ARG_DECL); ///= CosNotifyFilter::FilterFactory methods @@ -59,9 +68,17 @@ public: CORBA::SystemException, CosNotifyFilter::InvalidGrammar )); + +protected: + /// The POA in which to activate the Filters. + PortableServer::POA_var filter_poa_; }; -ACE_FACTORY_DECLARE (ETCL_Notify_Filtering, TAO_NS_ETCL_FilterFactory) +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +#pragma warning(pop) +#endif /* _MSC_VER */ + +ACE_FACTORY_DECLARE (TAO_Notify, TAO_NS_ETCL_FilterFactory) #if defined (__ACE_INLINE__) #include "ETCL_FilterFactory.inl" diff --git a/TAO/orbsvcs/orbsvcs/Notify/ETCL_FilterFactory.inl b/TAO/orbsvcs/orbsvcs/Notify/ETCL_FilterFactory.inl index 9b048ecde54..cfa1da318d3 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/ETCL_FilterFactory.inl +++ b/TAO/orbsvcs/orbsvcs/Notify/ETCL_FilterFactory.inl @@ -1,3 +1 @@ // $Id$ - -#include "ETCL_FilterFactory.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/Event.cpp b/TAO/orbsvcs/orbsvcs/Notify/Event.cpp index d73d06bcbc6..dba27e9dffd 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Event.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Event.cpp @@ -1,7 +1,6 @@ // $Id$ #include "Event.h" -#include "tao/debug.h" #if ! defined (__ACE_INLINE__) #include "Event.inl" @@ -9,7 +8,12 @@ ACE_RCSID(RT_Notify, TAO_NS_Event, "$Id$") +#include "tao/debug.h" +#include "orbsvcs/CosNotificationC.h" + TAO_NS_Event::TAO_NS_Event (void) + :priority_ (CosNotification::Priority, CosNotification::DefaultPriority), + timeout_ (CosNotification::Timeout) { if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG,"event:%x created\n", this )); @@ -20,3 +24,23 @@ TAO_NS_Event::~TAO_NS_Event () if (TAO_debug_level > 1) ACE_DEBUG ((LM_DEBUG,"event:%x destroyed\n", this )); } + +void +TAO_NS_Event::translate (const CORBA::Any& any, CosNotification::StructuredEvent& notification) +{ + notification.remainder_of_body <<= any; + notification.header.fixed_header.event_type.type_name = CORBA::string_dup ("%ANY"); + notification.header.fixed_header.event_type.domain_name = CORBA::string_dup (""); +} + +void +TAO_NS_Event::translate (const CosNotification::StructuredEvent& notification, CORBA::Any& any) +{ + any <<= notification; // is the typecode set by this operation or do we need to set it explicity. +} + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) +template class ACE_Auto_Basic_Ptr; +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +#pragma instantiate ACE_Auto_Basic_Ptr +#endif /*ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Event.h b/TAO/orbsvcs/orbsvcs/Notify/Event.h index ce76ee569d0..bbe45c870e3 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Event.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Event.h @@ -22,9 +22,12 @@ #include "ace/Copy_Disabled.h" #include "orbsvcs/Event_ForwarderS.h" #include "orbsvcs/CosNotifyFilterC.h" +#include "orbsvcs/CosNotificationC.h" +#include "Property.h" +#include "Property_T.h" -class TAO_NS_EventType; class TAO_NS_Consumer; +class TAO_NS_EventType; /** * @class TAO_NS_Event @@ -41,22 +44,58 @@ public: /// Destructor virtual ~TAO_NS_Event (); + /// Translate Any to Structured + static void translate (const CORBA::Any& any, CosNotification::StructuredEvent& notification); + + /// Translate Structured to Any + static void translate (const CosNotification::StructuredEvent& notification, CORBA::Any& any); + /// Get the event type. virtual const TAO_NS_EventType& type (void) const = 0; /// Returns true if the filter matches. virtual CORBA::Boolean do_match (CosNotifyFilter::Filter_ptr filter ACE_ENV_ARG_DECL) = 0; + /// Convert to CosNotification::Structured type + virtual void convert (CosNotification::StructuredEvent& notification) = 0; + /// Push event to consumer virtual void push (TAO_NS_Consumer* consumer ACE_ENV_ARG_DECL) const = 0; /// Push event to the Event_Forwarder interface - virtual void push (Notify_Internal::Event_Forwarder_ptr forwarder ACE_ENV_ARG_DECL) = 0; + virtual void push (Event_Forwarder::StructuredProxyPushSupplier_ptr forwarder ACE_ENV_ARG_DECL) = 0; + + /// Push event to the Event_Forwarder interface + virtual void push_no_filtering (Event_Forwarder::StructuredProxyPushSupplier_ptr forwarder ACE_ENV_ARG_DECL) = 0; + + /// Push event to the Event_Forwarder interface + virtual void push (Event_Forwarder::ProxyPushSupplier_ptr forwarder ACE_ENV_ARG_DECL) = 0; + + /// Push event to the Event_Forwarder interface + virtual void push_no_filtering (Event_Forwarder::ProxyPushSupplier_ptr forwarder ACE_ENV_ARG_DECL) = 0; + + ///= Accessors + /// Priority + TAO_NS_Property_Short& priority (void); - /// Push event to the Event_Forwarder interface - virtual void push_no_filtering (Notify_Internal::Event_Forwarder_ptr forwarder ACE_ENV_ARG_DECL) = 0; + /// Timeout + TAO_NS_Property_Time& timeout (void); + +protected: + /// = QoS properties + + /// Priority. + TAO_NS_Property_Short priority_; + + /// Timeout. + TAO_NS_Property_Time timeout_; }; +template class ACE_Refcounted_Auto_Ptr; +template class ACE_Unbounded_Queue; +typedef ACE_Refcounted_Auto_Ptr TAO_NS_Event_var; +typedef ACE_Unbounded_Queue TAO_NS_Event_Collection; + #if defined (__ACE_INLINE__) #include "Event.inl" #endif /* __ACE_INLINE__ */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Event.inl b/TAO/orbsvcs/orbsvcs/Notify/Event.inl index 43b0ff7781b..019194c78aa 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Event.inl +++ b/TAO/orbsvcs/orbsvcs/Notify/Event.inl @@ -1,3 +1,13 @@ // $Id$ -#include "Event.h" +ACE_INLINE TAO_NS_Property_Short& +TAO_NS_Event::priority (void) +{ + return this->priority_; +} + +ACE_INLINE TAO_NS_Property_Time& +TAO_NS_Event::timeout (void) +{ + return this->timeout_; +} diff --git a/TAO/orbsvcs/orbsvcs/Notify/EventChannel.cpp b/TAO/orbsvcs/orbsvcs/Notify/EventChannel.cpp index 36a3e8205da..c816c90acd0 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/EventChannel.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/EventChannel.cpp @@ -1,44 +1,117 @@ // $Id$ #include "EventChannel.h" -#include "EventChannelFactory.h" -#include "Proxy.h" -#include "Admin.h" -#include "Event_Manager.h" -#include "Properties.h" -#include "Builder.h" -#include "ThreadPool_Task.h" -#include "QoSAdmin.h" #if ! defined (__ACE_INLINE__) #include "EventChannel.inl" #endif /* __ACE_INLINE__ */ +#include "Container_T.h" +#include "EventChannelFactory.h" +#include "ConsumerAdmin.h" +#include "SupplierAdmin.h" +#include "Event_Manager.h" +#include "Properties.h" +#include "Factory.h" +#include "Builder.h" +#include "Find_Worker_T.h" +#include "Seq_Worker_T.h" + ACE_RCSID(RT_Notify, TAO_NS_EventChannel, "$Id$") - TAO_NS_EventChannel::TAO_NS_EventChannel (void) +TAO_NS_EventChannel::TAO_NS_EventChannel (void) + : ecf_ (0) + , ca_container_ (0) + , sa_container_ (0) { } TAO_NS_EventChannel::~TAO_NS_EventChannel () { - delete event_manager_; + delete this->event_manager_; // The EventChannel always owns the EventManager. + + this->ecf_->_decr_refcnt (); } -PortableServer::Servant -TAO_NS_EventChannel::servant (void) +void +TAO_NS_EventChannel::init (TAO_NS_EventChannelFactory* ecf + , const CosNotification::QoSProperties & initial_qos + , const CosNotification::AdminProperties & initial_admin + ACE_ENV_ARG_DECL) { - return this; + this->TAO_NS_Object::init (ecf); + + this->ecf_ = ecf; + + this->ecf_->_incr_refcnt (); + + // Init ca_container_ + ACE_NEW_THROW_EX (this->ca_container_, + TAO_NS_ConsumerAdmin_Container (), + CORBA::INTERNAL ()); + ACE_CHECK; + + this->ca_container_->init (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + // Init ca_container_ + ACE_NEW_THROW_EX (this->sa_container_, + TAO_NS_SupplierAdmin_Container (), + CORBA::INTERNAL ()); + ACE_CHECK; + + this->sa_container_->init (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + TAO_NS_AdminProperties* admin_properties = 0; + + // Set the admin properties. + ACE_NEW_THROW_EX (admin_properties, + TAO_NS_AdminProperties (), + CORBA::NO_MEMORY ()); + ACE_CHECK; + + this->admin_properties_ = admin_properties; + + // create the event manager. @@ use factory + ACE_NEW_THROW_EX (this->event_manager_, + TAO_NS_Event_Manager (), + CORBA::INTERNAL ()); + ACE_CHECK; + + this->event_manager_->init (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + const CosNotification::QoSProperties &default_ec_qos = + TAO_NS_PROPERTIES::instance ()->default_event_channel_qos_properties (); + + this->set_qos (default_ec_qos ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + this->set_qos (initial_qos ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + this->set_admin (initial_admin ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + CosNotifyChannelAdmin::AdminID id; + + // Set the default ConsumerAdmin. + this->default_consumer_admin_ = this->new_for_consumers (CosNotifyChannelAdmin::OR_OP, id ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + // Set the default SupplierAdmin. + this->default_supplier_admin_ = this->new_for_suppliers (CosNotifyChannelAdmin::OR_OP, id ACE_ENV_ARG_PARAMETER); } void -TAO_NS_EventChannel::_add_ref (ACE_ENV_SINGLE_ARG_DECL) +TAO_NS_EventChannel::_add_ref (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) { this->_incr_refcnt (); } void -TAO_NS_EventChannel::_remove_ref (ACE_ENV_SINGLE_ARG_DECL) +TAO_NS_EventChannel::_remove_ref (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) { this->_decr_refcnt (); } @@ -50,14 +123,51 @@ TAO_NS_EventChannel::release (void) //@@ inform factory } +int +TAO_NS_EventChannel::shutdown (ACE_ENV_SINGLE_ARG_DECL) +{ + if (TAO_NS_Object::shutdown (ACE_ENV_SINGLE_ARG_PARAMETER) == 1) + return 1; + + this->ca_container_->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (1); + + this->sa_container_->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (1); + + delete this->ca_container_; + delete this->sa_container_; + + this->event_manager_->shutdown (); + + return 0; +} + void TAO_NS_EventChannel::destroy (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException )) { - this->inherited::destroy (this ACE_ENV_ARG_PARAMETER); - this->event_manager_->shutdown (); + if (this->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER) == 1) + return; + + ACE_CHECK; + + this->ecf_->remove (this ACE_ENV_ARG_PARAMETER); + ACE_CHECK; +} + +void +TAO_NS_EventChannel::remove (TAO_NS_ConsumerAdmin* consumer_admin ACE_ENV_ARG_DECL) +{ + this->ca_container_->remove (consumer_admin ACE_ENV_ARG_PARAMETER); +} + +void +TAO_NS_EventChannel::remove (TAO_NS_SupplierAdmin* supplier_admin ACE_ENV_ARG_DECL) +{ + this->sa_container_->remove (supplier_admin ACE_ENV_ARG_PARAMETER); } void @@ -67,42 +177,43 @@ TAO_NS_EventChannel::set_qos (const CosNotification::QoSProperties & qos ACE_ENV , CosNotification::UnsupportedQoS )) { - this->qos_admin_->apply_qos (this, qos ACE_ENV_ARG_PARAMETER); + this->TAO_NS_Object::set_qos (qos ACE_ENV_ARG_PARAMETER); } -::CosNotifyChannelAdmin::EventChannelFactory_ptr -TAO_NS_EventChannel::MyFactory () +CosNotification::QoSProperties* +TAO_NS_EventChannel::get_qos (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException )) - { - //Add your implementation here - return 0; + return this->TAO_NS_Object::get_qos (ACE_ENV_SINGLE_ARG_PARAMETER); } -::CosNotifyChannelAdmin::ConsumerAdmin_ptr TAO_NS_EventChannel::default_consumer_admin ( - - ) +CosNotifyChannelAdmin::EventChannelFactory_ptr +TAO_NS_EventChannel::MyFactory (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException )) - { - //Add your implementation here - return 0; + return this->ecf_->_this (ACE_ENV_SINGLE_ARG_PARAMETER); } -::CosNotifyChannelAdmin::SupplierAdmin_ptr TAO_NS_EventChannel::default_supplier_admin ( - - ) +CosNotifyChannelAdmin::ConsumerAdmin_ptr +TAO_NS_EventChannel::default_consumer_admin (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) ACE_THROW_SPEC (( CORBA::SystemException )) +{ + return CosNotifyChannelAdmin::ConsumerAdmin::_duplicate (this->default_consumer_admin_.in ()); +} +CosNotifyChannelAdmin::SupplierAdmin_ptr +TAO_NS_EventChannel::default_supplier_admin (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) + ACE_THROW_SPEC (( + CORBA::SystemException + )) { - //Add your implementation here - return 0; + return CosNotifyChannelAdmin::SupplierAdmin::_duplicate (this->default_supplier_admin_.in ()); } ::CosNotifyFilter::FilterFactory_ptr TAO_NS_EventChannel::default_filter_factory (ACE_ENV_SINGLE_ARG_DECL) @@ -110,20 +221,19 @@ TAO_NS_EventChannel::MyFactory () CORBA::SystemException )) { - return this->parent_->get_default_filter_factory (ACE_ENV_SINGLE_ARG_PARAMETER); + return this->ecf_->get_default_filter_factory (ACE_ENV_SINGLE_ARG_PARAMETER); } ::CosNotifyChannelAdmin::ConsumerAdmin_ptr TAO_NS_EventChannel::new_for_consumers (CosNotifyChannelAdmin::InterFilterGroupOperator op, - CosNotifyChannelAdmin::AdminID_out id + CosNotifyChannelAdmin::AdminID_out id ACE_ENV_ARG_DECL ) ACE_THROW_SPEC (( CORBA::SystemException )) { - /// Builder for ConsumerAdmins - return TAO_NS_PROPERTIES::instance()->builder ()->build_consumer_admin (this, op, id); + return TAO_NS_PROPERTIES::instance()->builder()->build_consumer_admin (this, op, id ACE_ENV_ARG_PARAMETER); } ::CosNotifyChannelAdmin::SupplierAdmin_ptr @@ -134,131 +244,136 @@ TAO_NS_EventChannel::new_for_suppliers (CosNotifyChannelAdmin::InterFilterGroupO ACE_THROW_SPEC (( CORBA::SystemException )) - { - /// Builder for SupplierAdmins - return TAO_NS_PROPERTIES::instance()->builder ()->build_supplier_admin (this, op, id); + return TAO_NS_PROPERTIES::instance()->builder()->build_supplier_admin (this, op, id ACE_ENV_ARG_PARAMETER); } -::CosNotifyChannelAdmin::ConsumerAdmin_ptr TAO_NS_EventChannel::get_consumeradmin ( - CosNotifyChannelAdmin::AdminID id - ) +CosNotifyChannelAdmin::ConsumerAdmin_ptr +TAO_NS_EventChannel::get_consumeradmin (CosNotifyChannelAdmin::AdminID id ACE_ENV_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException , CosNotifyChannelAdmin::AdminNotFound )) - { - //Add your implementation here - return 0; + TAO_NS_Find_Worker_T find_worker; + + return find_worker.resolve (id, *this->ca_container_ ACE_ENV_ARG_PARAMETER); } -::CosNotifyChannelAdmin::SupplierAdmin_ptr TAO_NS_EventChannel::get_supplieradmin ( - CosNotifyChannelAdmin::AdminID id - ) +CosNotifyChannelAdmin::SupplierAdmin_ptr +TAO_NS_EventChannel::get_supplieradmin (CosNotifyChannelAdmin::AdminID id ACE_ENV_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException , CosNotifyChannelAdmin::AdminNotFound )) - { - //Add your implementation here - return 0; -} + TAO_NS_Find_Worker_T find_worker; -::CosNotifyChannelAdmin::AdminIDSeq * TAO_NS_EventChannel::get_all_consumeradmins ( + return find_worker.resolve (id, *this->sa_container_ ACE_ENV_ARG_PARAMETER); +} - ) +CosNotifyChannelAdmin::AdminIDSeq* +TAO_NS_EventChannel::get_all_consumeradmins (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException )) - { - //Add your implementation here - return 0; -} + TAO_NS_Seq_Worker_T seq_worker; -::CosNotifyChannelAdmin::AdminIDSeq * TAO_NS_EventChannel::get_all_supplieradmins ( + return seq_worker.create (*this->ca_container_ ACE_ENV_ARG_PARAMETER); +} - ) +CosNotifyChannelAdmin::AdminIDSeq* +TAO_NS_EventChannel::get_all_supplieradmins (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException )) - { - //Add your implementation here - return 0; -} + TAO_NS_Seq_Worker_T seq_worker; -::CosNotification::QoSProperties * TAO_NS_EventChannel::get_qos ( + return seq_worker.create (*this->sa_container_ ACE_ENV_ARG_PARAMETER); +} - ) +void +TAO_NS_EventChannel::set_admin (const CosNotification::AdminProperties & admin ACE_ENV_ARG_DECL_NOT_USED) ACE_THROW_SPEC (( CORBA::SystemException + , CosNotification::UnsupportedAdmin )) - { - //Add your implementation here - return 0; + this->admin_properties_->init (admin); } -void TAO_NS_EventChannel::validate_qos ( - const CosNotification::QoSProperties & required_qos, - CosNotification::NamedPropertyRangeSeq_out available_qos - ) +CosNotification::AdminProperties* +TAO_NS_EventChannel::get_admin (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException - , CosNotification::UnsupportedQoS )) - { - //Add your implementation here -} + CosNotification::AdminProperties_var properties; -::CosNotification::AdminProperties * TAO_NS_EventChannel::get_admin ( + ACE_NEW_THROW_EX (properties, + CosNotification::AdminProperties (), + CORBA::NO_MEMORY ()); - ) - ACE_THROW_SPEC (( - CORBA::SystemException - )) + this->admin_properties_->populate (properties); -{ - //Add your implementation here - return 0; + return properties._retn (); } -void TAO_NS_EventChannel::set_admin ( - const CosNotification::AdminProperties & admin - ) +CosEventChannelAdmin::ConsumerAdmin_ptr +TAO_NS_EventChannel::for_consumers (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) ACE_THROW_SPEC (( CORBA::SystemException - , CosNotification::UnsupportedAdmin )) - { - //Add your implementation here + return CosEventChannelAdmin::ConsumerAdmin::_duplicate (this->default_consumer_admin_.in ()); } -::CosEventChannelAdmin::ConsumerAdmin_ptr TAO_NS_EventChannel::for_consumers ( - - ) +CosEventChannelAdmin::SupplierAdmin_ptr +TAO_NS_EventChannel::for_suppliers (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) ACE_THROW_SPEC (( CORBA::SystemException )) - { - //Add your implementation here - return 0; + return CosEventChannelAdmin::SupplierAdmin::_duplicate (this->default_supplier_admin_.in ()); } -::CosEventChannelAdmin::SupplierAdmin_ptr TAO_NS_EventChannel::for_suppliers ( - - ) +void +TAO_NS_EventChannel::validate_qos (const CosNotification::QoSProperties & /*required_qos*/, + CosNotification::NamedPropertyRangeSeq_out /*available_qos*/ + ACE_ENV_ARG_DECL + ) ACE_THROW_SPEC (( CORBA::SystemException + , CosNotification::UnsupportedQoS )) - { - //Add your implementation here - return 0; + ACE_THROW (CORBA::NO_IMPLEMENT ()); } + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) + +template class TAO_NS_Find_Worker_T; +template class TAO_NS_Find_Worker_T; +template class TAO_NS_Seq_Worker_T; +template class TAO_NS_Seq_Worker_T; +template class TAO_NS_Container_T ; +template class TAO_NS_Container_T ; + +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) + +#pragma instantiate TAO_NS_Find_Worker_T +#pragma instantiate TAO_NS_Find_Worker_T +#pragma instantiate TAO_NS_Seq_Worker_T +#pragma instantiate TAO_NS_Seq_Worker_T +#pragma instantiate TAO_NS_Container_T +#pragma instantiate TAO_NS_Container_T + +#endif /*ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/EventChannel.h b/TAO/orbsvcs/orbsvcs/Notify/EventChannel.h index 030da306008..d49929af4fa 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/EventChannel.h +++ b/TAO/orbsvcs/orbsvcs/Notify/EventChannel.h @@ -20,14 +20,19 @@ #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "orbsvcs/CosNotifyChannelAdminS.h" -#include "orbsvcs/NotifyExtC.h" -#include "Container_T.h" -#include "Destroy_Callback.h" +#include "Object.h" -//#include "Admin.h" - -class TAO_NS_Admin; +class TAO_NS_ConsumerAdmin; +class TAO_NS_SupplierAdmin; class TAO_NS_EventChannelFactory; +template class TAO_NS_Container_T; + +#if defined(_MSC_VER) +#if (_MSC_VER >= 1200) +#pragma warning(push) +#endif /* _MSC_VER >= 1200 */ +#pragma warning(disable:4250) +#endif /* _MSC_VER */ /** * @class TAO_NS_EventChannel @@ -35,31 +40,62 @@ class TAO_NS_EventChannelFactory; * @brief Implementation of CosNotifyChannelAdmin::EventChannel * */ -class TAO_Notify_Export TAO_NS_EventChannel : public POA_CosNotifyChannelAdmin::EventChannel, public TAO_NS_Container_T , public TAO_NS_Destroy_Callback +class TAO_Notify_Export TAO_NS_EventChannel : public POA_CosNotifyChannelAdmin::EventChannel + , public virtual TAO_NS_Object { friend class TAO_NS_Builder; - typedef TAO_NS_Container_T inherited; public: + typedef CosNotifyChannelAdmin::ChannelIDSeq SEQ; + typedef CosNotifyChannelAdmin::ChannelIDSeq_var SEQ_VAR; + /// Constuctor TAO_NS_EventChannel (void); /// Destructor ~TAO_NS_EventChannel (); - /// Return servant - virtual PortableServer::Servant servant (void); + /// Init + void init (TAO_NS_EventChannelFactory* ecf + , const CosNotification::QoSProperties & initial_qos + , const CosNotification::AdminProperties & initial_admin + ACE_ENV_ARG_DECL); + + /// Remove ConsumerAdmin from its container. + void remove (TAO_NS_ConsumerAdmin* consumer_admin ACE_ENV_ARG_DECL); + + /// Remove SupplierAdmin from its container. + void remove (TAO_NS_SupplierAdmin* supplier_admin ACE_ENV_ARG_DECL); /// ServantBase refcount methods. virtual void _add_ref (ACE_ENV_SINGLE_ARG_DECL); virtual void _remove_ref (ACE_ENV_SINGLE_ARG_DECL); - /// TAO_NS_Destroy_Callback methods + /// Release virtual void release (void); + /// Shutdown + virtual int shutdown (ACE_ENV_SINGLE_ARG_DECL); + protected: + typedef TAO_NS_Container_T TAO_NS_ConsumerAdmin_Container; + typedef TAO_NS_Container_T TAO_NS_SupplierAdmin_Container; + /// = Data Members + /// The parent object. + TAO_NS_EventChannelFactory* ecf_; + + /// ConsumerAdmin Container. + TAO_NS_ConsumerAdmin_Container *ca_container_; + + /// SupplierAdmin Container. + TAO_NS_SupplierAdmin_Container *sa_container_; + // Default Consumer Admin + CosNotifyChannelAdmin::ConsumerAdmin_var default_consumer_admin_; + + // Default Supplier Admin + CosNotifyChannelAdmin::SupplierAdmin_var default_supplier_admin_; /// =CosNotifyChannelAdmin::EventChannel methods @@ -68,20 +104,20 @@ protected: CORBA::SystemException )); - virtual ::CosNotifyChannelAdmin::EventChannelFactory_ptr MyFactory ( + virtual ::CosNotifyChannelAdmin::EventChannelFactory_ptr MyFactory (ACE_ENV_SINGLE_ARG_DECL ) ACE_THROW_SPEC (( CORBA::SystemException )); - virtual ::CosNotifyChannelAdmin::ConsumerAdmin_ptr default_consumer_admin ( + virtual ::CosNotifyChannelAdmin::ConsumerAdmin_ptr default_consumer_admin (ACE_ENV_SINGLE_ARG_DECL ) ACE_THROW_SPEC (( CORBA::SystemException )); - virtual ::CosNotifyChannelAdmin::SupplierAdmin_ptr default_supplier_admin ( + virtual ::CosNotifyChannelAdmin::SupplierAdmin_ptr default_supplier_admin (ACE_ENV_SINGLE_ARG_DECL ) ACE_THROW_SPEC (( @@ -93,107 +129,90 @@ protected: CORBA::SystemException )); - virtual ::CosNotifyChannelAdmin::ConsumerAdmin_ptr new_for_consumers ( - CosNotifyChannelAdmin::InterFilterGroupOperator op, + virtual ::CosNotifyChannelAdmin::ConsumerAdmin_ptr new_for_consumers (CosNotifyChannelAdmin::InterFilterGroupOperator op, CosNotifyChannelAdmin::AdminID_out id - ) + ACE_ENV_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException )); - virtual ::CosNotifyChannelAdmin::SupplierAdmin_ptr new_for_suppliers ( - CosNotifyChannelAdmin::InterFilterGroupOperator op, + virtual ::CosNotifyChannelAdmin::SupplierAdmin_ptr new_for_suppliers (CosNotifyChannelAdmin::InterFilterGroupOperator op, CosNotifyChannelAdmin::AdminID_out id - ACE_ENV_ARG_DECL - ) + ACE_ENV_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException )); - virtual ::CosNotifyChannelAdmin::ConsumerAdmin_ptr get_consumeradmin ( - CosNotifyChannelAdmin::AdminID id - ) + virtual ::CosNotifyChannelAdmin::ConsumerAdmin_ptr get_consumeradmin (CosNotifyChannelAdmin::AdminID id + ACE_ENV_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException , CosNotifyChannelAdmin::AdminNotFound )); - virtual ::CosNotifyChannelAdmin::SupplierAdmin_ptr get_supplieradmin ( - CosNotifyChannelAdmin::AdminID id - ) + virtual ::CosNotifyChannelAdmin::SupplierAdmin_ptr get_supplieradmin (CosNotifyChannelAdmin::AdminID id + ACE_ENV_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException , CosNotifyChannelAdmin::AdminNotFound )); - virtual ::CosNotifyChannelAdmin::AdminIDSeq * get_all_consumeradmins ( - - ) + virtual ::CosNotifyChannelAdmin::AdminIDSeq * get_all_consumeradmins (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException )); - virtual ::CosNotifyChannelAdmin::AdminIDSeq * get_all_supplieradmins ( - - ) + virtual ::CosNotifyChannelAdmin::AdminIDSeq * get_all_supplieradmins (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException )); - virtual ::CosNotification::QoSProperties * get_qos ( - - ) + virtual ::CosNotification::QoSProperties * get_qos (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException )); - virtual void set_qos ( - const CosNotification::QoSProperties & qos - ) + virtual void set_qos (const CosNotification::QoSProperties & qos + ACE_ENV_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException , CosNotification::UnsupportedQoS )); - virtual void validate_qos ( - const CosNotification::QoSProperties & required_qos, + virtual void validate_qos (const CosNotification::QoSProperties & required_qos, CosNotification::NamedPropertyRangeSeq_out available_qos - ) + ACE_ENV_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException , CosNotification::UnsupportedQoS )); - virtual ::CosNotification::AdminProperties * get_admin ( - - ) + virtual ::CosNotification::AdminProperties * get_admin (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException )); - virtual void set_admin ( - const CosNotification::AdminProperties & admin - ) + virtual void set_admin (const CosNotification::AdminProperties & admin ACE_ENV_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException , CosNotification::UnsupportedAdmin )); - virtual ::CosEventChannelAdmin::ConsumerAdmin_ptr for_consumers ( - - ) + virtual ::CosEventChannelAdmin::ConsumerAdmin_ptr for_consumers (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException )); - virtual ::CosEventChannelAdmin::SupplierAdmin_ptr for_suppliers ( - - ) + virtual ::CosEventChannelAdmin::SupplierAdmin_ptr for_suppliers (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException )); }; +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +#pragma warning(pop) +#endif /* _MSC_VER */ + #if defined (__ACE_INLINE__) #include "EventChannel.inl" #endif /* __ACE_INLINE__ */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/EventChannel.inl b/TAO/orbsvcs/orbsvcs/Notify/EventChannel.inl index d0dad8b7dd7..cfa1da318d3 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/EventChannel.inl +++ b/TAO/orbsvcs/orbsvcs/Notify/EventChannel.inl @@ -1,3 +1 @@ // $Id$ - -#include "EventChannel.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/EventChannelFactory.cpp b/TAO/orbsvcs/orbsvcs/Notify/EventChannelFactory.cpp index cd10b67bddd..bc0eb18f7f2 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/EventChannelFactory.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/EventChannelFactory.cpp @@ -1,12 +1,6 @@ // $Id$ #include "EventChannelFactory.h" -#include "Properties.h" -#include "Builder.h" -#include "Proxy.h" -#include "Admin.h" -#include "EventChannel.h" -#include "orbsvcs/ESF/ESF_Proxy_Collection.h" #if ! defined (__ACE_INLINE__) #include "EventChannelFactory.inl" @@ -14,7 +8,17 @@ ACE_RCSID(RT_Notify, TAO_NS_EventChannelFactory, "$Id$") +#include "ace/Dynamic_Service.h" +#include "Properties.h" +#include "Factory.h" +#include "Builder.h" +#include "EventChannel.h" +#include "Container_T.h" +#include "Find_Worker_T.h" +#include "Seq_Worker_T.h" + TAO_NS_EventChannelFactory::TAO_NS_EventChannelFactory (void) + :ec_container_ (0) { } @@ -23,25 +27,76 @@ TAO_NS_EventChannelFactory::~TAO_NS_EventChannelFactory () } void -TAO_NS_EventChannelFactory::init (ACE_ENV_SINGLE_ARG_DECL) +TAO_NS_EventChannelFactory::destroy (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException + )) { - this->default_filter_factory_ = TAO_NS_PROPERTIES::instance()->builder ()->build_filter_factory (ACE_ENV_ARG_PARAMETER); + if (this->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER) == 1) + return; + + this->ec_container_->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + TAO_NS_Properties* properties = TAO_NS_PROPERTIES::instance(); + + delete this->ec_container_; + + // Shutdown the ORB. + CORBA::ORB_var orb = properties->orb (); + orb->shutdown (); + + // Reset references to CORBA objects. + properties->orb (CORBA::ORB::_nil ()); + properties->default_poa (PortableServer::POA::_nil ()); } -PortableServer::Servant -TAO_NS_EventChannelFactory::servant (void) +void +TAO_NS_EventChannelFactory::init (PortableServer::POA_ptr poa ACE_ENV_ARG_DECL) { - return this; + this->default_filter_factory_ = + TAO_NS_PROPERTIES::instance()->builder()->build_filter_factory (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + // Init ec_container_ + ACE_NEW_THROW_EX (this->ec_container_, + TAO_NS_EventChannel_Container (), + CORBA::INTERNAL ()); + ACE_CHECK; + + this->ec_container_->init (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + TAO_NS_POA_Helper* object_poa = 0; + + // Bootstrap initial Object POA + ACE_NEW_THROW_EX (object_poa, + TAO_NS_POA_Helper (), + CORBA::NO_MEMORY ()); + ACE_CHECK; + + auto_ptr auto_object_poa (object_poa); + + object_poa->init (poa ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + // release auto_ref. + auto_object_poa.release (); + + this->object_poa_own (object_poa); + + // We are also activated in the same Object POA. + this->poa_ = this->object_poa_; } void -TAO_NS_EventChannelFactory::_add_ref (ACE_ENV_SINGLE_ARG_DECL) +TAO_NS_EventChannelFactory::_add_ref (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) { this->_incr_refcnt (); } void -TAO_NS_EventChannelFactory::_remove_ref (ACE_ENV_SINGLE_ARG_DECL) +TAO_NS_EventChannelFactory::_remove_ref (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) { this->_decr_refcnt (); } @@ -53,8 +108,27 @@ TAO_NS_EventChannelFactory::release (void) //@@ inform factory } +void +TAO_NS_EventChannelFactory::remove (TAO_NS_EventChannel* event_channel ACE_ENV_ARG_DECL) +{ + this->ec_container_->remove (event_channel ACE_ENV_ARG_PARAMETER); + ACE_CHECK; +} + +int +TAO_NS_EventChannelFactory::shutdown (ACE_ENV_SINGLE_ARG_DECL) +{ + if (TAO_NS_Object::shutdown (ACE_ENV_SINGLE_ARG_PARAMETER) == 1) + return 1; + + this->ec_container_->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (1); + + return 0; +} + CosNotifyFilter::FilterFactory_ptr -TAO_NS_EventChannelFactory::get_default_filter_factory (void) +TAO_NS_EventChannelFactory::get_default_filter_factory (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) { return CosNotifyFilter::FilterFactory::_duplicate (this->default_filter_factory_.in ()); } @@ -65,35 +139,54 @@ TAO_NS_EventChannelFactory::get_default_filter_factory (void) CosNotifyChannelAdmin::ChannelID_out id ACE_ENV_ARG_DECL ) ACE_THROW_SPEC (( - CORBA::SystemException - , CosNotification::UnsupportedQoS - , CosNotification::UnsupportedAdmin - )) + CORBA::SystemException + , CosNotification::UnsupportedQoS + , CosNotification::UnsupportedAdmin + )) { - return TAO_NS_PROPERTIES::instance()->builder ()->build_event_channel (this, initial_qos, initial_admin, id ACE_ENV_ARG_PARAMETER); + return TAO_NS_PROPERTIES::instance()->builder()->build_event_channel (this + , initial_qos + , initial_admin + , id + ACE_ENV_ARG_PARAMETER); } -::CosNotifyChannelAdmin::ChannelIDSeq *TAO_NS_EventChannelFactory::get_all_channels ( - - ) +CosNotifyChannelAdmin::ChannelIDSeq* +TAO_NS_EventChannelFactory::get_all_channels (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException )) +{ + TAO_NS_Seq_Worker_T seq_worker; - { - return 0; - //Add your implementation here - } + return seq_worker.create (*this->ec_container_ ACE_ENV_ARG_PARAMETER); +} -::CosNotifyChannelAdmin::EventChannel_ptr TAO_NS_EventChannelFactory::get_event_channel ( - CosNotifyChannelAdmin::ChannelID id - ) +CosNotifyChannelAdmin::EventChannel_ptr +TAO_NS_EventChannelFactory::get_event_channel (CosNotifyChannelAdmin::ChannelID id ACE_ENV_ARG_DECL) ACE_THROW_SPEC (( - CORBA::SystemException - , CosNotifyChannelAdmin::ChannelNotFound - )) + CORBA::SystemException + , CosNotifyChannelAdmin::ChannelNotFound + )) +{ + TAO_NS_Find_Worker_T find_worker; + + return find_worker.resolve (id, *this->ec_container_ ACE_ENV_ARG_PARAMETER); +} + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) + +template class TAO_NS_Find_Worker_T; +template class TAO_NS_Seq_Worker_T; +template class TAO_NS_Container_T ; + +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) + +#pragma instantiate TAO_NS_Find_Worker_T +#pragma instantiate TAO_NS_Seq_Worker_T +#pragma instantiate TAO_NS_Container_T - { - //Add your implementation here - return 0; - } +#endif /*ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/EventChannelFactory.h b/TAO/orbsvcs/orbsvcs/Notify/EventChannelFactory.h index 3c875b4198b..268618aaf32 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/EventChannelFactory.h +++ b/TAO/orbsvcs/orbsvcs/Notify/EventChannelFactory.h @@ -20,10 +20,18 @@ #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "orbsvcs/CosNotifyChannelAdminS.h" -#include "Container_T.h" -#include "Destroy_Callback.h" +#include "orbsvcs/NotifyExtS.h" +#include "Object.h" class TAO_NS_EventChannel; +template class TAO_NS_Container_T; + +#if defined(_MSC_VER) +#if (_MSC_VER >= 1200) +#pragma warning(push) +#endif /* _MSC_VER >= 1200 */ +#pragma warning(disable:4250) +#endif /* _MSC_VER */ /** * @class TAO_NS_EventChannelFactory @@ -31,7 +39,8 @@ class TAO_NS_EventChannel; * @brief Implementation of CosNotifyChannelAdmin::EventChannelFactory * */ -class TAO_Notify_Export TAO_NS_EventChannelFactory : public virtual POA_CosNotifyChannelAdmin::EventChannelFactory, public TAO_NS_Container_T , public TAO_NS_Destroy_Callback +class TAO_Notify_Export TAO_NS_EventChannelFactory : public virtual POA_NotifyExt::EventChannelFactory + , public virtual TAO_NS_Object { friend class TAO_NS_Builder; @@ -40,59 +49,71 @@ public: TAO_NS_EventChannelFactory (void); /// Init the factory - void init (ACE_ENV_SINGLE_ARG_DECL); + void init (PortableServer::POA_ptr poa ACE_ENV_ARG_DECL); /// Destructor virtual ~TAO_NS_EventChannelFactory (); - /// Return servant - virtual PortableServer::Servant servant (void); - /// = ServantBase Methods virtual void _add_ref (ACE_ENV_SINGLE_ARG_DECL); virtual void _remove_ref (ACE_ENV_SINGLE_ARG_DECL); - /// TAO_NS_Destroy_Callback methods + /// Release this object. virtual void release (void); + /// Remove from the + void remove (TAO_NS_EventChannel* channel ACE_ENV_ARG_DECL); + /// Accesor for the default filter factory shared by all EC's. virtual CosNotifyFilter::FilterFactory_ptr get_default_filter_factory (ACE_ENV_SINGLE_ARG_DECL); + /// shutdown + virtual int shutdown (ACE_ENV_SINGLE_ARG_DECL); + protected: + typedef TAO_NS_Container_T TAO_NS_EventChannel_Container; + /// = Data Members + /// Container for Event Channels. + TAO_NS_EventChannel_Container *ec_container_; /// The default filter factory. CosNotifyFilter::FilterFactory_var default_filter_factory_; + /// = NotifyExt method + virtual void destroy (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + /// = CosNotifyChannelAdmin Methods - virtual ::CosNotifyChannelAdmin::EventChannel_ptr create_channel ( - const CosNotification::QoSProperties & initial_qos, - const CosNotification::AdminProperties & initial_admin, - CosNotifyChannelAdmin::ChannelID_out id ACE_ENV_ARG_DECL - ) - ACE_THROW_SPEC (( - CORBA::SystemException - , CosNotification::UnsupportedQoS - , CosNotification::UnsupportedAdmin - )); - -virtual ::CosNotifyChannelAdmin::ChannelIDSeq * get_all_channels ( - - ) - ACE_THROW_SPEC (( - CORBA::SystemException - )); - -virtual ::CosNotifyChannelAdmin::EventChannel_ptr get_event_channel ( - CosNotifyChannelAdmin::ChannelID id - ) - ACE_THROW_SPEC (( - CORBA::SystemException - , CosNotifyChannelAdmin::ChannelNotFound - )); + virtual ::CosNotifyChannelAdmin::EventChannel_ptr create_channel (const CosNotification::QoSProperties & initial_qos, + const CosNotification::AdminProperties & initial_admin, + CosNotifyChannelAdmin::ChannelID_out id ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotification::UnsupportedQoS + , CosNotification::UnsupportedAdmin + )); + + virtual ::CosNotifyChannelAdmin::ChannelIDSeq * get_all_channels (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + + virtual ::CosNotifyChannelAdmin::EventChannel_ptr get_event_channel (CosNotifyChannelAdmin::ChannelID id + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotifyChannelAdmin::ChannelNotFound + )); }; +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +#pragma warning(pop) +#endif /* _MSC_VER */ + #if defined (__ACE_INLINE__) #include "EventChannelFactory.inl" #endif /* __ACE_INLINE__ */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/EventChannelFactory.inl b/TAO/orbsvcs/orbsvcs/Notify/EventChannelFactory.inl index 0db217ba45b..cfa1da318d3 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/EventChannelFactory.inl +++ b/TAO/orbsvcs/orbsvcs/Notify/EventChannelFactory.inl @@ -1,3 +1 @@ // $Id$ - -#include "EventChannelFactory.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/EventType.cpp b/TAO/orbsvcs/orbsvcs/Notify/EventType.cpp index ccee7778d4f..9ac68b89aad 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/EventType.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/EventType.cpp @@ -121,3 +121,9 @@ TAO_NS_EventType::is_special (void) const else return 0; } + +void +TAO_NS_EventType::dump (void) const +{ + ACE_DEBUG ((LM_DEBUG, "(%s,%s)", this->event_type_.domain_name.in (), this->event_type_.type_name.in ())); +} diff --git a/TAO/orbsvcs/orbsvcs/Notify/EventType.h b/TAO/orbsvcs/orbsvcs/Notify/EventType.h index e23bf4cfe04..edeaca96cbc 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/EventType.h +++ b/TAO/orbsvcs/orbsvcs/Notify/EventType.h @@ -24,7 +24,7 @@ /** * @class TAO_NS_EventType * - * @brief + * @brief * * This type is used to compare different event types. * It is used by the Event Manager as a key to find subscription lists. @@ -44,7 +44,7 @@ public: /// hash value u_long hash (void) const; - + /// Assignment from CosNotification::EventType TAO_NS_EventType& operator=(const CosNotification::EventType& event_type); @@ -66,6 +66,9 @@ public: const CosNotification::EventType& native (void) const; // Get the type underneath us. + /// Helper to print contents. + void dump (void) const; + protected: /// Init this object. void init_i (const char* domain_name, const char* type_name); diff --git a/TAO/orbsvcs/orbsvcs/Notify/EventType.inl b/TAO/orbsvcs/orbsvcs/Notify/EventType.inl index 2c8af265fe4..93af3791bf9 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/EventType.inl +++ b/TAO/orbsvcs/orbsvcs/Notify/EventType.inl @@ -1,7 +1,5 @@ // $Id$ -#include "EventType.h" - ACE_INLINE u_long TAO_NS_EventType::hash (void) const { diff --git a/TAO/orbsvcs/orbsvcs/Notify/EventTypeSeq.cpp b/TAO/orbsvcs/orbsvcs/Notify/EventTypeSeq.cpp index ad1bbe48cc6..ccd6389e10c 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/EventTypeSeq.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/EventTypeSeq.cpp @@ -22,7 +22,7 @@ TAO_NS_EventTypeSeq::populate (CosNotification::EventTypeSeq& event_type_seq) co { event_type_seq.length (this->size ()); - TAO_NS_EventTypeSeq::CONST_ITERATOR iter (*this); + inherited::CONST_ITERATOR iter (*this); TAO_NS_EventType* event_type; @@ -31,6 +31,31 @@ TAO_NS_EventTypeSeq::populate (CosNotification::EventTypeSeq& event_type_seq) co event_type_seq[i] = event_type->native (); } +void +TAO_NS_EventTypeSeq::populate_no_special (CosNotification::EventTypeSeq& event_type_seq) const +{ + // If the special exists in us, don't include it. + const TAO_NS_EventType& special = TAO_NS_EventType::special (); + + if (this->find (special) == 0) + { + event_type_seq.length (this->size () - 1); + } + else + event_type_seq.length (this->size ()); + + inherited::CONST_ITERATOR iter (*this); + + TAO_NS_EventType* event_type; + + CORBA::ULong i = 0; + for (iter.first (); iter.next (event_type); iter.advance (), ++i) + { + if (event_type->is_special () == 0) // if its not the special event type. + event_type_seq[i] = event_type->native (); + } +} + void TAO_NS_EventTypeSeq::insert_seq (const CosNotification::EventTypeSeq& event_type_seq) { @@ -78,63 +103,121 @@ TAO_NS_EventTypeSeq::remove_seq (const TAO_NS_EventTypeSeq& event_type_seq) } void -TAO_NS_EventTypeSeq::init (TAO_NS_EventTypeSeq& seq_added, TAO_NS_EventTypeSeq& seq_remove_seq) +TAO_NS_EventTypeSeq::init (TAO_NS_EventTypeSeq& seq_added, TAO_NS_EventTypeSeq& seq_remove) { const TAO_NS_EventType& special = TAO_NS_EventType::special (); - if (this->find (special) == 0) + if (this->find (special) == 0) // If this object has the special type. { - if (seq_added.find (special) == 0) + if (seq_added.find (special) == 0) // if the seq. being added has the special type, you cannot be adding or removing anythings. * overrides. { - seq_added.reset (); - seq_remove_seq.reset (); + seq_added.reset (); // remove everything from the sequence bening added. + seq_remove.reset (); // remove everything form whats being removed. } - else + else // sequence being added does not have * { - this->reset (); - this->insert_seq (seq_added); + this->reset (); // take away the * from this object. + this->insert_seq (seq_added); // insert the sequence being added as the new list of types. - seq_remove_seq.reset (); - seq_remove_seq.insert (special); + seq_remove.reset (); // reset all that is being removed. + seq_remove.insert (special); // remove * } } - else + else // if this object does not have the special type. { - if (seq_added.find (special) == 0) + if (seq_added.find (special) == 0) // but the seq. being added has the special type, { - if (seq_remove_seq.find (special) == 0) + if (seq_remove.find (special) == 0) // and you're removing * as well { - seq_added.reset (); - seq_remove_seq.reset (); + seq_added.reset (); // ignore the request + seq_remove.reset (); // ignore the request } - else + else // seq being removed does not have the special type { - seq_remove_seq.reset (); - seq_remove_seq.insert_seq (*this); + seq_remove.reset (); // everything that we're subscribed for is being removed. + seq_remove.insert_seq (*this); - this->reset (); + this->reset (); // insert the special in this object. this->insert (special); - seq_added.reset (); + seq_added.reset (); // also clear our set and add only * seq_added.insert (special); } } - else + else // seq being added does not have special. { - if (seq_remove_seq.find (special) == 0) + if (seq_remove.find (special) == 0) // but we're removing everything. { - - seq_remove_seq.reset (); - seq_remove_seq.insert_seq (*this); - - this->reset (); - this->insert_seq (seq_added); + seq_remove.reset (); // move all that we have currently to removed. + seq_remove.insert_seq (*this); } - else + + // so now there are no specials anywhere.. { + //= First remove the duplicates in the added and removes lists. + // compute the intersection. + + TAO_NS_EventTypeSeq common; + common.intersection (seq_added, seq_remove); + + // remove the common elements from both the lists so Added {BCDK} and Removed {CDEA} will yield Added {BK} and Removed {EA} + seq_added.remove_seq (common); + seq_remove.remove_seq (common); + + // If we're already subscribed for an element we should not subscribe again (duplicate events). + // so if we currently subscribe for ABC and we Added {BK} we should now get ABCK as current subscription and Added {K} + common.reset (); + common.intersection (*this, seq_added); + // remove the common elements from the added list. i,e. doent ask to add what we're already added for. + seq_added.remove_seq (common); + // update the current subscription. this->insert_seq (seq_added); - this->remove_seq (seq_remove_seq); + + + // Similarly for removed.. if we're removing EA and now our current list looks like ABC we should emd up with + // current subscription BC and Removed {A} + common.reset (); + common.intersection (*this, seq_remove); + + seq_remove.reset (); + seq_remove.insert_seq (common); // only remove what we currently have. + + this->remove_seq (seq_remove); } } } } + +void +TAO_NS_EventTypeSeq::intersection (const TAO_NS_EventTypeSeq& rhs, const TAO_NS_EventTypeSeq& lhs) +{ + // linear search. + TAO_NS_EventTypeSeq::CONST_ITERATOR rhs_iter (rhs); + TAO_NS_EventType* rhs_event_type; + + TAO_NS_EventTypeSeq::CONST_ITERATOR lhs_iter (lhs); + TAO_NS_EventType* lhs_event_type; + + for (rhs_iter.first (); rhs_iter.next (rhs_event_type); rhs_iter.advance ()) + { + for (lhs_iter.first (); lhs_iter.next (lhs_event_type); lhs_iter.advance ()) + { + if (*rhs_event_type == *lhs_event_type) // if both are same add to this object. + this->insert (*rhs_event_type); + } + } +} + +void +TAO_NS_EventTypeSeq::dump (void) const +{ + TAO_NS_EventTypeSeq::CONST_ITERATOR iter (*this); + + TAO_NS_EventType* event_type; + + for (iter.first (); iter.next (event_type); iter.advance ()) + { + event_type->dump (); + ACE_DEBUG ((LM_DEBUG, ", ")); + } +} diff --git a/TAO/orbsvcs/orbsvcs/Notify/EventTypeSeq.h b/TAO/orbsvcs/orbsvcs/Notify/EventTypeSeq.h index cad64ad4596..b695dc9ea10 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/EventTypeSeq.h +++ b/TAO/orbsvcs/orbsvcs/Notify/EventTypeSeq.h @@ -20,8 +20,7 @@ #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "EventType.h" - -template class ACE_Unbounded_Set; +#include "ace/Unbounded_Set.h" /** * @class TAO_NS_EventTypeSeq @@ -41,6 +40,9 @@ public: /// Preprocess the types added and removed. void init (TAO_NS_EventTypeSeq& added, TAO_NS_EventTypeSeq& removed); + /// Populate this sequence with the intersection of rhs and lhs. + void intersection (const TAO_NS_EventTypeSeq& rhs, const TAO_NS_EventTypeSeq& lhs); + /// insert_seq the contents of into this object. void insert_seq (const CosNotification::EventTypeSeq& event_type_seq); @@ -54,7 +56,14 @@ public: void remove_seq (const TAO_NS_EventTypeSeq& event_type_seq); /// Populate with the contents of this object. - void populate (CosNotification::EventTypeSeq& event_type_seq) const; + void populate (CosNotification::EventTypeSeq& event_type) const; + + /// Populate with the contents of this object. + // Excludes the special event type. This is used to avoid sending * type updates to proxys. + void populate_no_special (CosNotification::EventTypeSeq& event_type) const; + + /// Print the contents. + void dump (void) const; }; #if defined (__ACE_INLINE__) diff --git a/TAO/orbsvcs/orbsvcs/Notify/EventTypeSeq.inl b/TAO/orbsvcs/orbsvcs/Notify/EventTypeSeq.inl index 47236e2d9c4..cfa1da318d3 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/EventTypeSeq.inl +++ b/TAO/orbsvcs/orbsvcs/Notify/EventTypeSeq.inl @@ -1,4 +1 @@ // $Id$ - -#include "EventTypeSeq.h" - diff --git a/TAO/orbsvcs/orbsvcs/Notify/Event_Manager.cpp b/TAO/orbsvcs/orbsvcs/Notify/Event_Manager.cpp index bcf4743dfa8..2392dee4a63 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Event_Manager.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Event_Manager.cpp @@ -9,25 +9,13 @@ ACE_RCSID(RT_Notify, TAO_NS_Event_Manager, "$Id$") -#include "orbsvcs/ESF/ESF_Proxy_Collection.h" - -#include "EventTypeSeq.h" -#include "Event.h" -#include "Peer.h" -#include "Consumer.h" #include "ProxyConsumer.h" #include "ProxySupplier.h" - -#include "Event_Map_T.h" -#include "Dispatch_Observer_T.h" -#include "Pending_Worker_T.h" -#include "Event_Map_Observer_T.h" +#include "Consumer_Map.h" +#include "Supplier_Map.h" TAO_NS_Event_Manager::TAO_NS_Event_Manager (void) - :consumer_map_ (0), supplier_map_ (0), - consumer_map_observer_ (0), supplier_map_observer_ (0), - event_dispatch_observer_(0), updates_dispatch_observer_ (0), - event_pending_worker_ (0), updates_pending_worker_ (0) + :consumer_map_ (0), supplier_map_ (0) { } @@ -36,17 +24,11 @@ TAO_NS_Event_Manager::~TAO_NS_Event_Manager () if (TAO_debug_level > 0) { ACE_DEBUG ((LM_DEBUG, "destroying consumer/supplier map count = %d/%d, \n", - this->consumer_map_->event_type_count (), this->supplier_map_->event_type_count ())); + this->consumer_map_->proxy_count (), this->supplier_map_->proxy_count ())); } delete this->consumer_map_; delete this->supplier_map_; - delete this->consumer_map_observer_; - delete this->supplier_map_observer_; - delete this->event_dispatch_observer_; - delete this->updates_dispatch_observer_; - delete this->event_pending_worker_; - delete this->updates_pending_worker_; } void @@ -62,77 +44,87 @@ TAO_NS_Event_Manager::init (ACE_ENV_SINGLE_ARG_DECL) CORBA::NO_MEMORY ()); ACE_CHECK; - ACE_NEW_THROW_EX (this->consumer_map_observer_, - TAO_NS_Consumer_Map_Observer (), - CORBA::NO_MEMORY ()); + this->consumer_map_->init (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK; - - ACE_NEW_THROW_EX (this->supplier_map_observer_, - TAO_NS_Supplier_Map_Observer (), - CORBA::NO_MEMORY ()); + this->supplier_map_->init (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK; +} - ACE_NEW_THROW_EX (this->event_dispatch_observer_, - TAO_NS_Event_Dispatch_Observer (), - CORBA::NO_MEMORY ()); - ACE_CHECK; +void +TAO_NS_Event_Manager::shutdown (void) +{ +} - ACE_NEW_THROW_EX (this->updates_dispatch_observer_, - TAO_NS_Updates_Dispatch_Observer (), - CORBA::NO_MEMORY ()); - ACE_CHECK; +void +TAO_NS_Event_Manager::connect (TAO_NS_ProxySupplier* proxy_supplier ACE_ENV_ARG_DECL) +{ + this->consumer_map_->connect (proxy_supplier ACE_ENV_ARG_PARAMETER); - ACE_NEW_THROW_EX (this->event_pending_worker_, - TAO_NS_Event_Pending_Worker (), - CORBA::NO_MEMORY ()); - ACE_CHECK; + // Inform about offered types. + TAO_NS_EventTypeSeq removed; + proxy_supplier->types_changed (this->offered_types (), removed ACE_ENV_ARG_PARAMETER); +} - ACE_NEW_THROW_EX (this->updates_pending_worker_, - TAO_NS_Updates_Pending_Worker (), - CORBA::NO_MEMORY ()); - ACE_CHECK; +void +TAO_NS_Event_Manager::disconnect (TAO_NS_ProxySupplier* proxy_supplier ACE_ENV_ARG_DECL) +{ + this->consumer_map_->disconnect (proxy_supplier ACE_ENV_ARG_PARAMETER); +} - this->consumer_map_->init (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; +void +TAO_NS_Event_Manager::connect (TAO_NS_ProxyConsumer* proxy_consumer ACE_ENV_ARG_DECL) +{ + this->supplier_map_->connect (proxy_consumer ACE_ENV_ARG_PARAMETER); - this->supplier_map_->init (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; + // Inform about subscription types. + TAO_NS_EventTypeSeq removed; + proxy_consumer->types_changed (this->subscription_types (), removed ACE_ENV_ARG_PARAMETER); +} - this->event_dispatch_observer_->init (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; +void +TAO_NS_Event_Manager::disconnect (TAO_NS_ProxyConsumer* proxy_consumer ACE_ENV_ARG_DECL) +{ + this->supplier_map_->disconnect (proxy_consumer ACE_ENV_ARG_PARAMETER); +} - this->updates_dispatch_observer_->init (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; +void +TAO_NS_Event_Manager::offer_change (TAO_NS_ProxyConsumer* proxy_consumer, const TAO_NS_EventTypeSeq& added, const TAO_NS_EventTypeSeq& removed ACE_ENV_ARG_DECL) +{ + TAO_NS_EventTypeSeq new_added, last_removed; - this->consumer_map_observer_->init (this->supplier_map_, this->updates_dispatch_observer_ ACE_ENV_SINGLE_ARG_PARAMETER); + this->publish (proxy_consumer, added, new_added ACE_ENV_ARG_PARAMETER); ACE_CHECK; - this->supplier_map_observer_->init (this->consumer_map_, this->updates_dispatch_observer_ ACE_ENV_ARG_PARAMETER); + this->un_publish (proxy_consumer, removed, last_removed ACE_ENV_ARG_PARAMETER); ACE_CHECK; - this->consumer_map_->attach_observer (this->consumer_map_observer_); - this->supplier_map_->attach_observer (this->supplier_map_observer_); - - this->event_pending_worker_->init (this->event_dispatch_observer_, TAO_NS_PROPERTIES::instance()->update_period () ACE_ENV_ARG_PARAMETER); - ACE_CHECK; + TAO_NS_Consumer_Map::ENTRY::COLLECTION* updates_collection = this->consumer_map_->updates_collection (); - if (TAO_NS_PROPERTIES::instance()->updates () == 0) - this->updates_pending_worker_->worker_suspend (); + TAO_NS_ProxySupplier_Update_Worker worker (new_added, last_removed); - this->updates_pending_worker_->init (this->updates_dispatch_observer_, TAO_NS_PROPERTIES::instance()->update_period () ACE_ENV_ARG_PARAMETER); - ACE_CHECK; + if (updates_collection != 0) + updates_collection->for_each (&worker ACE_ENV_ARG_PARAMETER); } void -TAO_NS_Event_Manager::shutdown (void) +TAO_NS_Event_Manager::subscription_change (TAO_NS_ProxySupplier* proxy_supplier, const TAO_NS_EventTypeSeq& added, const TAO_NS_EventTypeSeq& removed ACE_ENV_ARG_DECL) { - this->event_pending_worker_->shutdown (); - this->updates_pending_worker_->shutdown (); + TAO_NS_EventTypeSeq new_added, last_removed; + + this->subscribe (proxy_supplier, added, new_added ACE_ENV_ARG_PARAMETER); + this->un_subscribe (proxy_supplier, removed, last_removed ACE_ENV_ARG_PARAMETER); + + TAO_NS_Supplier_Map::ENTRY::COLLECTION* updates_collection = this->supplier_map_->updates_collection (); + + TAO_NS_ProxyConsumer_Update_Worker worker (new_added, last_removed); + + if (updates_collection != 0) + updates_collection->for_each (&worker ACE_ENV_ARG_PARAMETER); } void -TAO_NS_Event_Manager::subscribe (TAO_NS_ProxySupplier* proxy_supplier, const TAO_NS_EventTypeSeq& seq ACE_ENV_ARG_DECL) +TAO_NS_Event_Manager::subscribe (TAO_NS_ProxySupplier* proxy_supplier, const TAO_NS_EventTypeSeq& seq, TAO_NS_EventTypeSeq& new_seq ACE_ENV_ARG_DECL) { TAO_NS_EventTypeSeq::CONST_ITERATOR iter (seq); @@ -140,13 +132,16 @@ TAO_NS_Event_Manager::subscribe (TAO_NS_ProxySupplier* proxy_supplier, const TAO for (iter.first (); iter.next (event_type) != 0; iter.advance ()) { - consumer_map_->insert (proxy_supplier, *event_type ACE_ENV_ARG_PARAMETER); + int result = consumer_map_->insert (proxy_supplier, *event_type ACE_ENV_ARG_PARAMETER); ACE_CHECK; + + if (result == 1) + new_seq.insert (*event_type); } } void -TAO_NS_Event_Manager::un_subscribe (TAO_NS_ProxySupplier* proxy_supplier, const TAO_NS_EventTypeSeq& seq ACE_ENV_ARG_DECL) +TAO_NS_Event_Manager::un_subscribe (TAO_NS_ProxySupplier* proxy_supplier, const TAO_NS_EventTypeSeq& seq, TAO_NS_EventTypeSeq& last_seq ACE_ENV_ARG_DECL) { TAO_NS_EventTypeSeq::CONST_ITERATOR iter (seq); @@ -154,13 +149,16 @@ TAO_NS_Event_Manager::un_subscribe (TAO_NS_ProxySupplier* proxy_supplier, const for (iter.first (); iter.next (event_type) != 0; iter.advance ()) { - consumer_map_->remove (proxy_supplier, *event_type ACE_ENV_ARG_PARAMETER); + int result = consumer_map_->remove (proxy_supplier, *event_type ACE_ENV_ARG_PARAMETER); ACE_CHECK; + + if (result == 1) + last_seq.insert (*event_type); } } void -TAO_NS_Event_Manager::publish (TAO_NS_ProxyConsumer* proxy_consumer, const TAO_NS_EventTypeSeq& seq ACE_ENV_ARG_DECL) +TAO_NS_Event_Manager::publish (TAO_NS_ProxyConsumer* proxy_consumer, const TAO_NS_EventTypeSeq& seq, TAO_NS_EventTypeSeq& new_seq ACE_ENV_ARG_DECL) { TAO_NS_EventTypeSeq::CONST_ITERATOR iter (seq); @@ -168,14 +166,16 @@ TAO_NS_Event_Manager::publish (TAO_NS_ProxyConsumer* proxy_consumer, const TAO_N for (iter.first (); iter.next (event_type) != 0; iter.advance ()) { - supplier_map_->insert (proxy_consumer, *event_type ACE_ENV_ARG_PARAMETER); + int result = supplier_map_->insert (proxy_consumer, *event_type ACE_ENV_ARG_PARAMETER); ACE_CHECK; - } + if (result == 1) + new_seq.insert (*event_type); + } } void -TAO_NS_Event_Manager::un_publish (TAO_NS_ProxyConsumer* proxy_consumer, const TAO_NS_EventTypeSeq& seq ACE_ENV_ARG_DECL) +TAO_NS_Event_Manager::un_publish (TAO_NS_ProxyConsumer* proxy_consumer, const TAO_NS_EventTypeSeq& seq, TAO_NS_EventTypeSeq& last_seq ACE_ENV_ARG_DECL) { TAO_NS_EventTypeSeq::CONST_ITERATOR iter (seq); @@ -183,25 +183,146 @@ TAO_NS_Event_Manager::un_publish (TAO_NS_ProxyConsumer* proxy_consumer, const TA for (iter.first (); iter.next (event_type) != 0; iter.advance ()) { - supplier_map_->remove (proxy_consumer, *event_type ACE_ENV_ARG_PARAMETER); + int result = supplier_map_->remove (proxy_consumer, *event_type ACE_ENV_ARG_PARAMETER); ACE_CHECK; + + if (result == 1) + last_seq.insert (*event_type); } } #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class TAO_NS_Event_Map_T; -template class TAO_NS_Event_Map_T; +template class TAO_NS_Event_Map_T; +template class TAO_NS_Event_Map_T; -template class TAO_NS_Event_Map_Entry_T; -template class TAO_NS_Event_Map_Entry_T; +template class ACE_Hash; +template class ACE_Equal_To; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) +template class TAO_NS_Event_Map_Entry_T; +template class TAO_NS_Event_Map_Entry_T; + +template class ACE_Hash_Map_Manager_Ex *, ACE_Hash, ACE_Equal_To, ACE_Null_Mutex>; +template class ACE_Hash_Map_Manager_Ex *, ACE_Hash, ACE_Equal_To, ACE_Null_Mutex>; +template class ACE_Hash_Map_Manager *, ACE_Null_Mutex>; +template class ACE_Hash_Map_Manager *, ACE_Null_Mutex>; +template class ACE_Hash_Map_Manager; + +template class ACE_Unbounded_Set; +template class ACE_Unbounded_Set_Const_Iterator; +template class ACE_Unbounded_Queue >; +template class ACE_Unbounded_Set_Iterator; + +template class TAO_ESF_Worker; +template class TAO_ESF_Worker; +template class TAO_ESF_Worker; +template class TAO_ESF_Worker; +template class TAO_ESF_Worker; +template class TAO_ESF_Worker; +template class TAO_ESF_Worker; + +template class ACE_Refcounted_Auto_Ptr; +template class ACE_Unbounded_Queue_Iterator >; + +template class ACE_Node >; +template class ACE_Node; +template class ACE_Node; +template class ACE_Node; +template class ACE_Node; +template class ACE_Node; +template class ACE_Node; +template class ACE_Node; +template class ACE_Node; +template class ACE_Node; -#pragma instantiate TAO_NS_Event_Map_T -#pragma instantiate TAO_NS_Event_Map_T +template class ACE_Hash_Map_Entry *>; +template class ACE_Hash_Map_Entry; +template class ACE_Hash_Map_Entry *>; + +template class ACE_Hash_Map_Iterator_Base_Ex *, ACE_Hash, ACE_Equal_To, ACE_Null_Mutex>; +template class ACE_Hash_Map_Iterator_Base_Ex *, ACE_Hash, ACE_Equal_To, ACE_Null_Mutex>; + +template class ACE_Hash_Map_Iterator_Ex *, ACE_Hash, ACE_Equal_To, ACE_Null_Mutex>; +template class ACE_Hash_Map_Iterator_Ex *, ACE_Hash, ACE_Equal_To, ACE_Null_Mutex>; + +template class ACE_Hash_Map_Reverse_Iterator_Ex *, ACE_Hash, ACE_Equal_To, ACE_Null_Mutex>; +template class ACE_Hash_Map_Reverse_Iterator_Ex *, ACE_Hash, ACE_Equal_To, ACE_Null_Mutex>; + +template class ACE_Hash_Map_Manager_Ex, ACE_Equal_To, ACE_Null_Mutex>; + +template class ACE_Hash_Map_Iterator_Ex, ACE_Equal_To, ACE_Null_Mutex>; +template class ACE_Hash_Map_Iterator_Base_Ex, ACE_Equal_To, ACE_Null_Mutex>; +template class ACE_Hash_Map_Reverse_Iterator_Ex, ACE_Equal_To, ACE_Null_Mutex>; + +template class TAO_ESF_Shutdown_Proxy; +template class TAO_ESF_Shutdown_Proxy; +template class TAO_ESF_Shutdown_Proxy; + +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate TAO_NS_Event_Map_Entry_T -#pragma instantiate TAO_NS_Event_Map_Entry_T +#pragma instantiate TAO_NS_Event_Map_T +#pragma instantiate TAO_NS_Event_Map_T + +#pragma instantiate ACE_Hash +#pragma instantiate ACE_Equal_To + +#pragma instantiate TAO_NS_Event_Map_Entry_T +#pragma instantiate TAO_NS_Event_Map_Entry_T + +#pragma instantiate ACE_Hash_Map_Manager_Ex *, ACE_Hash, ACE_Equal_To, ACE_Null_Mutex> +#pragma instantiate ACE_Hash_Map_Manager_Ex *, ACE_Hash, ACE_Equal_To, ACE_Null_Mutex> +#pragma instantiate ACE_Hash_Map_Manager *, ACE_Null_Mutex> +#pragma instantiate ACE_Hash_Map_Manager *, ACE_Null_Mutex> +#pragma instantiate ACE_Hash_Map_Manager + +#pragma instantiate ACE_Unbounded_Set +#pragma instantiate ACE_Unbounded_Set_Const_Iterator +#pragma instantiate ACE_Unbounded_Queue > +#pragma instantiate ACE_Unbounded_Set_Iterator + +#pragma instantiate TAO_ESF_Worker +#pragma instantiate TAO_ESF_Worker +#pragma instantiate TAO_ESF_Worker +#pragma instantiate TAO_ESF_Worker +#pragma instantiate TAO_ESF_Worker +#pragma instantiate TAO_ESF_Worker +#pragma instantiate TAO_ESF_Worker + +#pragma instantiate ACE_Refcounted_Auto_Ptr +#pragma instantiate ACE_Unbounded_Queue_Iterator > + +#pragma instantiate ACE_Node > +#pragma instantiate ACE_Node +#pragma instantiate ACE_Node +#pragma instantiate ACE_Node +#pragma instantiate ACE_Node +#pragma instantiate ACE_Node +#pragma instantiate ACE_Node +#pragma instantiate ACE_Node +#pragma instantiate ACE_Node +#pragma instantiate ACE_Node + +#pragma instantiate ACE_Hash_Map_Entry *> +#pragma instantiate ACE_Hash_Map_Entry +#pragma instantiate ACE_Hash_Map_Entry *> + +#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex *, ACE_Hash, ACE_Equal_To, ACE_Null_Mutex> +#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex *, ACE_Hash, ACE_Equal_To, ACE_Null_Mutex> + +#pragma instantiate ACE_Hash_Map_Iterator_Ex *, ACE_Hash, ACE_Equal_To, ACE_Null_Mutex> +#pragma instantiate ACE_Hash_Map_Iterator_Ex *, ACE_Hash, ACE_Equal_To, ACE_Null_Mutex> + +#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex *, ACE_Hash, ACE_Equal_To, ACE_Null_Mutex> +#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex *, ACE_Hash, ACE_Equal_To, ACE_Null_Mutex> + +#pragma instantiate ACE_Hash_Map_Manager_Ex, ACE_Equal_To, ACE_Null_Mutex> + +#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex, ACE_Equal_To, ACE_Null_Mutex> +#pragma instantiate ACE_Hash_Map_Iterator_Ex, ACE_Equal_To, ACE_Null_Mutex> +#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex, ACE_Equal_To, ACE_Null_Mutex> + +#pragma instantiate TAO_ESF_Shutdown_Proxy +#pragma instantiate TAO_ESF_Shutdown_Proxy +#pragma instantiate TAO_ESF_Shutdown_Proxy #endif /*ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Event_Manager.h b/TAO/orbsvcs/orbsvcs/Notify/Event_Manager.h index eddef6ed5b6..efc8b257831 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Event_Manager.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Event_Manager.h @@ -19,8 +19,15 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#include "Types.h" +#include "orbsvcs/ESF/ESF_Worker.h" +class TAO_NS_ProxySupplier; +class TAO_NS_ProxyConsumer; +class TAO_NS_EventTypeSeq; + +template class TAO_NS_Event_Map_T; +typedef TAO_NS_Event_Map_T TAO_NS_Consumer_Map; +typedef TAO_NS_Event_Map_T TAO_NS_Supplier_Map; /** * @class TAO_NS_Event_Manager @@ -43,54 +50,98 @@ public: /// Init void shutdown (void); - /// Subscribe to the event type sequence list . - void subscribe (TAO_NS_ProxySupplier* proxy_supplier, const TAO_NS_EventTypeSeq& seq ACE_ENV_ARG_DECL); + /// Connect ProxySupplier + void connect (TAO_NS_ProxySupplier* proxy_supplier ACE_ENV_ARG_DECL); - /// Unsubscribe to the event type sequence list . - void un_subscribe (TAO_NS_ProxySupplier* proxy_supplier, const TAO_NS_EventTypeSeq& seq ACE_ENV_ARG_DECL); + /// Disconnect ProxySupplier + void disconnect (TAO_NS_ProxySupplier* proxy_supplier ACE_ENV_ARG_DECL); - /// Subscribe to the event type sequence list . - void publish (TAO_NS_ProxyConsumer* proxy_consumer, const TAO_NS_EventTypeSeq& seq ACE_ENV_ARG_DECL); + /// Connect ProxyConsumer + void connect (TAO_NS_ProxyConsumer* proxy_consumer ACE_ENV_ARG_DECL); - /// Subscribe to the event type sequence list . - void un_publish (TAO_NS_ProxyConsumer* proxy_consumer, const TAO_NS_EventTypeSeq& seq ACE_ENV_ARG_DECL); + /// Disconnect ProxyConsumer + void disconnect (TAO_NS_ProxyConsumer* proxy_consumer ACE_ENV_ARG_DECL); /// Map accessors. TAO_NS_Consumer_Map* consumer_map (void); TAO_NS_Supplier_Map* supplier_map (void); - /// Event Dispatch Observer - TAO_NS_Event_Dispatch_Observer* event_dispatch_observer (void); + /// Offer change received on . + void offer_change (TAO_NS_ProxyConsumer* proxy_consumer, const TAO_NS_EventTypeSeq& added, const TAO_NS_EventTypeSeq& removed ACE_ENV_ARG_DECL); - /// Update dispatch observer. - TAO_NS_Updates_Dispatch_Observer* updates_dispatch_observer (void); + /// Subscription change received on . + void subscription_change (TAO_NS_ProxySupplier* proxy_supplier, const TAO_NS_EventTypeSeq& added, const TAO_NS_EventTypeSeq& removed ACE_ENV_ARG_DECL); + + /// What are the types being offered. + const TAO_NS_EventTypeSeq& offered_types (void); + + /// What are the types being subscribed. + const TAO_NS_EventTypeSeq& subscription_types (void); protected: + /// Subscribe to the event type sequence list . + void subscribe (TAO_NS_ProxySupplier* proxy_supplier, const TAO_NS_EventTypeSeq& seq, TAO_NS_EventTypeSeq& new_seq ACE_ENV_ARG_DECL); + + /// Unsubscribe to the event type sequence list . + void un_subscribe (TAO_NS_ProxySupplier* proxy_supplier, const TAO_NS_EventTypeSeq& seq, TAO_NS_EventTypeSeq& last_seq ACE_ENV_ARG_DECL); + + /// Subscribe to the event type sequence list . + void publish (TAO_NS_ProxyConsumer* proxy_consumer, const TAO_NS_EventTypeSeq& seq, TAO_NS_EventTypeSeq& new_seq ACE_ENV_ARG_DECL); + + /// Subscribe to the event type sequence list . + void un_publish (TAO_NS_ProxyConsumer* proxy_consumer, const TAO_NS_EventTypeSeq& seq, TAO_NS_EventTypeSeq& last_seq ACE_ENV_ARG_DECL); + /// Consumer Map TAO_NS_Consumer_Map* consumer_map_; /// Supplier Map TAO_NS_Supplier_Map* supplier_map_; +}; + +/********************************************************************************/ - /// Consumer Map Observer - TAO_NS_Consumer_Map_Observer* consumer_map_observer_; +/** + * @class TAO_NS_ProxyConsumer_Update_Worker + * + * @brief Inform ProxyConsumer of updates. + * + */ +class TAO_Notify_Export TAO_NS_ProxyConsumer_Update_Worker : public TAO_ESF_Worker +{ +public: + TAO_NS_ProxyConsumer_Update_Worker (const TAO_NS_EventTypeSeq& added, const TAO_NS_EventTypeSeq& removed); - /// Supplier Map Observer - TAO_NS_Supplier_Map_Observer* supplier_map_observer_; +protected: + ///= TAO_ESF_Worker method + void work (TAO_NS_ProxyConsumer* proxy ACE_ENV_ARG_DECL); - /// Event Dispatch Observer. - TAO_NS_Event_Dispatch_Observer* event_dispatch_observer_; + const TAO_NS_EventTypeSeq& added_; + const TAO_NS_EventTypeSeq& removed_; +}; - /// Update dispatch observer. - TAO_NS_Updates_Dispatch_Observer* updates_dispatch_observer_; +/********************************************************************************/ - /// Worker task that dispatches pending events. - TAO_NS_Event_Pending_Worker* event_pending_worker_; +/** + * @class TAO_NS_ProxySupplier_Update_Worker + * + * @brief Inform ProxySupplier of updates. + * + */ +class TAO_Notify_Export TAO_NS_ProxySupplier_Update_Worker : public TAO_ESF_Worker +{ +public: + TAO_NS_ProxySupplier_Update_Worker (const TAO_NS_EventTypeSeq& added, const TAO_NS_EventTypeSeq& removed); + +protected: + ///= TAO_ESF_Worker method + void work (TAO_NS_ProxySupplier* proxy ACE_ENV_ARG_DECL); - /// Worker task that dispatches pending update messges. - TAO_NS_Updates_Pending_Worker* updates_pending_worker_; + const TAO_NS_EventTypeSeq& added_; + const TAO_NS_EventTypeSeq& removed_; }; +/********************************************************************************/ + #if defined (__ACE_INLINE__) #include "Event_Manager.inl" #endif /* __ACE_INLINE__ */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Event_Manager.inl b/TAO/orbsvcs/orbsvcs/Notify/Event_Manager.inl index 590886dd9e4..3ad395f331a 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Event_Manager.inl +++ b/TAO/orbsvcs/orbsvcs/Notify/Event_Manager.inl @@ -1,29 +1,57 @@ // $Id$ -#include "Event_Manager.h" +#include "ProxyConsumer.h" +#include "ProxySupplier.h" #include "Event_Map_T.h" ACE_INLINE TAO_NS_Consumer_Map* TAO_NS_Event_Manager::consumer_map (void) { - return consumer_map_; + return this->consumer_map_; } ACE_INLINE TAO_NS_Supplier_Map* TAO_NS_Event_Manager::supplier_map (void) { - return supplier_map_; + return this->supplier_map_; } -ACE_INLINE TAO_NS_Event_Dispatch_Observer* -TAO_NS_Event_Manager::event_dispatch_observer (void) +ACE_INLINE const TAO_NS_EventTypeSeq& +TAO_NS_Event_Manager::offered_types (void) { - return this->event_dispatch_observer_; + return this->supplier_map_->event_types (); } -ACE_INLINE TAO_NS_Updates_Dispatch_Observer* -TAO_NS_Event_Manager::updates_dispatch_observer (void) +ACE_INLINE const TAO_NS_EventTypeSeq& +TAO_NS_Event_Manager::subscription_types (void) { - return this->updates_dispatch_observer_; + return this->consumer_map_->event_types (); } +/********************************************************************************/ + +ACE_INLINE TAO_NS_ProxyConsumer_Update_Worker::TAO_NS_ProxyConsumer_Update_Worker (const TAO_NS_EventTypeSeq& added, const TAO_NS_EventTypeSeq& removed) + :added_ (added), removed_ (removed) +{ +} + +ACE_INLINE void +TAO_NS_ProxyConsumer_Update_Worker::work (TAO_NS_ProxyConsumer* proxy ACE_ENV_ARG_DECL) +{ + proxy->types_changed (added_, removed_ ACE_ENV_ARG_PARAMETER); +} + +/********************************************************************************/ + +ACE_INLINE TAO_NS_ProxySupplier_Update_Worker::TAO_NS_ProxySupplier_Update_Worker (const TAO_NS_EventTypeSeq& added, const TAO_NS_EventTypeSeq& removed) + :added_ (added), removed_ (removed) +{ +} + +ACE_INLINE void +TAO_NS_ProxySupplier_Update_Worker::work (TAO_NS_ProxySupplier* proxy ACE_ENV_ARG_DECL) +{ + proxy->types_changed (added_, removed_ ACE_ENV_ARG_PARAMETER); +} + +/********************************************************************************/ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Event_Map_Entry_T.cpp b/TAO/orbsvcs/orbsvcs/Notify/Event_Map_Entry_T.cpp index 5b886cbfa25..53573dafa90 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Event_Map_Entry_T.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Event_Map_Entry_T.cpp @@ -1,5 +1,8 @@ // $Id$ +#ifndef TAO_NS_EVENT_MAP_ENTRY_CPP +#define TAO_NS_EVENT_MAP_ENTRY_CPP + #include "Event_Map_Entry_T.h" #if ! defined (__ACE_INLINE__) @@ -14,7 +17,7 @@ ACE_RCSID(Notify, TAO_NS_Event_Map_Entry_T, "$id$") template TAO_NS_Event_Map_Entry_T::TAO_NS_Event_Map_Entry_T (void) - : collection_ (0), count_ (0) + : collection_ (0), count_ (0), usage_count_ (1) { } @@ -45,3 +48,5 @@ TAO_NS_Event_Map_Entry_T::disconnected (PROXY* proxy ACE_ENV_ARG_DECL) this->collection_->disconnected (proxy ACE_ENV_ARG_PARAMETER); --count_; } + +#endif /* TAO_NS_EVENT_MAP_ENTRY_CPP */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Event_Map_Entry_T.h b/TAO/orbsvcs/orbsvcs/Notify/Event_Map_Entry_T.h index a5017db05b2..caca41aecf3 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Event_Map_Entry_T.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Event_Map_Entry_T.h @@ -20,9 +20,11 @@ #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/Copy_Disabled.h" -#include "types.h" +#include "ace/Atomic_Op.h" +#include "tao/corba.h" template class TAO_NS_Event_Map_T; +template class TAO_ESF_Proxy_Collection; /** * @class TAO_NS_Event_Map_Entry_T @@ -57,12 +59,22 @@ public: /// Count accessor int count (void); + ///= Reference counting methods. + // Incr the ref count. + CORBA::ULong _incr_refcnt (void); + + // Decr the ref count. This object is destroyed when the count is 0. + CORBA::ULong _decr_refcnt (void); + protected: /// The Collection COLLECTION* collection_; /// Count of PROXY's connected in the collection; int count_; + + /// Count of users accessing this entry. + ACE_Atomic_Op usage_count_; }; #if defined (__ACE_INLINE__) diff --git a/TAO/orbsvcs/orbsvcs/Notify/Event_Map_Entry_T.inl b/TAO/orbsvcs/orbsvcs/Notify/Event_Map_Entry_T.inl index 5877d0c4799..b0dfa7c4676 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Event_Map_Entry_T.inl +++ b/TAO/orbsvcs/orbsvcs/Notify/Event_Map_Entry_T.inl @@ -1,10 +1,8 @@ // $Id$ -#include "Event_Map_Entry_T.h" - -template ACE_INLINE TAO_NS_Event_Map_Entry_T::COLLECTION* -TAO_NS_Event_Map_Entry_T::collection (void) -{ +template ACE_INLINE ACE_TYPENAME +TAO_NS_Event_Map_Entry_T::COLLECTION* +TAO_NS_Event_Map_Entry_T::collection (void) { return collection_; } @@ -13,3 +11,15 @@ TAO_NS_Event_Map_Entry_T::count (void) { return this->count_; } + +template ACE_INLINE CORBA::ULong +TAO_NS_Event_Map_Entry_T::_incr_refcnt (void) +{ + return ++this->usage_count_; +} + +template ACE_INLINE CORBA::ULong +TAO_NS_Event_Map_Entry_T::_decr_refcnt (void) +{ + return --this->usage_count_; +} diff --git a/TAO/orbsvcs/orbsvcs/Notify/Event_Map_T.cpp b/TAO/orbsvcs/orbsvcs/Notify/Event_Map_T.cpp index c48383c378e..fc2ba2f0c71 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Event_Map_T.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Event_Map_T.cpp @@ -8,7 +8,6 @@ #include "Event_Map_Entry_T.h" #include "Properties.h" #include "Factory.h" -#include "Event_Map_Observer.h" #if ! defined (__ACE_INLINE__) #include "Event_Map_T.inl" @@ -18,7 +17,7 @@ ACE_RCSID(RT_Notify, TAO_NS_Event_Map_T, "$Id$") template TAO_NS_Event_Map_T::TAO_NS_Event_Map_T (void) - :event_type_count_ (0), broadcast_collection_ (0), observer_ (0) + :proxy_count_ (0) { } @@ -31,56 +30,53 @@ TAO_NS_Event_Map_T::~TAO_NS_Event_Map_T () template void TAO_NS_Event_Map_T::init (ACE_ENV_SINGLE_ARG_DECL) { - broadcast_collection_ = this->create_entry (TAO_NS_EventType::special () ACE_ENV_ARG_PARAMETER); + this->broadcast_entry_.init (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK; + + this->updates_entry_.init (ACE_ENV_SINGLE_ARG_PARAMETER); } -template TAO_NS_Event_Map_T::COLLECTION* -TAO_NS_Event_Map_T::create_entry (const TAO_NS_EventType& event_type ACE_ENV_ARG_DECL) +template void +TAO_NS_Event_Map_T::connect (PROXY* proxy ACE_ENV_ARG_DECL) { - TAO_NS_Event_Map_Entry_T* entry; - - int result = -1; - - { - ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, 0); - - result = this->map_.find (event_type, entry); - } - - if (result == -1) - { - ACE_NEW_THROW_EX (entry, - ENTRY (), - CORBA::NO_MEMORY ()); - ACE_CHECK_RETURN (0); - - entry->init (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (0); + this->updates_entry_.connected (proxy ACE_ENV_ARG_PARAMETER); + ACE_CHECK; - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, 0); + ACE_WRITE_GUARD (ACE_LOCK, ace_mon, this->lock_); + ++this->proxy_count_; +} - if (map_.bind (event_type, entry) == -1) - ACE_THROW_RETURN (CORBA::NO_MEMORY (), 0); - } +template void +TAO_NS_Event_Map_T::disconnect (PROXY* proxy ACE_ENV_ARG_DECL) +{ + this->updates_entry_.disconnected (proxy ACE_ENV_ARG_PARAMETER); + ACE_CHECK; - return entry->collection (); + ACE_WRITE_GUARD (ACE_LOCK, ace_mon, this->lock_); + --this->proxy_count_; } template int TAO_NS_Event_Map_T::insert (PROXY* proxy, const TAO_NS_EventType& event_type ACE_ENV_ARG_DECL) { - TAO_NS_Event_Map_Entry_T* entry; + ENTRY* entry; int result = -1; - { - ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); + if (event_type.is_special () == 1) + { + entry = &this->broadcast_entry_; - result = this->map_.find (event_type, entry); - } + result = 0; + } + else + { + ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); + + result = this->map_.find (event_type, entry); + } - if (result == -1) + if (result == -1) // This type is being seen for the first time. { ACE_NEW_THROW_EX (entry, ENTRY (), @@ -98,54 +94,71 @@ TAO_NS_Event_Map_T::insert (PROXY* proxy, const TAO_NS_EventTyp if (map_.bind (event_type, entry) == -1) ACE_THROW_RETURN (CORBA::NO_MEMORY (), -1); - if (this->observer_ != 0) - this->observer_->type_added (event_type); + if (this->event_types_.insert (event_type) == -1) + return -1; - return ++event_type_count_; + return 1; } - else + else // Add to existing entry or the broadcast entry. { entry->connected (proxy ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (-1); - - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - return ++event_type_count_; } + + return 0; } template int TAO_NS_Event_Map_T::remove (PROXY* proxy, const TAO_NS_EventType& event_type ACE_ENV_ARG_DECL) { - TAO_NS_Event_Map_Entry_T* entry; - - int result = -1; - { - ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - - result = this->map_.find (event_type, entry); - } + ENTRY* entry; - if (result == 0) + if (event_type.is_special () == 1) { + entry = &this->broadcast_entry_; + entry->disconnected (proxy ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (-1); + } + else + { + int result = -1; + + { + ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - return --event_type_count_; + result = this->map_.find (event_type, entry); + } - if (entry->count () == 0) + if (result == 0) { - if (this->observer_ != 0) - this->observer_->type_removed (event_type); + entry->disconnected (proxy ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + if (entry->count () == 0) + { + /// Exec a strategy for removing entries. + /// Strategy 1: remove_immediately + /// Strategy 2: remove a bunch_after crossing a threshold + /// Strategy 3: use cached allocator and 1 + + // Strategy 1: + ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); + + this->map_.unbind (event_type); + + if (entry->_decr_refcnt () == 0) + delete entry; + + if (this->event_types_.remove (event_type) == -1) + return -1; - /// @@TODO: Exec a strategy for removing entries. - /// Strategy 1: remove_immediately - /// Strategy 2: remove_bunch_after_threshold - /// Strategy 3: use cached allocator + return 1; + } } } - return -1; + return 0; } #endif /* TAO_NS_EVENT_MAP_T_C */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Event_Map_T.h b/TAO/orbsvcs/orbsvcs/Notify/Event_Map_T.h index 22eccd88c42..b7219b3f509 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Event_Map_T.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Event_Map_T.h @@ -20,11 +20,11 @@ #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/Hash_Map_Manager.h" -#include "Types.h" +#include "ace/CORBA_macros.h" + #include "EventType.h" #include "Event_Map_Entry_T.h" - -class TAO_NS_Event_Map_Observer; +#include "EventTypeSeq.h" /** * @class TAO_NS_Event_Map_T @@ -35,10 +35,10 @@ class TAO_NS_Event_Map_Observer; template class TAO_NS_Event_Map_T { - typedef TAO_NS_Event_Map_Entry_T ENTRY; public: - typedef TAO_ESF_Proxy_Collection COLLECTION; + typedef TAO_NS_Event_Map_Entry_T ENTRY; + /// Constuctor TAO_NS_Event_Map_T (void); @@ -48,26 +48,40 @@ public: /// Init void init (ACE_ENV_SINGLE_ARG_DECL); - /// Attach an Observer. - void attach_observer (TAO_NS_Event_Map_Observer* observer); + /// Connect a PROXY + void connect (PROXY* proxy ACE_ENV_ARG_DECL); - /// An entry can be precreated for an event_type. else it is created when required (during insert). - COLLECTION* create_entry (const TAO_NS_EventType& event_type ACE_ENV_ARG_DECL); + /// Disconnect a PROXY + void disconnect (PROXY* proxy ACE_ENV_ARG_DECL); - /// Associate PROXY and event_type. returns count of PROXYs. + /// Associate PROXY and event_type. + /// Returns 1 if is being seem for the 1st time otherwise returns 0. + /// Returns -1 on error. int insert (PROXY* proxy, const TAO_NS_EventType& event_type ACE_ENV_ARG_DECL); - /// Remove association of PROXY and event_type. returns count of PROXYs. + /// Remove association of PROXY and event_type. + /// Returns 1 if is being seem for the last time otherwise returns 0. + /// Returns -1 on error. int remove (PROXY* proxy, const TAO_NS_EventType& event_type ACE_ENV_ARG_DECL); /// Find the collection mapped to the - COLLECTION* find (const TAO_NS_EventType& event_type ACE_ENV_ARG_DECL); + /// The usage_count on the entry returned is incremented. + ENTRY* find (const TAO_NS_EventType& event_type ACE_ENV_ARG_DECL); /// Find the default broadcast list. - COLLECTION* broadcast_collection (void); + ACE_TYPENAME ENTRY::COLLECTION* broadcast_collection (void); + + /// Find the update list. This is all the PROXYS connected to this Map. + ACE_TYPENAME ENTRY::COLLECTION* updates_collection (void); - /// Access count, number of different event types in the map. - int event_type_count (void); + /// Release the usage count on this entry. + void release (ENTRY* entry); + + /// Access all the event types available + const TAO_NS_EventTypeSeq& event_types (void); + + /// Access number of proxys connected in all. + int proxy_count (void); protected: /// The Map that stores eventtype to entry mapping. @@ -76,14 +90,17 @@ protected: /// The lock to use. ACE_LOCK lock_; - /// Count of items entered in the map. - int event_type_count_; + /// Count of proxys connected. + int proxy_count_; /// The default broadcast list for EventType::special. - COLLECTION* broadcast_collection_; + ENTRY broadcast_entry_; + + /// Update Entry - Keeps a list of all PROXY's connected to this Map. Updates are send to this list. + ENTRY updates_entry_; - /// Observer attached to us. - TAO_NS_Event_Map_Observer* observer_; + /// The event types that are available in this map. + TAO_NS_EventTypeSeq event_types_; }; #if defined (__ACE_INLINE__) diff --git a/TAO/orbsvcs/orbsvcs/Notify/Event_Map_T.inl b/TAO/orbsvcs/orbsvcs/Notify/Event_Map_T.inl index c6c4f204b08..fb81c86a0b0 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Event_Map_T.inl +++ b/TAO/orbsvcs/orbsvcs/Notify/Event_Map_T.inl @@ -1,34 +1,50 @@ // $Id$ -#include "Event_Map_T.h" - -template ACE_INLINE TAO_NS_Event_Map_T::COLLECTION* -TAO_NS_Event_Map_T::find (const TAO_NS_EventType& event_type ACE_ENV_ARG_DECL) +template ACE_INLINE TAO_NS_Event_Map_Entry_T* +TAO_NS_Event_Map_T::find (const TAO_NS_EventType& event_type ACE_ENV_ARG_DECL_NOT_USED) { TAO_NS_Event_Map_Entry_T* entry; ACE_READ_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, 0); if (map_.find (event_type, entry) == 0) - return entry->collection (); + { + entry->_incr_refcnt (); + return entry; + } else return 0; } -template ACE_INLINE TAO_NS_Event_Map_T::COLLECTION* +template ACE_INLINE void +TAO_NS_Event_Map_T::release (ENTRY* entry) +{ + ACE_WRITE_GUARD (ACE_LOCK, ace_mon, this->lock_); + + if (entry->_decr_refcnt () == 0) + delete entry; +} + +template ACE_INLINE ACE_TYPENAME TAO_NS_Event_Map_Entry_T::COLLECTION* TAO_NS_Event_Map_T::broadcast_collection (void) { - return this->broadcast_collection_; + return this->broadcast_entry_.collection (); } -template ACE_INLINE void -TAO_NS_Event_Map_T::attach_observer (TAO_NS_Event_Map_Observer* observer) +template ACE_INLINE ACE_TYPENAME TAO_NS_Event_Map_Entry_T::COLLECTION* +TAO_NS_Event_Map_T::updates_collection (void) { - this->observer_ = observer; + return this->updates_entry_.collection (); } template ACE_INLINE int -TAO_NS_Event_Map_T::event_type_count (void) +TAO_NS_Event_Map_T::proxy_count (void) +{ + return this->proxy_count_; +} + +template ACE_INLINE const TAO_NS_EventTypeSeq& +TAO_NS_Event_Map_T::event_types (void) { - return this->event_type_count_; + return this->event_types_; } diff --git a/TAO/orbsvcs/orbsvcs/Notify/Factory.h b/TAO/orbsvcs/orbsvcs/Notify/Factory.h index a3c7dd6ec47..4f84b9aaffe 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Factory.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Factory.h @@ -13,25 +13,46 @@ #define TAO_NS_FACTORY_H #include "ace/pre.h" -#include "notify_export.h" - #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "tao/corba.h" #include "ace/CORBA_macros.h" - -#include "Types.h" +#include "ace/Service_Object.h" class ACE_Lock; class TAO_NS_Object; class TAO_NS_EventChannelFactory; class TAO_NS_EventChannel; class TAO_NS_SupplierAdmin; -class TAO_NS_StructuredProxyPushConsumer; class TAO_NS_ConsumerAdmin; +class TAO_NS_ProxyPushConsumer; +class TAO_NS_CosEC_ProxyPushSupplier; +class TAO_NS_CosEC_ProxyPushConsumer; +class TAO_NS_ProxyPushSupplier; +class TAO_NS_StructuredProxyPushConsumer; class TAO_NS_StructuredProxyPushSupplier; -class TAO_NS_QoSAdmin; +class TAO_NS_SequenceProxyPushConsumer; +class TAO_NS_SequenceProxyPushSupplier; +class TAO_NS_ProxyConsumer; +class TAO_NS_ProxySupplier; +class TAO_NS_ConsumerAdmin; +class TAO_NS_SupplierAdmin; +class TAO_NS_Proxy; +class TAO_NS_Consumer; +class TAO_NS_Supplier; +class TAO_NS_Peer; + +template class TAO_ESF_Proxy_Collection; + +typedef TAO_ESF_Proxy_Collection TAO_NS_ProxyConsumer_Collection; +typedef TAO_ESF_Proxy_Collection TAO_NS_ProxySupplier_Collection; + +typedef TAO_ESF_Proxy_Collection TAO_NS_EventChannel_Collection; +typedef TAO_ESF_Proxy_Collection TAO_NS_ConsumerAdmin_Collection; +typedef TAO_ESF_Proxy_Collection TAO_NS_SupplierAdmin_Collection; +typedef TAO_ESF_Proxy_Collection TAO_NS_Proxy_Collection; /** * @class TAO_NS_Factory @@ -39,49 +60,62 @@ class TAO_NS_QoSAdmin; * @brief Factory interface for creating Notify Objects. * */ -class TAO_Notify_Export TAO_NS_Factory +class /*TAO_Notify_Export*/ TAO_NS_Factory : public ACE_Service_Object { public: - /// Constuctor - TAO_NS_Factory (void); - - /// Destructor - virtual ~TAO_NS_Factory (); + /// Create ProxySupplier Collection + virtual void create (TAO_NS_ProxySupplier_Collection*& collection ACE_ENV_ARG_DECL) = 0; - /// Create Object Lock. - virtual ACE_Lock* create_object_lock (ACE_ENV_SINGLE_ARG_DECL); + /// Create ProxyConsumer Collection + virtual void create (TAO_NS_ProxyConsumer_Collection*& collection ACE_ENV_ARG_DECL) = 0; - /// Create QoSAdmin - virtual void create (TAO_NS_QoSAdmin*& qos_admin ACE_ENV_SINGLE_ARG_DECL); + /// Create EventChannel Collection + virtual void create (TAO_NS_EventChannel_Collection*& collection ACE_ENV_ARG_DECL) = 0; - /// Create Collection - virtual void create (TAO_NS_ProxySupplier_Collection*& collection ACE_ENV_SINGLE_ARG_DECL); - virtual void create (TAO_NS_ProxyConsumer_Collection*& collection ACE_ENV_SINGLE_ARG_DECL); + /// Create ConsumerAdmin Collection + virtual void create (TAO_NS_ConsumerAdmin_Collection*& collection ACE_ENV_ARG_DECL) = 0; - virtual void create (TAO_NS_EventChannel_Collection*& collection ACE_ENV_SINGLE_ARG_DECL); - virtual void create (TAO_NS_Admin_Collection*& collection ACE_ENV_SINGLE_ARG_DECL); - virtual void create (TAO_NS_Proxy_Collection*& collection ACE_ENV_SINGLE_ARG_DECL); + /// Create SupplierAdmin Collection + virtual void create (TAO_NS_SupplierAdmin_Collection*& collection ACE_ENV_ARG_DECL) = 0; - virtual void create (TAO_NS_Peer_Collection*& collection ACE_ENV_SINGLE_ARG_DECL); - virtual void create (TAO_NS_Consumer_Collection*& collection ACE_ENV_SINGLE_ARG_DECL); + /// Create Proxy Collection + virtual void create (TAO_NS_Proxy_Collection*& collection ACE_ENV_ARG_DECL) = 0; /// Create EventChannelFactory - virtual void create (TAO_NS_EventChannelFactory*& channel_factory ACE_ENV_SINGLE_ARG_DECL); + virtual void create (TAO_NS_EventChannelFactory*& channel_factory ACE_ENV_ARG_DECL) = 0; /// Create EventChannel - virtual void create (TAO_NS_EventChannel*& channel ACE_ENV_SINGLE_ARG_DECL); + virtual void create (TAO_NS_EventChannel*& channel ACE_ENV_ARG_DECL) = 0; /// Create SupplierAdmin - virtual void create (TAO_NS_SupplierAdmin*& admin ACE_ENV_SINGLE_ARG_DECL); + virtual void create (TAO_NS_SupplierAdmin*& admin ACE_ENV_ARG_DECL) = 0; /// Create ConsumerAdmin - virtual void create (TAO_NS_ConsumerAdmin*& admin ACE_ENV_SINGLE_ARG_DECL); + virtual void create (TAO_NS_ConsumerAdmin*& admin ACE_ENV_ARG_DECL) = 0; + + /// Create ProxyPushConsumer + virtual void create (TAO_NS_ProxyPushConsumer*& proxy ACE_ENV_ARG_DECL) = 0; + + /// Create ProxyPushSupplier + virtual void create (TAO_NS_ProxyPushSupplier*& proxy ACE_ENV_ARG_DECL) = 0; + + /// Create CosEC_ProxyPushConsumer + virtual void create (TAO_NS_CosEC_ProxyPushConsumer*& proxy ACE_ENV_ARG_DECL) = 0; + + /// Create CosEC_ProxyPushSupplier + virtual void create (TAO_NS_CosEC_ProxyPushSupplier*& proxy ACE_ENV_ARG_DECL) = 0; /// Create StructuredProxyPushConsumer - virtual void create (TAO_NS_StructuredProxyPushConsumer*& proxy ACE_ENV_SINGLE_ARG_DECL); + virtual void create (TAO_NS_StructuredProxyPushConsumer*& proxy ACE_ENV_ARG_DECL) = 0; /// Create StructuredProxyPushSupplier - virtual void create (TAO_NS_StructuredProxyPushSupplier*& proxy ACE_ENV_SINGLE_ARG_DECL); + virtual void create (TAO_NS_StructuredProxyPushSupplier*& proxy ACE_ENV_ARG_DECL) = 0; + + /// Create SequenceProxyPushConsumer + virtual void create (TAO_NS_SequenceProxyPushConsumer*& proxy ACE_ENV_ARG_DECL) = 0; + + /// Create SequenceProxyPushSupplier + virtual void create (TAO_NS_SequenceProxyPushSupplier*& proxy ACE_ENV_ARG_DECL) = 0; }; #if defined (__ACE_INLINE__) diff --git a/TAO/orbsvcs/orbsvcs/Notify/FilterAdmin.cpp b/TAO/orbsvcs/orbsvcs/Notify/FilterAdmin.cpp index 9a93765627a..4a804fe3f4b 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/FilterAdmin.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/FilterAdmin.cpp @@ -15,15 +15,18 @@ TAO_NS_FilterAdmin::~TAO_NS_FilterAdmin (void) } CORBA::Boolean -TAO_NS_FilterAdmin::match (TAO_NS_Event_var &event ACE_ENV_ARG_DECL) +TAO_NS_FilterAdmin::match (const TAO_NS_Event_var &event ACE_ENV_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException, CosNotifyFilter::UnsupportedFilterableData )) { - // If no filter is active, treat it as a '*' i.e, let all events pass. - // or if its the special type, let it pass. - if (this->filter_list_.current_size () == 0) // || event.is_special_event_type ()) + ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, ace_mon, this->lock_, + CORBA::INTERNAL ()); + ACE_CHECK_RETURN (0); + + // If no filter is active, match is successfull. + if (this->filter_list_.current_size () == 0) return 1; // We want to return true if atleast one constraint matches. @@ -50,45 +53,56 @@ TAO_NS_FilterAdmin::add_filter (CosNotifyFilter::Filter_ptr new_filter ACE_ENV_A if (CORBA::is_nil (new_filter)) ACE_THROW_RETURN (CORBA::BAD_PARAM (), 0); + ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, ace_mon, this->lock_, + CORBA::INTERNAL ()); + ACE_CHECK_RETURN (0); + CosNotifyFilter::FilterID new_id = this->filter_ids_.id (); CosNotifyFilter::Filter_var new_filter_var = CosNotifyFilter::Filter::_duplicate (new_filter); if (this->filter_list_.bind (new_id, new_filter_var) == -1) - ACE_THROW_RETURN (CORBA::INTERNAL (), - 0); + ACE_THROW_RETURN (CORBA::INTERNAL (), + 0); else - { - return new_id; - } + return new_id; } -void TAO_NS_FilterAdmin::remove_filter (CosNotifyFilter::FilterID filter_id ACE_ENV_ARG_DECL) +void +TAO_NS_FilterAdmin::remove_filter (CosNotifyFilter::FilterID filter_id ACE_ENV_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException, CosNotifyFilter::FilterNotFound )) { + ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, ace_mon, this->lock_, + CORBA::INTERNAL ()); + ACE_CHECK; + if (this->filter_list_.unbind (filter_id) == -1) ACE_THROW (CosNotifyFilter::FilterNotFound ()); } CosNotifyFilter::Filter_ptr -TAO_NS_FilterAdmin::get_filter (CosNotifyFilter::FilterID filter ACE_ENV_ARG_DECL) +TAO_NS_FilterAdmin::get_filter (CosNotifyFilter::FilterID filter_id ACE_ENV_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException, CosNotifyFilter::FilterNotFound )) { + ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, ace_mon, this->lock_, + CORBA::INTERNAL ()); + ACE_CHECK_RETURN (CosNotifyFilter::Filter::_nil ()); + CosNotifyFilter::Filter_var filter_var; - if (this->filter_list_.find (filter, + if (this->filter_list_.find (filter_id, filter_var) == -1) ACE_THROW_RETURN (CosNotifyFilter::FilterNotFound (), 0); - return CosNotifyFilter::Filter::_duplicate (filter_var.in ()); + return filter_var._retn (); } CosNotifyFilter::FilterIDSeq* @@ -97,39 +111,46 @@ TAO_NS_FilterAdmin::get_all_filters (ACE_ENV_SINGLE_ARG_DECL) CORBA::SystemException )) { + ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, ace_mon, this->lock_, + CORBA::INTERNAL ()); + ACE_CHECK_RETURN (0); + // Figure out the length of the list. size_t len = this->filter_list_.current_size (); - CosNotifyFilter::FilterIDSeq* list = 0; + CosNotifyFilter::FilterIDSeq* list_ptr; // Allocate the list of length. - ACE_NEW_THROW_EX (list, - CosNotifyFilter::FilterIDSeq (len), + ACE_NEW_THROW_EX (list_ptr, + CosNotifyFilter::FilterIDSeq, CORBA::NO_MEMORY ()); ACE_CHECK_RETURN (0); + CosNotifyFilter::FilterIDSeq_var list (list_ptr); + list->length (len); - FILTER_LIST_ITER iter (this->filter_list_); - FILTER_LIST_ENTRY *entry; + FILTER_LIST::ITERATOR iter (this->filter_list_); + FILTER_LIST::ENTRY *entry; u_int index; - for (index = 0; iter.done () == 0; iter.advance (), ++index) + for (index = 0; iter.next (entry) != 0; iter.advance (), ++index) { - if (iter.next (entry) != 0) - { - list[index] = entry->ext_id_; - } + list[index] = entry->ext_id_; } - return list; + return list._retn (); } void TAO_NS_FilterAdmin::remove_all_filters (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC ((CORBA::SystemException)) { + ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, ace_mon, this->lock_, + CORBA::INTERNAL ()); + ACE_CHECK; + this->filter_list_.unbind_all (); } @@ -142,7 +163,6 @@ template class ACE_Hash_Map_Iterator_Ex, ACE_Equal_To,TAO_SYNCH_MUTEX>; template class ACE_Hash_Map_Reverse_Iterator; template class ACE_Hash_Map_Reverse_Iterator_Ex, ACE_Equal_To,TAO_SYNCH_MUTEX>; -template class TAO_Notify_ID_Pool_Ex; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) #pragma instantiate ACE_Hash_Map_Entry @@ -153,6 +173,5 @@ template class TAO_Notify_ID_Pool_Ex, ACE_Equal_To,TAO_SYNCH_MUTEX> #pragma instantiate ACE_Hash_Map_Reverse_Iterator #pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex, ACE_Equal_To,TAO_SYNCH_MUTEX> -#pragma instantiate TAO_Notify_ID_Pool_Ex #endif /*ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/FilterAdmin.h b/TAO/orbsvcs/orbsvcs/Notify/FilterAdmin.h index 0f56bea1704..89998714834 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/FilterAdmin.h +++ b/TAO/orbsvcs/orbsvcs/Notify/FilterAdmin.h @@ -21,7 +21,6 @@ #include "ID_Factory.h" #include "Event.h" #include "notify_export.h" -#include "Types.h" /** * @class TAO_NS_FilterAdmin @@ -41,7 +40,7 @@ class TAO_Notify_Export TAO_NS_FilterAdmin // = match operation on all the filters /// See if any of the filters match. - CORBA::Boolean match (TAO_NS_Event_var &event ACE_ENV_ARG_DECL) + CORBA::Boolean match (const TAO_NS_Event_var &event ACE_ENV_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException, CosNotifyFilter::UnsupportedFilterableData @@ -73,9 +72,10 @@ class TAO_Notify_Export TAO_NS_FilterAdmin )); private: - typedef ACE_Hash_Map_Manager FILTER_LIST; - typedef ACE_Hash_Map_Iterator FILTER_LIST_ITER; - typedef ACE_Hash_Map_Entry FILTER_LIST_ENTRY; + typedef ACE_Hash_Map_Manager FILTER_LIST; + + /// Mutex to serialize access to data members. + TAO_SYNCH_MUTEX lock_; /// List of filters FILTER_LIST filter_list_; diff --git a/TAO/orbsvcs/orbsvcs/Notify/FilterFactory.h b/TAO/orbsvcs/orbsvcs/Notify/FilterFactory.h index 0f6b520589b..27708b31cd9 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/FilterFactory.h +++ b/TAO/orbsvcs/orbsvcs/Notify/FilterFactory.h @@ -20,6 +20,7 @@ #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/Service_Object.h" +#include "tao/PortableServer/PortableServer.h" /** * @class TAO_NS_FilterFactory @@ -31,8 +32,8 @@ class /*TAO_Notify_Export*/ TAO_NS_FilterFactory : public ACE_Service_Object { public: /// Factory method to create a FilterFactory reference - /// The Factory is activated in the default POA. - virtual CosNotifyFilter::FilterFactory_ptr create (ACE_ENV_SINGLE_ARG_DECL) = 0; + /// The Factory is activated in the default POA. The filters created are activated in the . + virtual CosNotifyFilter::FilterFactory_ptr create (PortableServer::POA_var& filter_poa ACE_ENV_ARG_DECL) = 0; }; #include "ace/post.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/Find_Worker_T.cpp b/TAO/orbsvcs/orbsvcs/Notify/Find_Worker_T.cpp new file mode 100644 index 00000000000..1c560a73503 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Find_Worker_T.cpp @@ -0,0 +1,47 @@ +// $Id$ + +#ifndef TAO_NS_FIND_WORKER_T_CPP +#define TAO_NS_FIND_WORKER_T_CPP + +#include "Find_Worker_T.h" + +#if ! defined (__ACE_INLINE__) +#include "Find_Worker_T.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(Notify, TAO_NS_Find_Worker_T, "$id$") + +template +TAO_NS_Find_Worker_T::TAO_NS_Find_Worker_T (void) + :id_ (0), result_ (0) +{ +} + +template TYPE* +TAO_NS_Find_Worker_T::find (TAO_NS_Object::ID id, CONTAINER& container ACE_ENV_ARG_DECL) +{ + this->id_ = id; + + container.collection ()->for_each (this ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + return this->result_; +} + +template INTERFACE_PTR +TAO_NS_Find_Worker_T::resolve (TAO_NS_Object::ID id, CONTAINER& container ACE_ENV_ARG_DECL) +{ + this->find (id, container ACE_ENV_ARG_PARAMETER); + + if (this->result_ == 0) + ACE_THROW_RETURN (EXCEPTION () + , INTERFACE::_nil ()); + + CORBA::Object_var object = this->result_->ref (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (INTERFACE::_nil ()); + + return INTERFACE::_narrow (object.in () ACE_ENV_ARG_PARAMETER); + +} + +#endif /* TAO_NS_FIND_WORKER_T_CPP */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Find_Worker_T.h b/TAO/orbsvcs/orbsvcs/Notify/Find_Worker_T.h new file mode 100644 index 00000000000..172b64c2b56 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Find_Worker_T.h @@ -0,0 +1,72 @@ +/* -*- C++ -*- */ +/** + * @file Find_Worker_T.h + * + * $Id$ + * + * @author Pradeep Gore + * + * + */ + +#ifndef TAO_NS_FIND_WORKER_T_H +#define TAO_NS_FIND_WORKER_T_H +#include "ace/pre.h" + +#include "notify_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "orbsvcs/ESF/ESF_Proxy_Collection.h" +#include "orbsvcs/ESF/ESF_Worker.h" +#include "Container_T.h" + +/** + * @class TAO_NS_Find_Worker_T + * + * @brief Helper to locate a TYPE given its ID. + * + */ +template +class TAO_Notify_Export TAO_NS_Find_Worker_T : public TAO_ESF_Worker +{ + typedef TAO_NS_Container_T CONTAINER; + typedef TAO_ESF_Proxy_Collection COLLECTION; + +public: + /// Constructor + TAO_NS_Find_Worker_T (void); + + /// Find the Type. + TYPE* find (TAO_NS_Object::ID id, CONTAINER& container ACE_ENV_ARG_DECL); + + /// Find and resolve to the Interface. + INTERFACE_PTR resolve (TAO_NS_Object::ID id, CONTAINER& container ACE_ENV_ARG_DECL); + +protected: + ///= TAO_ESF_Worker method + void work (TYPE* object ACE_ENV_ARG_DECL); + + /// The id we're looking for. + TAO_NS_Object::ID id_; + + /// The result + TYPE* result_; +}; + +#if defined (__ACE_INLINE__) +#include "Find_Worker_T.inl" +#endif /* __ACE_INLINE__ */ + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "Find_Worker_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Find_Worker_T.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include "ace/post.h" +#endif /* TAO_NS_FIND_WORKER_T_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Find_Worker_T.inl b/TAO/orbsvcs/orbsvcs/Notify/Find_Worker_T.inl new file mode 100644 index 00000000000..b93dd01c819 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Find_Worker_T.inl @@ -0,0 +1,8 @@ +// $Id$ + +template ACE_INLINE void +TAO_NS_Find_Worker_T::work (TYPE* type ACE_ENV_ARG_DECL_NOT_USED) +{ + if (type->id () == this->id_) + this->result_ = type; +} diff --git a/TAO/orbsvcs/orbsvcs/Notify/ID_Factory.h b/TAO/orbsvcs/orbsvcs/Notify/ID_Factory.h index 014516164e2..bd756a57ed3 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/ID_Factory.h +++ b/TAO/orbsvcs/orbsvcs/Notify/ID_Factory.h @@ -19,8 +19,8 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#include "Types.h" #include "ace/Atomic_Op.h" +#include "Object.h" /** * @class TAO_NS_ID_Factory @@ -37,10 +37,10 @@ public: /// Destructor ~TAO_NS_ID_Factory (); - TAO_NS_Object_Id id (void); + TAO_NS_Object::ID id (void); private: - ACE_Atomic_Op seed_; + ACE_Atomic_Op seed_; }; diff --git a/TAO/orbsvcs/orbsvcs/Notify/ID_Factory.inl b/TAO/orbsvcs/orbsvcs/Notify/ID_Factory.inl index 59777405767..3520fc9bb7a 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/ID_Factory.inl +++ b/TAO/orbsvcs/orbsvcs/Notify/ID_Factory.inl @@ -1,10 +1,7 @@ // $Id$ -#include "ID_Factory.h" - -ACE_INLINE TAO_NS_Object_Id +ACE_INLINE TAO_NS_Object::ID TAO_NS_ID_Factory::id (void) { return ++seed_; } - diff --git a/TAO/orbsvcs/orbsvcs/Notify/Method_Request.cpp b/TAO/orbsvcs/orbsvcs/Notify/Method_Request.cpp index 68ccfaec69b..345c9da754e 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Method_Request.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Method_Request.cpp @@ -8,11 +8,63 @@ ACE_RCSID(RT_Notify, TAO_NS_Method_Request, "$Id$") -TAO_NS_Method_Request::TAO_NS_Method_Request (TAO_NS_Event_var& event) +TAO_NS_Method_Request_Event::TAO_NS_Method_Request_Event (const TAO_NS_Event_var& event) :event_ (event) { + // Set the parameters that affect queuing in the message queue. + // The ACE_Message_Block priorities go from 0 (lowest) to ULONG_MAX + // (highest), while the Notification Events go from -32767 (lowest, + // even though CORBA::Short goes to -32768) to 32767 (highest). + + // Convert to CORBA::Long to preserve the sign. Conversion to + // unsigned long will happen automatically and we do not have to worry + // about losing the number in the addition since priority () returns a + // CORBA::Short. + this->msg_priority ((CORBA::Long)this->event_->priority ().value () + + PRIORITY_BASE); + + // The deadline time for the message block is absolute, while the + // timeout for the event is relative to the time it was received. + // So, we do a little conversion and set it on the message block (us) + + TAO_NS_Property_Time& timeout = this->event_->timeout (); + + if (timeout.is_valid () && timeout != 0) + { + // I am multiplying timeout () by 1 because it returns a + // CORBA::ULongLong, which on some platforms doesn't automatically + // convert to the long that the ACE_Time_Value expects. The / + // operator returns a 32-bit integer. + ACE_Time_Value current = ACE_OS::gettimeofday () + +# if defined (ACE_CONFIG_WIN32_H) + ACE_Time_Value ( + ACE_static_cast (long, + timeout.value ())); +# else + ACE_Time_Value (timeout.value () / 1); +# endif /* ACE_CONFIG_WIN32_H */ + this->msg_deadline_time (current); + } +} + +TAO_NS_Method_Request_Event::~TAO_NS_Method_Request_Event () +{ +} + +int +TAO_NS_Method_Request_Event::execute (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) +{ + return -1; +} + +TAO_NS_Method_Request* +TAO_NS_Method_Request_Event::copy (void) +{ + return new TAO_NS_Method_Request_Event (this->event_); } -TAO_NS_Method_Request::~TAO_NS_Method_Request () +const TAO_NS_Event_var& +TAO_NS_Method_Request_Event::event (void) { + return this->event_; } diff --git a/TAO/orbsvcs/orbsvcs/Notify/Method_Request.h b/TAO/orbsvcs/orbsvcs/Notify/Method_Request.h index 0a11976f3f4..4124b82b21e 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Method_Request.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Method_Request.h @@ -19,33 +19,59 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#include "ace/Method_Request.h" +#include "ace/Message_Block.h" #include "ace/Refcounted_Auto_Ptr.h" #include "Event.h" -#include "Types.h" /** * @class TAO_NS_Method_Request * - * @brief Base class for NS method Requests + * @brief Interface for NS method Requests * */ -class TAO_Notify_Export TAO_NS_Method_Request : public ACE_Method_Request +class TAO_Notify_Export TAO_NS_Method_Request : public ACE_Message_Block +{ +public: + enum {PRIORITY_BASE = 32768}; + + /// Execute the Request + virtual int execute (ACE_ENV_SINGLE_ARG_DECL) = 0; + + /// Create a copy of this object. + virtual TAO_NS_Method_Request* copy (void) = 0; +}; + +/***********************************************************************/ + +/** + * @class TAO_NS_Method_Request_Event + * + * @brief Base class for NS method Requests on Events. + * + */ +class TAO_Notify_Export TAO_NS_Method_Request_Event : public TAO_NS_Method_Request { public: /// Constuctor - TAO_NS_Method_Request (TAO_NS_Event_var& event); + TAO_NS_Method_Request_Event (const TAO_NS_Event_var& event); /// Destructor - virtual ~TAO_NS_Method_Request (); + virtual ~TAO_NS_Method_Request_Event (); + + /// Execute the Request + virtual int execute (ACE_ENV_SINGLE_ARG_DECL); /// Create a copy of this object. - virtual TAO_NS_Method_Request* copy (void) = 0; + virtual TAO_NS_Method_Request* copy (void); + + /// Obtain the event. + const TAO_NS_Event_var& event (void); protected: - TAO_NS_Event_var event_; + const TAO_NS_Event_var event_; }; + #if defined (__ACE_INLINE__) #include "Method_Request.inl" #endif /* __ACE_INLINE__ */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Method_Request.inl b/TAO/orbsvcs/orbsvcs/Notify/Method_Request.inl index aa8cacaf7e6..cfa1da318d3 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Method_Request.inl +++ b/TAO/orbsvcs/orbsvcs/Notify/Method_Request.inl @@ -1,3 +1 @@ // $Id$ - -#include "Method_Request.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Dispatch.cpp b/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Dispatch.cpp index b101ede6ac8..caa1d7de399 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Dispatch.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Dispatch.cpp @@ -1,9 +1,6 @@ // $Id$ #include "Method_Request_Dispatch.h" -#include "ProxySupplier.h" -#include "Consumer.h" -#include "tao/debug.h" #if ! defined (__ACE_INLINE__) #include "Method_Request_Dispatch.inl" @@ -11,8 +8,14 @@ ACE_RCSID(RT_Notify, TAO_NS_Method_Request_Dispatch, "$Id$") -TAO_NS_Method_Request_Dispatch::TAO_NS_Method_Request_Dispatch (TAO_NS_Event_var& event, TAO_NS_ProxySupplier* proxy_supplier) - : TAO_NS_Method_Request (event), proxy_supplier_ (proxy_supplier) +#include "tao/debug.h" +#include "ProxySupplier.h" +#include "Consumer.h" +#include "Admin.h" +#include "ConsumerAdmin.h" + +TAO_NS_Method_Request_Dispatch::TAO_NS_Method_Request_Dispatch (const TAO_NS_Event_var& event, TAO_NS_ProxySupplier* proxy_supplier) + : TAO_NS_Method_Request_Event (event), proxy_supplier_ (proxy_supplier), refcountable_guard_ (*proxy_supplier) { } @@ -28,11 +31,17 @@ TAO_NS_Method_Request_Dispatch::copy (void) } int -TAO_NS_Method_Request_Dispatch::call (void) +TAO_NS_Method_Request_Dispatch::execute (ACE_ENV_SINGLE_ARG_DECL) { - ACE_DECLARE_NEW_CORBA_ENV; + if (this->proxy_supplier_->has_shutdown ()) + return 0; // If we were shutdown while waiting in the queue, return with no action. + + TAO_NS_Admin* parent = this->proxy_supplier_->consumer_admin (); - CORBA::Boolean val = this->proxy_supplier_->check_filters (this->event_ ACE_ENV_ARG_PARAMETER); + CORBA::Boolean val = this->proxy_supplier_->check_filters (this->event_, + parent->filter_admin (), + parent->filter_operator () + ACE_ENV_ARG_PARAMETER); if (TAO_debug_level > 1) ACE_DEBUG ((LM_DEBUG, "Proxysupplier %x filter eval result = %d",this->proxy_supplier_ , val)); @@ -43,20 +52,18 @@ TAO_NS_Method_Request_Dispatch::call (void) ACE_TRY { - this->proxy_supplier_->consumer ()->push (this->event_ ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + TAO_NS_Consumer* consumer = this->proxy_supplier_->consumer (); + + if (consumer != 0) + { + consumer->push (this->event_ ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + } } - ACE_CATCH (CORBA::UserException, ue) - { - ACE_PRINT_EXCEPTION (ue, - "TAO_NS_Method_Request_Dispatch::: error sending event. "); - //ACE_RE_THROW; - } - ACE_CATCH (CORBA::SystemException, se) + ACE_CATCHANY { - ACE_PRINT_EXCEPTION (se, - "TAO_NS_Method_Request_Dispatch::: error sending event. "); - //ACE_RE_THROW; + if (TAO_debug_level > 0) + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "TAO_NS_Method_Request_Dispatch::: error sending event. \n "); } ACE_ENDTRY; diff --git a/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Dispatch.h b/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Dispatch.h index e1910460065..862608c46a3 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Dispatch.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Dispatch.h @@ -20,7 +20,9 @@ #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "Method_Request.h" -#include "Types.h" +#include "Refcountable.h" + +class TAO_NS_ProxySupplier; /** * @class TAO_NS_Method_Request_Dispatch @@ -28,24 +30,27 @@ * @brief Dispatchs an event to a proxy supplier. * */ -class TAO_Notify_Export TAO_NS_Method_Request_Dispatch : public TAO_NS_Method_Request +class TAO_Notify_Export TAO_NS_Method_Request_Dispatch : public TAO_NS_Method_Request_Event { public: /// Constuctor - TAO_NS_Method_Request_Dispatch (TAO_NS_Event_var& event, TAO_NS_ProxySupplier* proxy_supplier); + TAO_NS_Method_Request_Dispatch (const TAO_NS_Event_var& event, TAO_NS_ProxySupplier* proxy_supplier); /// Destructor - ~TAO_NS_Method_Request_Dispatch (); + ~TAO_NS_Method_Request_Dispatch (); /// Create a copy of this object. TAO_NS_Method_Request* copy (void); - /// Execute method. - virtual int call (void); + /// Execute the Request + virtual int execute (ACE_ENV_SINGLE_ARG_DECL); private: /// Proxy Supplier that we use. TAO_NS_ProxySupplier* proxy_supplier_; + + /// Guard to automatically inc/decr ref count on the proxy. + TAO_NS_Refcountable_Guard refcountable_guard_; }; #if defined (__ACE_INLINE__) diff --git a/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Dispatch.inl b/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Dispatch.inl index 92e7e52c958..cfa1da318d3 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Dispatch.inl +++ b/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Dispatch.inl @@ -1,3 +1 @@ // $Id$ - -#include "Method_Request_Dispatch.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Dispatch_No_Filtering.cpp b/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Dispatch_No_Filtering.cpp index 49176d45704..83626a87a1c 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Dispatch_No_Filtering.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Dispatch_No_Filtering.cpp @@ -1,9 +1,6 @@ // $Id$ #include "Method_Request_Dispatch_No_Filtering.h" -#include "ProxySupplier.h" -#include "Consumer.h" -#include "tao/debug.h" #if ! defined (__ACE_INLINE__) #include "Method_Request_Dispatch_No_Filtering.inl" @@ -11,8 +8,12 @@ ACE_RCSID(RT_Notify, TAO_NS_Method_Request_Dispatch_No_Filtering, "$Id$") -TAO_NS_Method_Request_Dispatch_No_Filtering::TAO_NS_Method_Request_Dispatch_No_Filtering (TAO_NS_Event_var& event, TAO_NS_ProxySupplier* proxy_supplier) - : TAO_NS_Method_Request (event), proxy_supplier_ (proxy_supplier) +#include "tao/debug.h" +#include "ProxySupplier.h" +#include "Consumer.h" + +TAO_NS_Method_Request_Dispatch_No_Filtering::TAO_NS_Method_Request_Dispatch_No_Filtering (const TAO_NS_Event_var& event, TAO_NS_ProxySupplier* proxy_supplier) + : TAO_NS_Method_Request_Event (event), proxy_supplier_ (proxy_supplier), refcountable_guard_ (*proxy_supplier) { } @@ -28,9 +29,10 @@ TAO_NS_Method_Request_Dispatch_No_Filtering::copy (void) } int -TAO_NS_Method_Request_Dispatch_No_Filtering::call (void) +TAO_NS_Method_Request_Dispatch_No_Filtering::execute (ACE_ENV_SINGLE_ARG_DECL) { - ACE_DECLARE_NEW_CORBA_ENV; + if (this->proxy_supplier_->has_shutdown ()) + return 0; // If we were shutdown while waiting in the queue, return with no action. ACE_TRY { diff --git a/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Dispatch_No_Filtering.h b/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Dispatch_No_Filtering.h index a5180890f75..153caadc5d5 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Dispatch_No_Filtering.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Dispatch_No_Filtering.h @@ -20,7 +20,9 @@ #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "Method_Request.h" -#include "Types.h" +#include "Refcountable.h" + +class TAO_NS_ProxySupplier; /** * @class TAO_NS_Method_Request_Dispatch_No_Filtering @@ -28,11 +30,11 @@ * @brief Dispatchs an event to a proxy supplier but does NOT perform filtering. * */ -class TAO_Notify_Export TAO_NS_Method_Request_Dispatch_No_Filtering : public TAO_NS_Method_Request +class TAO_Notify_Export TAO_NS_Method_Request_Dispatch_No_Filtering : public TAO_NS_Method_Request_Event { public: /// Constuctor - TAO_NS_Method_Request_Dispatch_No_Filtering (TAO_NS_Event_var& event, TAO_NS_ProxySupplier* proxy_supplier); + TAO_NS_Method_Request_Dispatch_No_Filtering (const TAO_NS_Event_var& event, TAO_NS_ProxySupplier* proxy_supplier); /// Destructor ~TAO_NS_Method_Request_Dispatch_No_Filtering (); @@ -40,12 +42,15 @@ public: /// Create a copy of this object. TAO_NS_Method_Request* copy (void); - /// Execute method. - virtual int call (void); + /// Execute the Request + virtual int execute (ACE_ENV_SINGLE_ARG_DECL); private: /// Proxy Supplier that we use. TAO_NS_ProxySupplier* proxy_supplier_; + + /// Guard to automatically inc/decr ref count on the proxy. + TAO_NS_Refcountable_Guard refcountable_guard_; }; #if defined (__ACE_INLINE__) diff --git a/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Dispatch_No_Filtering.inl b/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Dispatch_No_Filtering.inl index 56932a7ab41..cfa1da318d3 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Dispatch_No_Filtering.inl +++ b/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Dispatch_No_Filtering.inl @@ -1,3 +1 @@ // $Id$ - -#include "Method_Request_Dispatch_No_Filtering.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Lookup.cpp b/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Lookup.cpp index bd25b092ed5..5dc8208a752 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Lookup.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Lookup.cpp @@ -1,11 +1,6 @@ // $Id$ #include "Method_Request_Lookup.h" -#include "orbsvcs/ESF/ESF_Proxy_Collection.h" -#include "Event_Map_T.h" -#include "ProxySupplier.h" -#include "ProxyConsumer.h" -#include "tao/debug.h" #if ! defined (__ACE_INLINE__) #include "Method_Request_Lookup.inl" @@ -13,8 +8,17 @@ ACE_RCSID(RT_Notify, TAO_NS_Method_Request_Lookup, "$Id$") -TAO_NS_Method_Request_Lookup::TAO_NS_Method_Request_Lookup (TAO_NS_Event_var& event, TAO_NS_ProxyConsumer* proxy_consumer, TAO_NS_Consumer_Map* map) - : TAO_NS_Method_Request (event), proxy_consumer_ (proxy_consumer), map_ (map) +#include "tao/debug.h" +#include "Consumer_Map.h" +#include "ProxySupplier.h" +#include "ProxyConsumer.h" +#include "Proxy.h" +#include "Admin.h" +#include "SupplierAdmin.h" + +TAO_NS_Method_Request_Lookup::TAO_NS_Method_Request_Lookup (const TAO_NS_Event_var& event, TAO_NS_ProxyConsumer* proxy_consumer, TAO_NS_Consumer_Map* map) + : TAO_NS_Method_Request_Event (event), proxy_consumer_ (proxy_consumer), map_ (map), + refcountable_guard_ (*proxy_consumer) { } @@ -30,11 +34,17 @@ TAO_NS_Method_Request_Lookup::copy (void) } int -TAO_NS_Method_Request_Lookup::call (void) +TAO_NS_Method_Request_Lookup::execute (ACE_ENV_SINGLE_ARG_DECL) { - ACE_DECLARE_NEW_CORBA_ENV; + if (this->proxy_consumer_->has_shutdown ()) + return 0; // If we were shutdown while waiting in the queue, return with no action. - CORBA::Boolean val = this->proxy_consumer_->check_filters (this->event_ ACE_ENV_ARG_PARAMETER); + TAO_NS_Admin* parent = this->proxy_consumer_->supplier_admin (); + + CORBA::Boolean val = this->proxy_consumer_->check_filters (this->event_, + parent->filter_admin (), + parent->filter_operator () + ACE_ENV_ARG_PARAMETER); if (TAO_debug_level > 1) ACE_DEBUG ((LM_DEBUG, "Proxyconsumer %x filter eval result = %d",this->proxy_consumer_ , val)); @@ -43,10 +53,20 @@ TAO_NS_Method_Request_Lookup::call (void) if (val == 0) return 0; - TAO_NS_ProxySupplier_Collection* consumers = map_->find (this->event_->type () ACE_ENV_ARG_PARAMETER); + TAO_NS_Consumer_Map::ENTRY* entry = map_->find (this->event_->type () ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); - if (consumers != 0) - consumers->for_each (this ACE_ENV_ARG_PARAMETER); + TAO_NS_ProxySupplier_Collection* consumers = 0; + + if (entry != 0) + { + consumers = entry->collection (); + + if (consumers != 0) + consumers->for_each (this ACE_ENV_ARG_PARAMETER); + + this->map_->release (entry); + } // Get the default consumers consumers = map_->broadcast_collection (); @@ -58,7 +78,7 @@ TAO_NS_Method_Request_Lookup::call (void) } void -TAO_NS_Method_Request_Lookup::work (TAO_NS_ProxySupplier* proxy_supplier ACE_ENV_ARG_DECL) +TAO_NS_Method_Request_Lookup::work (TAO_NS_ProxySupplier* proxy_supplier ACE_ENV_ARG_DECL_NOT_USED) { - proxy_supplier->push (this->event_ ACE_ENV_ARG_PARAMETER); + proxy_supplier->push (this->event_); } diff --git a/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Lookup.h b/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Lookup.h index 8400c9753af..4de8749c7e9 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Lookup.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Lookup.h @@ -21,7 +21,10 @@ #include "orbsvcs/ESF/ESF_Worker.h" #include "Method_Request.h" -#include "Types.h" +#include "ProxySupplier.h" +#include "Consumer_Map.h" + +class TAO_NS_ProxyConsumer; /** * @class TAO_NS_Method_Request_Lookup @@ -29,11 +32,11 @@ * @brief Lookup command object looks up the event type of the given event in the consumer map and send the event to each proxysupplier. * */ -class TAO_Notify_Export TAO_NS_Method_Request_Lookup : public TAO_NS_Method_Request, public TAO_ESF_Worker +class TAO_Notify_Export TAO_NS_Method_Request_Lookup : public TAO_NS_Method_Request_Event, public TAO_ESF_Worker { public: /// Constuctor - TAO_NS_Method_Request_Lookup (TAO_NS_Event_var& event, TAO_NS_ProxyConsumer* proxy_consumer, TAO_NS_Consumer_Map* map); + TAO_NS_Method_Request_Lookup (const TAO_NS_Event_var& event, TAO_NS_ProxyConsumer* proxy_consumer, TAO_NS_Consumer_Map* map); /// Destructor ~TAO_NS_Method_Request_Lookup (); @@ -41,8 +44,8 @@ public: /// Create a copy of this object. TAO_NS_Method_Request* copy (void); - /// Execute method. - virtual int call (void); + /// Execute the Request + virtual int execute (ACE_ENV_SINGLE_ARG_DECL); ///= TAO_ESF_Worker method void work (TAO_NS_ProxySupplier* proxy_supplier ACE_ENV_ARG_DECL); @@ -53,6 +56,9 @@ private: /// The map of subscriptions. TAO_NS_Consumer_Map* map_; + + /// Guard to automatically inc/decr ref count on the proxy. + TAO_NS_Refcountable_Guard refcountable_guard_; }; #if defined (__ACE_INLINE__) diff --git a/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Lookup.inl b/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Lookup.inl index 51e3d3fa8f4..cfa1da318d3 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Lookup.inl +++ b/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Lookup.inl @@ -1,3 +1 @@ // $Id$ - -#include "Method_Request_Lookup.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Shutdown.cpp b/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Shutdown.cpp index eb11d18ace8..cc52c47852f 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Shutdown.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Shutdown.cpp @@ -18,8 +18,14 @@ TAO_NS_Method_Request_Shutdown::~TAO_NS_Method_Request_Shutdown () { } +TAO_NS_Method_Request* +TAO_NS_Method_Request_Shutdown::copy (void) +{ + return new TAO_NS_Method_Request_Shutdown (this->task_); +} + int -TAO_NS_Method_Request_Shutdown::call (void) +TAO_NS_Method_Request_Shutdown::execute (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) { // Shut down the scheduler by deactivating the activation queue's // underlying message queue - should pop all worker threads off their diff --git a/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Shutdown.h b/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Shutdown.h index 4d2e43d6eca..433dea36e51 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Shutdown.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Shutdown.h @@ -19,7 +19,7 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#include "ace/Method_Request.h" +#include "Method_Request.h" class TAO_NS_ThreadPool_Task; @@ -29,7 +29,7 @@ class TAO_NS_ThreadPool_Task; * @brief Shutdown message for the ThreadPool_Task * */ -class TAO_Notify_Export TAO_NS_Method_Request_Shutdown : public ACE_Method_Request +class TAO_Notify_Export TAO_NS_Method_Request_Shutdown : public TAO_NS_Method_Request { public: /// Constuctor @@ -38,8 +38,11 @@ public: /// Destructor ~TAO_NS_Method_Request_Shutdown (); - /// Execute method. - virtual int call (void); + /// Create a copy of this object. + TAO_NS_Method_Request* copy (void); + + /// Execute the Request + virtual int execute (ACE_ENV_SINGLE_ARG_DECL); private: // Task to shutdown diff --git a/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Shutdown.inl b/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Shutdown.inl index de41fb92519..cfa1da318d3 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Shutdown.inl +++ b/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Shutdown.inl @@ -1,3 +1 @@ // $Id$ - -#include "Method_Request_Shutdown.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Updates.h b/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Updates.h index 00e68a21f18..282b5df3097 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Updates.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Method_Request_Updates.h @@ -20,13 +20,15 @@ #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "Method_Request.h" -#include "Types.h" #include "EventTypeSeq.h" +#include "Refcountable.h" + +class TAO_NS_Proxy; /** * @class TAO_NS_Method_Request_Updates * - * @brief + * @brief Command Object to send updates to proxys. * */ class TAO_Notify_Export TAO_NS_Method_Request_Updates : public TAO_NS_Method_Request diff --git a/TAO/orbsvcs/orbsvcs/Notify/Notify_Constraint_Interpreter.cpp b/TAO/orbsvcs/orbsvcs/Notify/Notify_Constraint_Interpreter.cpp index 70cca1e06f0..0dc683e4f0b 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Notify_Constraint_Interpreter.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Notify_Constraint_Interpreter.cpp @@ -3,18 +3,18 @@ #include "Notify_Constraint_Interpreter.h" #include "Notify_Constraint_Visitors.h" -ACE_RCSID(Notify, Notify_Constraint_Interpreter, "$Id$") +ACE_RCSID(Notify, NS_Constraint_Interpreter, "$Id$") -TAO_Notify_Constraint_Interpreter::TAO_Notify_Constraint_Interpreter (void) +TAO_NS_Constraint_Interpreter::TAO_NS_Constraint_Interpreter (void) { } -TAO_Notify_Constraint_Interpreter::~TAO_Notify_Constraint_Interpreter (void) +TAO_NS_Constraint_Interpreter::~TAO_NS_Constraint_Interpreter (void) { } void -TAO_Notify_Constraint_Interpreter::build_tree ( +TAO_NS_Constraint_Interpreter::build_tree ( const char *constraints ACE_ENV_ARG_DECL ) @@ -38,12 +38,9 @@ TAO_Notify_Constraint_Interpreter::build_tree ( } CORBA::Boolean -TAO_Notify_Constraint_Interpreter::evaluate ( - TAO_Notify_Constraint_Visitor &evaluator - ) +TAO_NS_Constraint_Interpreter::evaluate (TAO_NS_Constraint_Visitor &evaluator) { - CORBA::Boolean retval = - evaluator.evaluate_constraint (this->root_); + CORBA::Boolean retval = evaluator.evaluate_constraint (this->root_); return retval; } diff --git a/TAO/orbsvcs/orbsvcs/Notify/Notify_Constraint_Interpreter.h b/TAO/orbsvcs/orbsvcs/Notify/Notify_Constraint_Interpreter.h index 2f12529e974..03ca6f6d4f4 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Notify_Constraint_Interpreter.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Notify_Constraint_Interpreter.h @@ -27,22 +27,21 @@ #include "orbsvcs/CosNotifyFilterC.h" #include "notify_export.h" -class TAO_Notify_Constraint_Visitor; +class TAO_NS_Constraint_Visitor; /** - * @class TAO_Notify_Constraint_Interpreter + * @class TAO_NS_Constraint_Interpreter * * @brief "ETCL" Interpreter for the Notify queries. */ -class TAO_Notify_Export TAO_Notify_Constraint_Interpreter - : public TAO_ETCL_Interpreter +class TAO_Notify_Export TAO_NS_Constraint_Interpreter : public TAO_ETCL_Interpreter { public: // = Initialization and termination methods. - TAO_Notify_Constraint_Interpreter (void); + TAO_NS_Constraint_Interpreter (void); /// Destructor - ~TAO_Notify_Constraint_Interpreter (void); + ~TAO_NS_Constraint_Interpreter (void); /** * This method builds an expression tree representing the @@ -57,7 +56,7 @@ public: /// Returns true if the constraint is evaluated successfully by /// the evaluator. - CORBA::Boolean evaluate (TAO_Notify_Constraint_Visitor &evaluator); + CORBA::Boolean evaluate (TAO_NS_Constraint_Visitor &evaluator); }; #include "ace/post.h" #endif /* TAO_NOTIFY_CONSTRAINT_INTERPRETER_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Notify_Constraint_Visitors.cpp b/TAO/orbsvcs/orbsvcs/Notify/Notify_Constraint_Visitors.cpp index 49cc40225aa..e7224c069a0 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Notify_Constraint_Visitors.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Notify_Constraint_Visitors.cpp @@ -11,7 +11,7 @@ #include "tao/DynamicAny/DynEnum_i.h" #include "tao/DynamicAny/DynAnyFactory.h" -TAO_Notify_Constraint_Visitor::TAO_Notify_Constraint_Visitor (void) +TAO_NS_Constraint_Visitor::TAO_NS_Constraint_Visitor (void) : implicit_id_ (NONE) { (void) this->implicit_ids_.bind (ACE_CString ("filterable_data", @@ -53,7 +53,7 @@ TAO_Notify_Constraint_Visitor::TAO_Notify_Constraint_Visitor (void) } int -TAO_Notify_Constraint_Visitor::bind_structured_event ( +TAO_NS_Constraint_Visitor::bind_structured_event ( const CosNotification::StructuredEvent &s_event ) { @@ -99,10 +99,10 @@ TAO_Notify_Constraint_Visitor::bind_structured_event ( } } - this->domain_name_ = + this->domain_name_ = CORBA::string_dup (s_event.header.fixed_header.event_type.domain_name); - this->type_name_ = + this->type_name_ = CORBA::string_dup (s_event.header.fixed_header.event_type.type_name); this->event_name_ = @@ -114,7 +114,7 @@ TAO_Notify_Constraint_Visitor::bind_structured_event ( } CORBA::Boolean -TAO_Notify_Constraint_Visitor::evaluate_constraint ( +TAO_NS_Constraint_Visitor::evaluate_constraint ( TAO_ETCL_Constraint* root ) { @@ -138,7 +138,7 @@ TAO_Notify_Constraint_Visitor::evaluate_constraint ( } int -TAO_Notify_Constraint_Visitor::visit_literal ( +TAO_NS_Constraint_Visitor::visit_literal ( TAO_ETCL_Literal_Constraint *literal ) { @@ -147,7 +147,7 @@ TAO_Notify_Constraint_Visitor::visit_literal ( } int -TAO_Notify_Constraint_Visitor::visit_identifier (TAO_ETCL_Identifier *ident) +TAO_NS_Constraint_Visitor::visit_identifier (TAO_ETCL_Identifier *ident) { int return_value = -1; const char *name = ident->value (); @@ -168,7 +168,7 @@ TAO_Notify_Constraint_Visitor::visit_identifier (TAO_ETCL_Identifier *ident) } int -TAO_Notify_Constraint_Visitor::visit_union_value ( +TAO_NS_Constraint_Visitor::visit_union_value ( TAO_ETCL_Union_Value *union_value ) { @@ -191,7 +191,7 @@ TAO_Notify_Constraint_Visitor::visit_union_value ( } int -TAO_Notify_Constraint_Visitor::visit_union_pos ( +TAO_NS_Constraint_Visitor::visit_union_pos ( TAO_ETCL_Union_Pos *union_pos ) { @@ -348,7 +348,7 @@ TAO_Notify_Constraint_Visitor::visit_union_pos ( } int -TAO_Notify_Constraint_Visitor::visit_component_pos ( +TAO_NS_Constraint_Visitor::visit_component_pos ( TAO_ETCL_Component_Pos *pos ) { @@ -445,13 +445,13 @@ TAO_Notify_Constraint_Visitor::visit_component_pos ( } int -TAO_Notify_Constraint_Visitor::visit_component_assoc ( +TAO_NS_Constraint_Visitor::visit_component_assoc ( TAO_ETCL_Component_Assoc *assoc ) { CORBA::Any *any = 0; - ACE_CString name (assoc->identifier ()->value (), - 0, + ACE_CString name (assoc->identifier ()->value (), + 0, 0); switch (this->implicit_id_) @@ -507,7 +507,7 @@ TAO_Notify_Constraint_Visitor::visit_component_assoc ( } int -TAO_Notify_Constraint_Visitor::visit_component_array ( +TAO_NS_Constraint_Visitor::visit_component_array ( TAO_ETCL_Component_Array *array ) { @@ -603,7 +603,7 @@ TAO_Notify_Constraint_Visitor::visit_component_array ( } int -TAO_Notify_Constraint_Visitor::visit_special (TAO_ETCL_Special *special) +TAO_NS_Constraint_Visitor::visit_special (TAO_ETCL_Special *special) { ACE_DECLARE_NEW_CORBA_ENV; ACE_TRY @@ -677,7 +677,7 @@ TAO_Notify_Constraint_Visitor::visit_special (TAO_ETCL_Special *special) } int -TAO_Notify_Constraint_Visitor::visit_component ( +TAO_NS_Constraint_Visitor::visit_component ( TAO_ETCL_Component *component ) { @@ -698,8 +698,8 @@ TAO_Notify_Constraint_Visitor::visit_component ( // the queue to be handled upon returning from this method call. // If there is a sub-component, we store the literal's value // in our member _var for possible examination at a more - // nested level, and visit the sub-component. If the identifier - // matches one of the nested field names in + // nested level, and visit the sub-component. If the identifier + // matches one of the nested field names in // CosNotification::StructuredEvent, we just visit the nested // component, if any. if (this->implicit_id_ == NONE) @@ -765,7 +765,7 @@ TAO_Notify_Constraint_Visitor::visit_component ( this->queue_.enqueue_head (rob); return 0; } - // The above cases are the leaves of the + // The above cases are the leaves of the // CosNotification::StructuredEvent "tree". Anything else and we // should have a nested component. otherwise, it's an error. default: @@ -775,7 +775,7 @@ TAO_Notify_Constraint_Visitor::visit_component ( } int -TAO_Notify_Constraint_Visitor::visit_dot (TAO_ETCL_Dot *dot) +TAO_NS_Constraint_Visitor::visit_dot (TAO_ETCL_Dot *dot) { // If we are here, we know we're headed for a more nested // level, so we just visit it, there's nothing else in this @@ -784,14 +784,14 @@ TAO_Notify_Constraint_Visitor::visit_dot (TAO_ETCL_Dot *dot) } int -TAO_Notify_Constraint_Visitor::visit_eval (TAO_ETCL_Eval *eval) +TAO_NS_Constraint_Visitor::visit_eval (TAO_ETCL_Eval *eval) { // Nothing to do but visit the contained component. return eval->component ()->accept (this); } int -TAO_Notify_Constraint_Visitor::visit_default (TAO_ETCL_Default *def) +TAO_NS_Constraint_Visitor::visit_default (TAO_ETCL_Default *def) { TAO_ETCL_Constraint *comp = def->component (); @@ -840,7 +840,7 @@ TAO_Notify_Constraint_Visitor::visit_default (TAO_ETCL_Default *def) } int -TAO_Notify_Constraint_Visitor::visit_exist (TAO_ETCL_Exist *exist) +TAO_NS_Constraint_Visitor::visit_exist (TAO_ETCL_Exist *exist) { TAO_ETCL_Constraint *component = exist->component (); @@ -865,11 +865,11 @@ TAO_Notify_Constraint_Visitor::visit_exist (TAO_ETCL_Exist *exist) switch (this->implicit_id_) { case FILTERABLE_DATA: - result = + result = (this->filterable_data_.find (ACE_CString (value, 0, 0)) == 0); break; case VARIABLE_HEADER: - result = + result = (this->variable_header_.find (ACE_CString (value, 0, 0)) == 0); break; case TYPE_NAME: @@ -895,7 +895,7 @@ TAO_Notify_Constraint_Visitor::visit_exist (TAO_ETCL_Exist *exist) } int -TAO_Notify_Constraint_Visitor::visit_unary_expr ( +TAO_NS_Constraint_Visitor::visit_unary_expr ( TAO_ETCL_Unary_Expr *unary_expr ) { @@ -936,7 +936,7 @@ TAO_Notify_Constraint_Visitor::visit_unary_expr ( } int -TAO_Notify_Constraint_Visitor::visit_binary_expr ( +TAO_NS_Constraint_Visitor::visit_binary_expr ( TAO_ETCL_Binary_Expr *binary_expr ) { @@ -970,7 +970,7 @@ TAO_Notify_Constraint_Visitor::visit_binary_expr ( } int -TAO_Notify_Constraint_Visitor::visit_or ( +TAO_NS_Constraint_Visitor::visit_or ( TAO_ETCL_Binary_Expr *binary ) { @@ -1012,7 +1012,7 @@ TAO_Notify_Constraint_Visitor::visit_or ( } int -TAO_Notify_Constraint_Visitor::visit_and ( +TAO_NS_Constraint_Visitor::visit_and ( TAO_ETCL_Binary_Expr *binary ) { @@ -1054,7 +1054,7 @@ TAO_Notify_Constraint_Visitor::visit_and ( } int -TAO_Notify_Constraint_Visitor::visit_binary_op ( +TAO_NS_Constraint_Visitor::visit_binary_op ( TAO_ETCL_Binary_Expr *binary, int op_type ) @@ -1125,7 +1125,7 @@ TAO_Notify_Constraint_Visitor::visit_binary_op ( } int -TAO_Notify_Constraint_Visitor::visit_twiddle ( +TAO_NS_Constraint_Visitor::visit_twiddle ( TAO_ETCL_Binary_Expr *binary ) { @@ -1155,7 +1155,7 @@ TAO_Notify_Constraint_Visitor::visit_twiddle ( } int -TAO_Notify_Constraint_Visitor::visit_in ( +TAO_NS_Constraint_Visitor::visit_in ( TAO_ETCL_Binary_Expr *binary ) { @@ -1233,7 +1233,7 @@ TAO_Notify_Constraint_Visitor::visit_in ( } int -TAO_Notify_Constraint_Visitor::visit_preference ( +TAO_NS_Constraint_Visitor::visit_preference ( TAO_ETCL_Preference * ) { @@ -1245,7 +1245,7 @@ TAO_Notify_Constraint_Visitor::visit_preference ( } CORBA::Boolean -TAO_Notify_Constraint_Visitor::sequence_does_contain ( +TAO_NS_Constraint_Visitor::sequence_does_contain ( const CORBA::Any *any, TAO_ETCL_Literal_Constraint &item ) @@ -1299,7 +1299,7 @@ TAO_Notify_Constraint_Visitor::sequence_does_contain ( } CORBA::Boolean -TAO_Notify_Constraint_Visitor::array_does_contain ( +TAO_NS_Constraint_Visitor::array_does_contain ( const CORBA::Any *any, TAO_ETCL_Literal_Constraint &item ) @@ -1353,7 +1353,7 @@ TAO_Notify_Constraint_Visitor::array_does_contain ( } CORBA::Boolean -TAO_Notify_Constraint_Visitor::struct_does_contain ( +TAO_NS_Constraint_Visitor::struct_does_contain ( const CORBA::Any *any, TAO_ETCL_Literal_Constraint &item ) @@ -1409,7 +1409,7 @@ TAO_Notify_Constraint_Visitor::struct_does_contain ( } CORBA::Boolean -TAO_Notify_Constraint_Visitor::union_does_contain ( +TAO_NS_Constraint_Visitor::union_does_contain ( const CORBA::Any *any, TAO_ETCL_Literal_Constraint &item ) @@ -1458,7 +1458,7 @@ TAO_Notify_Constraint_Visitor::union_does_contain ( } CORBA::Boolean -TAO_Notify_Constraint_Visitor::any_does_contain ( +TAO_NS_Constraint_Visitor::any_does_contain ( const CORBA::Any *any, TAO_ETCL_Literal_Constraint &item ) @@ -1474,7 +1474,7 @@ TAO_Notify_Constraint_Visitor::any_does_contain ( } CORBA::Boolean -TAO_Notify_Constraint_Visitor::simple_type_match (int expr_type, +TAO_NS_Constraint_Visitor::simple_type_match (int expr_type, CORBA::TCKind tc_kind) { switch (expr_type) @@ -1530,14 +1530,14 @@ template class ACE_Unbounded_Queue; template class ACE_Unbounded_Queue_Iterator; -template class ACE_Hash_Map_Manager; -template class ACE_Hash_Map_Manager_Ex, ACE_Equal_To, TAO_SYNCH_MUTEX>; -template class ACE_Hash_Map_Entry ; -template class ACE_Hash_Map_Iterator; -template class ACE_Hash_Map_Iterator_Ex, ACE_Equal_To, TAO_SYNCH_MUTEX>; -template class ACE_Hash_Map_Iterator_Base_Ex, ACE_Equal_To, TAO_SYNCH_MUTEX>; -template class ACE_Hash_Map_Reverse_Iterator; -template class ACE_Hash_Map_Reverse_Iterator_Ex, ACE_Equal_To, TAO_SYNCH_MUTEX>; +template class ACE_Hash_Map_Manager; +template class ACE_Hash_Map_Manager_Ex, ACE_Equal_To, TAO_SYNCH_MUTEX>; +template class ACE_Hash_Map_Entry ; +template class ACE_Hash_Map_Iterator; +template class ACE_Hash_Map_Iterator_Ex, ACE_Equal_To, TAO_SYNCH_MUTEX>; +template class ACE_Hash_Map_Iterator_Base_Ex, ACE_Equal_To, TAO_SYNCH_MUTEX>; +template class ACE_Hash_Map_Reverse_Iterator; +template class ACE_Hash_Map_Reverse_Iterator_Ex, ACE_Equal_To, TAO_SYNCH_MUTEX>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) #pragma instantiate ACE_Hash_Map_Manager @@ -1552,13 +1552,13 @@ template class ACE_Hash_Map_Reverse_Iterator_Ex #pragma instantiate ACE_Unbounded_Queue_Iterator -#pragma instantiate ACE_Hash_Map_Manager -#pragma instantiate ACE_Hash_Map_Manager_Ex, ACE_Equal_To, TAO_SYNCH_MUTEX> -#pragma instantiate ACE_Hash_Map_Entry -#pragma instantiate ACE_Hash_Map_Iterator -#pragma instantiate ACE_Hash_Map_Iterator_Ex, ACE_Equal_To, TAO_SYNCH_MUTEX> -#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex, ACE_Equal_To, TAO_SYNCH_MUTEX> -#pragma instantiate ACE_Hash_Map_Reverse_Iterator -#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex, ACE_Equal_To, TAO_SYNCH_MUTEX> +#pragma instantiate ACE_Hash_Map_Manager +#pragma instantiate ACE_Hash_Map_Manager_Ex, ACE_Equal_To, TAO_SYNCH_MUTEX> +#pragma instantiate ACE_Hash_Map_Entry +#pragma instantiate ACE_Hash_Map_Iterator +#pragma instantiate ACE_Hash_Map_Iterator_Ex, ACE_Equal_To, TAO_SYNCH_MUTEX> +#pragma instantiate ACE_Hash_Map_Iterator_Base_Ex, ACE_Equal_To, TAO_SYNCH_MUTEX> +#pragma instantiate ACE_Hash_Map_Reverse_Iterator +#pragma instantiate ACE_Hash_Map_Reverse_Iterator_Ex, ACE_Equal_To, TAO_SYNCH_MUTEX> #endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Notify_Constraint_Visitors.h b/TAO/orbsvcs/orbsvcs/Notify/Notify_Constraint_Visitors.h index 9ca060decee..4b356c9945f 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Notify_Constraint_Visitors.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Notify_Constraint_Visitors.h @@ -32,12 +32,12 @@ class TAO_ETCL_Constraint; class TAO_ETCL_Literal_Constraint; class TAO_Notify_Property_Constraint; -class TAO_Notify_Export TAO_Notify_Constraint_Visitor +class TAO_Notify_Export TAO_NS_Constraint_Visitor : public TAO_ETCL_Constraint_Visitor { public: /// Constructor. - TAO_Notify_Constraint_Visitor (void); + TAO_NS_Constraint_Visitor (void); /// Put the event data into our hash map. int bind_structured_event (const CosNotification::StructuredEvent &s_event); diff --git a/TAO/orbsvcs/orbsvcs/Notify/Notify_Default_CO_Factory.cpp b/TAO/orbsvcs/orbsvcs/Notify/Notify_Default_CO_Factory.cpp index 8f01c2ce172..fcc7dacc7df 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Notify_Default_CO_Factory.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Notify_Default_CO_Factory.cpp @@ -1,354 +1,12 @@ // $Id$ #include "Notify_Default_CO_Factory.h" -#include "Notify_Factory.h" -#include "Notify_EventChannelFactory_i.h" -#include "Notify_EventChannel_i.h" -#include "Notify_Event_Manager.h" -#include "Notify_FilterFactory_i.h" -#include "Notify_ConsumerAdmin_i.h" -#include "Notify_SupplierAdmin_i.h" -#include "Notify_StructuredProxyPushSupplier_i.h" -#include "Notify_SequenceProxyPushSupplier_i.h" -#include "Notify_ProxyPushSupplier_i.h" -#include "Notify_StructuredProxyPushConsumer_i.h" -#include "Notify_SequenceProxyPushConsumer_i.h" -#include "Notify_ProxyPushConsumer_i.h" ACE_RCSID(Notify, Notify_Default_CO_Factory, "$Id$") int TAO_Notify_Default_CO_Factory::init_svc (void) { - return ACE_Service_Config::static_svcs ()-> - insert (&ace_svc_desc_TAO_Notify_Default_CO_Factory); -} - -TAO_Notify_Default_CO_Factory::TAO_Notify_Default_CO_Factory (void) -{ -} - -TAO_Notify_Default_CO_Factory::~TAO_Notify_Default_CO_Factory () -{ -} - -int -TAO_Notify_Default_CO_Factory::init (int /*argc*/, ACE_TCHAR* /*argv*/[]) -{ + // NOP. return 0; } - -int -TAO_Notify_Default_CO_Factory::fini (void) -{ - return 0; -} - - -TAO_Notify_EventChannel_i* -TAO_Notify_Default_CO_Factory::create_event_channel (TAO_Notify_EventChannelFactory_i* parent ACE_ENV_ARG_DECL) -{ - TAO_Notify_EventChannel_i* channel; - ACE_NEW_THROW_EX (channel, - TAO_Notify_EventChannel_i (parent), - CORBA::NO_MEMORY ()); - return channel; -} - -TAO_Notify_ConsumerAdmin_i* -TAO_Notify_Default_CO_Factory::create_consumer_admin (TAO_Notify_EventChannel_i* event_channel - ACE_ENV_ARG_DECL) -{ - TAO_Notify_ConsumerAdmin_i* consumer_admin_i; - ACE_NEW_THROW_EX (consumer_admin_i, - TAO_Notify_ConsumerAdmin_i (event_channel), - CORBA::NO_MEMORY ()); - ACE_TRY - { - // Propagate the event channels qos to the consumer - CosNotification::QoSProperties_var qos = - event_channel->get_qos (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - consumer_admin_i->set_qos (qos.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, - ACE_LIB_TEXT("Unable to propagate event channel qos\n")); - } - ACE_ENDTRY; - - return consumer_admin_i; -} - -TAO_Notify_SupplierAdmin_i* -TAO_Notify_Default_CO_Factory::create_supplier_admin (TAO_Notify_EventChannel_i* event_channel - ACE_ENV_ARG_DECL) -{ - TAO_Notify_SupplierAdmin_i* supplier_admin_i; - - ACE_NEW_THROW_EX (supplier_admin_i, - TAO_Notify_SupplierAdmin_i (event_channel), - CORBA::NO_MEMORY ()); - ACE_TRY - { - // Propagate the event channels qos to the supplier - CosNotification::QoSProperties_var qos = - event_channel->get_qos (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - supplier_admin_i->set_qos (qos.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, - ACE_LIB_TEXT("Unable to propagate event channel qos\n")); - } - ACE_ENDTRY; - - return supplier_admin_i; -} - - -TAO_Notify_FilterFactory_i* -TAO_Notify_Default_CO_Factory::create_filter_factory (ACE_ENV_SINGLE_ARG_DECL) -{ - TAO_Notify_FilterFactory_i* filterfactory; - ACE_NEW_THROW_EX (filterfactory, - TAO_Notify_FilterFactory_i (), - CORBA::NO_MEMORY ()); - return filterfactory; -} - - -TAO_Notify_StructuredProxyPushSupplier_i* -TAO_Notify_Default_CO_Factory::create_struct_proxy_pushsupplier (TAO_Notify_ConsumerAdmin_i* parent ACE_ENV_ARG_DECL) -{ - TAO_Notify_StructuredProxyPushSupplier_i* proxy; - ACE_NEW_THROW_EX (proxy, - TAO_Notify_StructuredProxyPushSupplier_i (parent), - CORBA::NO_MEMORY ()); - ACE_TRY - { - // Propagate the parent qos to the supplier - CosNotification::QoSProperties_var qos = - parent->get_qos (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - proxy->set_qos (qos.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, - ACE_LIB_TEXT("Unable to propagate parent qos\n")); - } - ACE_ENDTRY; - - return proxy; -} - -TAO_Notify_SequenceProxyPushSupplier_i* -TAO_Notify_Default_CO_Factory::create_seq_proxy_pushsupplier (TAO_Notify_ConsumerAdmin_i* parent ACE_ENV_ARG_DECL) -{ - TAO_Notify_SequenceProxyPushSupplier_i* proxy; - ACE_NEW_THROW_EX (proxy, - TAO_Notify_SequenceProxyPushSupplier_i (parent), - CORBA::NO_MEMORY ()); - ACE_TRY - { - // Propagate the parent qos to the supplier - CosNotification::QoSProperties_var qos = - parent->get_qos (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - proxy->set_qos (qos.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, - ACE_LIB_TEXT("Unable to propagate parent qos\n")); - } - ACE_ENDTRY; - - return proxy; -} - -TAO_Notify_ProxyPushSupplier_i* -TAO_Notify_Default_CO_Factory::create_proxy_pushsupplier (TAO_Notify_ConsumerAdmin_i* parent ACE_ENV_ARG_DECL) -{ - TAO_Notify_ProxyPushSupplier_i* proxy; - ACE_NEW_THROW_EX (proxy, - TAO_Notify_ProxyPushSupplier_i (parent), - CORBA::NO_MEMORY ()); - ACE_TRY - { - // Propagate the parent qos to the supplier - CosNotification::QoSProperties_var qos = - parent->get_qos (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - proxy->set_qos (qos.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, - ACE_LIB_TEXT("Unable to propagate parent qos\n")); - } - ACE_ENDTRY; - - return proxy; -} - - -TAO_Notify_StructuredProxyPushConsumer_i* -TAO_Notify_Default_CO_Factory::create_struct_proxy_pushconsumer (TAO_Notify_SupplierAdmin_i* parent ACE_ENV_ARG_DECL) -{ - TAO_Notify_StructuredProxyPushConsumer_i* proxy; - ACE_NEW_THROW_EX (proxy, - TAO_Notify_StructuredProxyPushConsumer_i (parent), - CORBA::NO_MEMORY ()); - ACE_TRY - { - // Propagate the parent qos to the consumer - CosNotification::QoSProperties_var qos = - parent->get_qos (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - proxy->set_qos (qos.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, - ACE_LIB_TEXT("Unable to propagate parent qos\n")); - } - ACE_ENDTRY; - - return proxy; -} - -TAO_Notify_ProxyPushConsumer_i* -TAO_Notify_Default_CO_Factory::create_proxy_pushconsumer (TAO_Notify_SupplierAdmin_i* parent ACE_ENV_ARG_DECL) -{ - TAO_Notify_ProxyPushConsumer_i* proxy; - ACE_NEW_THROW_EX (proxy, - TAO_Notify_ProxyPushConsumer_i (parent), - CORBA::NO_MEMORY ()); - ACE_TRY - { - // Propagate the parent qos to the consumer - CosNotification::QoSProperties_var qos = - parent->get_qos (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - proxy->set_qos (qos.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, - ACE_LIB_TEXT("Unable to propagate parent qos\n")); - } - ACE_ENDTRY; - - return proxy; -} - -TAO_Notify_SequenceProxyPushConsumer_i* -TAO_Notify_Default_CO_Factory::create_seq_proxy_pushconsumer (TAO_Notify_SupplierAdmin_i* parent ACE_ENV_ARG_DECL) -{ - TAO_Notify_SequenceProxyPushConsumer_i* proxy; - ACE_NEW_THROW_EX (proxy, - TAO_Notify_SequenceProxyPushConsumer_i (parent), - CORBA::NO_MEMORY ()); - ACE_TRY - { - // Propagate the parent qos to the consumer - CosNotification::QoSProperties_var qos = - parent->get_qos (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_TRY_CHECK; - - proxy->set_qos (qos.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, - ACE_LIB_TEXT("Unable to propagate parent qos\n")); - } - ACE_ENDTRY; - - return proxy; -} - - -ACE_Lock* -TAO_Notify_Default_CO_Factory::create_channel_factory_lock (ACE_ENV_SINGLE_ARG_DECL) -{ - return create_event_channel_lock (ACE_ENV_SINGLE_ARG_PARAMETER); -} - -ACE_Lock* -TAO_Notify_Default_CO_Factory::create_event_channel_lock (ACE_ENV_SINGLE_ARG_DECL) -{ - ACE_Lock* lock; - ACE_NEW_THROW_EX (lock, - ACE_Lock_Adapter (), - CORBA::NO_MEMORY ()); - return lock; -} - -ACE_Lock* -TAO_Notify_Default_CO_Factory::create_consumer_admin_lock (ACE_ENV_SINGLE_ARG_DECL) -{ - // Later: - return create_event_channel_lock (ACE_ENV_SINGLE_ARG_PARAMETER); -} - -ACE_Lock* -TAO_Notify_Default_CO_Factory::create_supplier_admin_lock (ACE_ENV_SINGLE_ARG_DECL) -{ - // Later: - return create_event_channel_lock (ACE_ENV_SINGLE_ARG_PARAMETER); -} - -ACE_Lock* -TAO_Notify_Default_CO_Factory::create_proxy_supplier_lock (ACE_ENV_SINGLE_ARG_DECL) -{ - // Later: - return create_event_channel_lock (ACE_ENV_SINGLE_ARG_PARAMETER); -} - -ACE_Lock* -TAO_Notify_Default_CO_Factory::create_proxy_consumer_lock (ACE_ENV_SINGLE_ARG_DECL) -{ - // Later: - return create_event_channel_lock (ACE_ENV_SINGLE_ARG_PARAMETER); -} - - -// **************************************************************** - -ACE_STATIC_SVC_DEFINE (TAO_Notify_Default_CO_Factory, - ACE_TEXT (TAO_NOTIFY_DEF_CO_FACTORY_NAME), - ACE_SVC_OBJ_T, - &ACE_SVC_NAME (TAO_Notify_Default_CO_Factory), - ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ, - 0) -ACE_FACTORY_DEFINE (TAO_Notify, TAO_Notify_Default_CO_Factory) - -// **************************************************************** diff --git a/TAO/orbsvcs/orbsvcs/Notify/Notify_Default_CO_Factory.h b/TAO/orbsvcs/orbsvcs/Notify/Notify_Default_CO_Factory.h index fef319ac79d..0cbba6a2173 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Notify_Default_CO_Factory.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Notify_Default_CO_Factory.h @@ -5,8 +5,6 @@ * * $Id$ * - * Default factory for channel objects. - * * * @author Pradeep Gore */ @@ -17,9 +15,7 @@ #define NOTIFY_DEFAULT_CO_FACTORY_H #include "ace/pre.h" -#include "Notify_Channel_Objects_Factory.h" #include "notify_export.h" -#include "ace/Service_Config.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -30,79 +26,17 @@ * * @brief TAO_Notify_Default_CO_Factory * - * Default Channel Objects factory + * Maintained for backward compatibility. */ -class TAO_Notify_Export TAO_Notify_Default_CO_Factory : public TAO_Notify_CO_Factory +class TAO_Notify_Export TAO_Notify_Default_CO_Factory { public: - TAO_Notify_Default_CO_Factory (void); - ~TAO_Notify_Default_CO_Factory (); - /// Helper function to register the default factory into the service /// configurator. static int init_svc (void); - // = The Service_Object entry points - virtual int init (int argc, ACE_TCHAR* argv[]); - virtual int fini (void); - - // = TAO_Notify_CO_Factory methods - // = Creation methods - /// Create an Event Channel. - TAO_Notify_EventChannel_i* create_event_channel (TAO_Notify_EventChannelFactory_i* parent ACE_ENV_ARG_DECL); - - /// Create a Consumer Admin. - TAO_Notify_ConsumerAdmin_i* create_consumer_admin (TAO_Notify_EventChannel_i* channel ACE_ENV_ARG_DECL); - - /// Create a Supplier Admin. - TAO_Notify_SupplierAdmin_i* create_supplier_admin (TAO_Notify_EventChannel_i* channel ACE_ENV_ARG_DECL); - - /// Create the Filter Factory. - TAO_Notify_FilterFactory_i* create_filter_factory (ACE_ENV_SINGLE_ARG_DECL); - - // = Proxy Creation methods. - /// Create a Structured ProxyPushSupplier. - TAO_Notify_StructuredProxyPushSupplier_i* create_struct_proxy_pushsupplier (TAO_Notify_ConsumerAdmin_i* parent ACE_ENV_ARG_DECL); - - /// Create a Sequence ProxyPushSupplier. - TAO_Notify_SequenceProxyPushSupplier_i* create_seq_proxy_pushsupplier (TAO_Notify_ConsumerAdmin_i* parent ACE_ENV_ARG_DECL); - - /// Create a ProxyPushSupplier. - TAO_Notify_ProxyPushSupplier_i* create_proxy_pushsupplier (TAO_Notify_ConsumerAdmin_i* parent ACE_ENV_ARG_DECL); - - /// Create a Structured ProxyPushConsumer. - TAO_Notify_StructuredProxyPushConsumer_i* create_struct_proxy_pushconsumer (TAO_Notify_SupplierAdmin_i* parent ACE_ENV_ARG_DECL); - - /// Create a Sequence ProxyPushConsumer. - TAO_Notify_SequenceProxyPushConsumer_i* create_seq_proxy_pushconsumer (TAO_Notify_SupplierAdmin_i* parent ACE_ENV_ARG_DECL); - - /// Create a ProxyPushConsumer. - TAO_Notify_ProxyPushConsumer_i* create_proxy_pushconsumer (TAO_Notify_SupplierAdmin_i* parent ACE_ENV_ARG_DECL); - - //= Locks - // = Methods to create locks. - /// Create lock type used by channel factory. - ACE_Lock* create_channel_factory_lock (ACE_ENV_SINGLE_ARG_DECL); - - /// Create lock type used by EC's. - ACE_Lock* create_event_channel_lock (ACE_ENV_SINGLE_ARG_DECL); - - /// Create lock type used by Consumer Admin's. - ACE_Lock* create_consumer_admin_lock (ACE_ENV_SINGLE_ARG_DECL); - - /// Create lock type used by Supplier Admin's. - ACE_Lock* create_supplier_admin_lock (ACE_ENV_SINGLE_ARG_DECL); - - /// Create lock type used by proxy supplier. - ACE_Lock* create_proxy_supplier_lock (ACE_ENV_SINGLE_ARG_DECL); - - /// Create lock type used by proxy consumer. - ACE_Lock* create_proxy_consumer_lock (ACE_ENV_SINGLE_ARG_DECL); }; -ACE_STATIC_SVC_DECLARE (TAO_Notify_Default_CO_Factory) -ACE_FACTORY_DECLARE (TAO_Notify,TAO_Notify_Default_CO_Factory) - #include "ace/post.h" #endif /* NOTIFY_DEFAULT_CO_FACTORY_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Notify_Default_Collection_Factory.cpp b/TAO/orbsvcs/orbsvcs/Notify/Notify_Default_Collection_Factory.cpp index b7709ee8ec3..d1ac87b35e1 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Notify_Default_Collection_Factory.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Notify_Default_Collection_Factory.cpp @@ -1,172 +1,12 @@ // $Id$ #include "Notify_Default_Collection_Factory.h" -#include "orbsvcs/ESF/ESF_Proxy_List.h" -#include "orbsvcs/ESF/ESF_Immediate_Changes.h" -#include "orbsvcs/ESF/ESF_Copy_On_Write.h" -#include "Notify_Factory.h" ACE_RCSID(Notify, Notify_Default_Collection_Factory, "$Id$") -typedef TAO_ESF_Proxy_List::Iterator TAO_Notify_EventListener_List_Iterator; -typedef TAO_ESF_Proxy_List::Iterator TAO_Notify_UpdateListener_List_Iterator; - int TAO_Notify_Default_Collection_Factory::init_svc (void) { - return ACE_Service_Config::static_svcs ()-> - insert (&ace_svc_desc_TAO_Notify_Default_Collection_Factory); -} - -TAO_Notify_Default_Collection_Factory::TAO_Notify_Default_Collection_Factory (void) -{ -} - -TAO_Notify_Default_Collection_Factory::~TAO_Notify_Default_Collection_Factory () -{ -} - -int -TAO_Notify_Default_Collection_Factory::init (int /*argc*/, ACE_TCHAR* /*argv*/[]) -{ - return 0; -} - -int -TAO_Notify_Default_Collection_Factory::fini (void) -{ + // NOP. return 0; } - -TAO_Notify_EventListener_List* -TAO_Notify_Default_Collection_Factory::create_event_listener_list (ACE_ENV_SINGLE_ARG_DECL_NOT_USED/*ACE_ENV_SINGLE_ARG_PARAMETER*/) -{ - // @@ Pradeep: the copy_on_write versions are a much better choice - // for a default than the immediate changes version. The latter - // fails with any sort of recursive calls. - - TAO_Notify_EventListener_List* listener_list = - new TAO_ESF_Copy_On_Write, - TAO_Notify_EventListener_List_Iterator, - ACE_SYNCH> (); - return listener_list; - - /* - new TAO_ESF_Immediate_Changes, - TAO_Notify_EventListener_List_Iterator, - TAO_SYNCH_MUTEX> (); - -ACE_NEW_THROW_EX (listener_list, - TAO_ESF_Immediate_Changes, - TAO_Notify_EventListener_List_Iterator, - TAO_SYNCH_MUTEX> (), - CORBA::NO_MEMORY ());*/ - // TODO: create other kinds of lists. -} - -TAO_Notify_UpdateListener_List* -TAO_Notify_Default_Collection_Factory::create_update_listener_list (ACE_ENV_SINGLE_ARG_DECL_NOT_USED/*ACE_ENV_SINGLE_ARG_PARAMETER*/) -{ - - /* TAO_Notify_UpdateListener_List* listener_list = - new TAO_ESF_Immediate_Changes, - TAO_Notify_UpdateListener_List_Iterator, - TAO_SYNCH_MUTEX> (); // ACE_SYNCH_NULL_MUTEX - - return listener_list; - */ - - TAO_Notify_UpdateListener_List* listener_list = - new TAO_ESF_Copy_On_Write, - TAO_Notify_UpdateListener_List_Iterator, - ACE_SYNCH> (); - return listener_list; - -} - -// **************************************************************** - -ACE_STATIC_SVC_DEFINE (TAO_Notify_Default_Collection_Factory, - ACE_TEXT (TAO_NOTIFY_DEF_COLLECTION_FACTORY_NAME), - ACE_SVC_OBJ_T, - &ACE_SVC_NAME (TAO_Notify_Default_Collection_Factory), - ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ, - 0) -ACE_FACTORY_DEFINE (TAO_Notify, TAO_Notify_Default_Collection_Factory) - -// **************************************************************** - -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) - -template class TAO_ESF_Worker; -template class TAO_ESF_Worker; - -template class TAO_ESF_Immediate_Changes, ACE_Unbounded_Set_Iterator, TAO_SYNCH_MUTEX>; -template class TAO_ESF_Immediate_Changes, ACE_Unbounded_Set_Iterator, TAO_SYNCH_MUTEX>; - -template class TAO_ESF_Copy_On_Write, ACE_Unbounded_Set_Iterator, ACE_SYNCH>; -template class TAO_ESF_Copy_On_Write, ACE_Unbounded_Set_Iterator, ACE_SYNCH>; - -template class TAO_ESF_Copy_On_Write_Write_Guard, - TAO_Notify_EventListener_List_Iterator, - ACE_SYNCH>; - -template class TAO_ESF_Copy_On_Write_Write_Guard, - TAO_Notify_UpdateListener_List_Iterator, - ACE_SYNCH>; - -template class TAO_ESF_Copy_On_Write_Collection, ACE_Unbounded_Set_Iterator >; - -template class TAO_ESF_Copy_On_Write_Collection, ACE_Unbounded_Set_Iterator >; - -template class TAO_ESF_Proxy_List; -template class TAO_ESF_Proxy_Collection; - -template class TAO_ESF_Proxy_List; -template class TAO_ESF_Proxy_Collection; - -template class TAO_ESF_Copy_On_Write_Read_Guard, ACE_Unbounded_Set_Iterator, TAO_SYNCH_MUTEX>; - -template class TAO_ESF_Copy_On_Write_Read_Guard, ACE_Unbounded_Set_Iterator, TAO_SYNCH_MUTEX>; - -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) - -#pragma instantiate TAO_ESF_Worker -#pragma instantiate TAO_ESF_Worker - -#pragma instantiate TAO_ESF_Immediate_Changes, ACE_Unbounded_Set_Iterator, TAO_SYNCH_MUTEX> -#pragma instantiate TAO_ESF_Immediate_Changes, ACE_Unbounded_Set_Iterator, TAO_SYNCH_MUTEX> -#pragma instantiate TAO_ESF_Immediate_Changes, ACE_Unbounded_Set_Iterator, ACE_Null_Mutex> - -#pragma instantiate TAO_ESF_Copy_On_Write, ACE_Unbounded_Set_Iterator, ACE_SYNCH> -#pragma instantiate TAO_ESF_Copy_On_Write, ACE_Unbounded_Set_Iterator, ACE_SYNCH> - -#pragma instantiate TAO_ESF_Copy_On_Write_Write_Guard< -TAO_ESF_Proxy_List, - TAO_Notify_EventListener_List_Iterator, - ACE_SYNCH> -#pragma instantiate TAO_ESF_Copy_On_Write_Write_Guard< -TAO_ESF_Proxy_List, - TAO_Notify_UpdateListener_List_Iterator, - ACE_SYNCH> - -#pragma instantiate TAO_ESF_Copy_On_Write_Collection, ACE_Unbounded_Set_Iterator > - -#pragma instantiate TAO_ESF_Copy_On_Write_Collection, ACE_Unbounded_Set_Iterator > - -#pragma instantiate TAO_ESF_Proxy_List -#pragma instantiate TAO_ESF_Proxy_Collection - -#pragma instantiate TAO_ESF_Proxy_List -#pragma instantiate TAO_ESF_Proxy_Collection - -#pragma instantiate TAO_ESF_Copy_On_Write_Read_Guard, ACE_Unbounded_Set_Iterator, TAO_SYNCH_MUTEX> - -#pragma instantiate TAO_ESF_Copy_On_Write_Read_Guard, ACE_Unbounded_Set_Iterator, TAO_SYNCH_MUTEX> - -#endif /*ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Notify_Default_Collection_Factory.h b/TAO/orbsvcs/orbsvcs/Notify/Notify_Default_Collection_Factory.h index 497f7b97a8a..8a6916dbc76 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Notify_Default_Collection_Factory.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Notify_Default_Collection_Factory.h @@ -5,9 +5,6 @@ * * $Id$ * - * Default factory for collections - * - * * @author Pradeep Gore */ //============================================================================= @@ -18,9 +15,6 @@ #include "ace/pre.h" #include "notify_export.h" -#include "Notify_Collection_Factory.h" -#include "Notify_Listeners.h" -#include "ace/Service_Config.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -29,34 +23,18 @@ /** * @class TAO_Notify_Default_Collection_Factory * - * @brief TAO_Notify_Default_Collection_Factory + * @brief Maintained for backward compatibility. + * * - * Default factory for collections */ -class TAO_Notify_Export TAO_Notify_Default_Collection_Factory : public TAO_Notify_Collection_Factory +class TAO_Notify_Export TAO_Notify_Default_Collection_Factory { public: - TAO_Notify_Default_Collection_Factory (void); - ~TAO_Notify_Default_Collection_Factory (); /// Helper function to register the default factory into the service /// configurator. static int init_svc (void); - - // = The Service_Object entry points - virtual int init (int argc, ACE_TCHAR* argv[]); - virtual int fini (void); - - // = Methods to create listener collections. - /// Create the event listener list. - virtual TAO_Notify_EventListener_List* create_event_listener_list (ACE_ENV_SINGLE_ARG_DECL); - - /// create update listener list. - virtual TAO_Notify_UpdateListener_List* create_update_listener_list (ACE_ENV_SINGLE_ARG_DECL); }; -ACE_STATIC_SVC_DECLARE (TAO_Notify_Default_Collection_Factory) -ACE_FACTORY_DECLARE (TAO_Notify,TAO_Notify_Default_Collection_Factory) - #include "ace/post.h" #endif /* NOTIFY_DEFAULT_COLLECTION_FACTORY_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Notify_Default_EMO_Factory.cpp b/TAO/orbsvcs/orbsvcs/Notify/Notify_Default_EMO_Factory.cpp index a725bed6eb4..5cfb1d7e8cb 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Notify_Default_EMO_Factory.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Notify_Default_EMO_Factory.cpp @@ -1,353 +1,12 @@ // $Id$ #include "Notify_Default_EMO_Factory.h" -#include "Notify_Event_Manager.h" -#include "Notify_Event_Map.h" -#include "Notify_Event_Processor.h" -#include "Notify_Worker_Task.h" -#include "Notify_Factory.h" -#include "Notify_Event.h" -#include "Notify_MT_Worker_Task.h" - -#include "ace/Arg_Shifter.h" -#include "ace/Get_Opt.h" - -#include "tao/debug.h" ACE_RCSID(Notify, Notify_Default_EMO_Factory, "$Id$") -#define ASYNCH_UPDATES_THREADS 1 - // The number of threads to send subscription/publication updates. - // As this is a relatively adminstrative function. let's just use 1 - // thread to send the updates asynchronously. - - - TAO_EMO_Options::TAO_EMO_Options (void) - : mt_dispatching_ (0), - mt_source_eval_ (0), - mt_lookup_ (0), - mt_listener_eval_ (0), - asynch_updates_ (0), - alloc_task_per_proxy_ (0), - dispatching_threads_ (1), - source_threads_ (1), - lookup_threads_ (1), - listener_threads_ (1) -{ -} - int TAO_Notify_Default_EMO_Factory::init_svc (void) { - return ACE_Service_Config::static_svcs ()-> - insert (&ace_svc_desc_TAO_Notify_Default_EMO_Factory); -} - -TAO_Notify_Default_EMO_Factory::TAO_Notify_Default_EMO_Factory (void) - :prealloc_source_eval_task_ (0), - prealloc_listener_eval_task_ (0), - prealloc_dispatching_task_ (0) -{ -} - -TAO_Notify_Default_EMO_Factory::~TAO_Notify_Default_EMO_Factory () -{ - delete prealloc_source_eval_task_; - delete prealloc_listener_eval_task_; - delete prealloc_dispatching_task_; -} - -int -TAO_Notify_Default_EMO_Factory::init (int argc, ACE_TCHAR* argv[]) -{ - // ACE_DEBUG ((LM_DEBUG, "TAO_Notify_Default_EMO_Factory::init\n")); - - ACE_Arg_Shifter arg_shifter (argc, argv); - - const ACE_TCHAR *current_arg = 0; - while (arg_shifter.is_anything_left ()) - { - const ACE_TCHAR *arg = arg_shifter.get_current (); - - if (ACE_OS::strcasecmp (arg, ACE_LIB_TEXT("-MTDispatching")) == 0) - { - EMO_OPTIONS::instance ()->mt_dispatching_ = 1; - arg_shifter.consume_arg (); - } - else if ((current_arg = arg_shifter.get_the_parameter (ACE_LIB_TEXT("-DispatchingThreads")))) - { - EMO_OPTIONS::instance ()->dispatching_threads_ = ACE_OS::atoi (current_arg); - arg_shifter.consume_arg (); - } - else if (ACE_OS::strcasecmp (arg, ACE_LIB_TEXT("-MTSourceEval")) == 0) - { - EMO_OPTIONS::instance ()->mt_source_eval_ = 1; - arg_shifter.consume_arg (); - } - else if ((current_arg = arg_shifter.get_the_parameter (ACE_LIB_TEXT("-SourceThreads")))) - { - EMO_OPTIONS::instance ()->source_threads_ = ACE_OS::atoi (current_arg); - arg_shifter.consume_arg (); - } - else if (ACE_OS::strcasecmp (arg, ACE_LIB_TEXT("-MTLookup")) == 0) - { - EMO_OPTIONS::instance ()->mt_lookup_ = 1; - arg_shifter.consume_arg (); - } - else if ((current_arg = arg_shifter.get_the_parameter (ACE_LIB_TEXT("-LookupThreads")))) - { - EMO_OPTIONS::instance ()->lookup_threads_ = ACE_OS::atoi (current_arg); - arg_shifter.consume_arg (); - } - else if (ACE_OS::strcasecmp (arg, ACE_LIB_TEXT("-MTListenerEval")) == 0) - { - EMO_OPTIONS::instance ()->mt_listener_eval_ = 1; - arg_shifter.consume_arg (); - } - else if ((current_arg = arg_shifter.get_the_parameter (ACE_LIB_TEXT("-ListenerThreads")))) - { - EMO_OPTIONS::instance ()->listener_threads_ = ACE_OS::atoi (current_arg); - arg_shifter.consume_arg (); - } - else if (ACE_OS::strcasecmp (arg, ACE_LIB_TEXT("-AsynchUpdates")) == 0) - { - EMO_OPTIONS::instance ()->asynch_updates_ = 1; - arg_shifter.consume_arg (); - } - else if (ACE_OS::strcasecmp (arg, ACE_LIB_TEXT("-AllocateTaskperProxy")) == 0) - { - EMO_OPTIONS::instance ()->alloc_task_per_proxy_ = 1; - arg_shifter.consume_arg (); - } - else - { - ACE_DEBUG ((LM_DEBUG,"EMO Factory did not understand %s",arg)); - arg_shifter.ignore_arg (); - } - } - - return 0; -} - -TAO_Notify_Worker_Task* -TAO_Notify_Default_EMO_Factory::create_task (int mt, int tp_size ACE_ENV_ARG_DECL) -{ - TAO_Notify_Worker_Task* task; - - int threads_flags = - THR_SCHED_DEFAULT|THR_BOUND|THR_NEW_LWP; - - // int dispatching_threads_priority - - // Later: give the user options to specify threads flags and thread priority for each task. - - if (mt == 1) - ACE_NEW_THROW_EX (task, TAO_Notify_MT_Worker_Task (tp_size, - threads_flags, - 0), - CORBA::NO_MEMORY ()); - else - ACE_NEW_THROW_EX (task, - TAO_Notify_Worker_Task (), - CORBA::NO_MEMORY ()); - return task; -} - - -int -TAO_Notify_Default_EMO_Factory::init_instance (void) -{ - if (EMO_OPTIONS::instance ()->alloc_task_per_proxy_ == 0) // preallocate all tasks. - { - return this->preallocate_tasks (); - } - return 0; -} - -int -TAO_Notify_Default_EMO_Factory::preallocate_tasks (void) -{ - ACE_DECLARE_NEW_CORBA_ENV; - - this->prealloc_source_eval_task_ = - create_task (EMO_OPTIONS::instance ()->mt_source_eval_, EMO_OPTIONS::instance ()->source_threads_ - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); - - this->prealloc_listener_eval_task_ = - create_task (EMO_OPTIONS::instance ()->mt_listener_eval_, EMO_OPTIONS::instance ()->listener_threads_ - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); - - this->prealloc_dispatching_task_ = - create_task (EMO_OPTIONS::instance ()->mt_dispatching_, EMO_OPTIONS::instance ()->dispatching_threads_ - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (-1); - - return 0; -} - -int -TAO_Notify_Default_EMO_Factory::fini (void) -{ - // ACE_DEBUG ((LM_DEBUG, "TAO_Notify_Default_EMO_Factory::fini\n")); + // NOP. return 0; } - -TAO_Notify_Event_Manager* -TAO_Notify_Default_EMO_Factory::create_event_manager (TAO_Notify_EventChannel_i* channel ACE_ENV_ARG_DECL) -{ - TAO_Notify_Event_Manager* event_manager; - ACE_NEW_THROW_EX (event_manager, - TAO_Notify_Event_Manager (channel, this), - CORBA::NO_MEMORY ()); - return event_manager; -} - -TAO_Notify_Event_Map* -TAO_Notify_Default_EMO_Factory::create_event_map (ACE_ENV_SINGLE_ARG_DECL) -{ - TAO_Notify_Event_Map* event_map; - ACE_NEW_THROW_EX (event_map, - TAO_Notify_Event_Map (this), - CORBA::NO_MEMORY ()); - return event_map; -} - -TAO_Notify_Event_Processor* -TAO_Notify_Default_EMO_Factory::create_event_processor (TAO_Notify_Event_Manager* event_manager ACE_ENV_ARG_DECL) -{ - TAO_Notify_Event_Processor* event_processor; - ACE_NEW_THROW_EX (event_processor, - TAO_Notify_Event_Processor (event_manager), - CORBA::NO_MEMORY ()); - return event_processor; -} - - -TAO_Notify_Worker_Task* -TAO_Notify_Default_EMO_Factory::create_source_eval_task (ACE_ENV_SINGLE_ARG_DECL) -{ - if (EMO_OPTIONS::instance ()->alloc_task_per_proxy_ == 1) - return create_task (EMO_OPTIONS::instance ()->mt_source_eval_, - EMO_OPTIONS::instance ()->source_threads_ - ACE_ENV_ARG_PARAMETER); - else - return prealloc_source_eval_task_; -} - -TAO_Notify_Worker_Task* -TAO_Notify_Default_EMO_Factory::create_lookup_task (ACE_ENV_SINGLE_ARG_DECL) -{ - return create_task (EMO_OPTIONS::instance ()->mt_lookup_, - EMO_OPTIONS::instance ()->lookup_threads_ ACE_ENV_ARG_PARAMETER); -} - -TAO_Notify_Worker_Task* -TAO_Notify_Default_EMO_Factory::create_listener_eval_task (ACE_ENV_SINGLE_ARG_DECL) -{ - if (EMO_OPTIONS::instance ()->alloc_task_per_proxy_ == 1) - return create_task (EMO_OPTIONS::instance ()->mt_listener_eval_, - EMO_OPTIONS::instance ()->listener_threads_ - ACE_ENV_ARG_PARAMETER); - else - return prealloc_listener_eval_task_; -} - -TAO_Notify_Worker_Task* -TAO_Notify_Default_EMO_Factory::create_dispatching_task (ACE_ENV_SINGLE_ARG_DECL) -{ - if (EMO_OPTIONS::instance ()->alloc_task_per_proxy_ == 1) - return create_task (EMO_OPTIONS::instance ()->mt_dispatching_, - EMO_OPTIONS::instance ()->dispatching_threads_ - ACE_ENV_ARG_PARAMETER); - else - return prealloc_dispatching_task_; -} - -TAO_Notify_Worker_Task* -TAO_Notify_Default_EMO_Factory::create_updates_task (ACE_ENV_SINGLE_ARG_DECL) -{ - return create_task (EMO_OPTIONS::instance ()->asynch_updates_, ASYNCH_UPDATES_THREADS ACE_ENV_ARG_PARAMETER); -} - -void -TAO_Notify_Default_EMO_Factory::destroy_source_eval_task (TAO_Notify_Worker_Task* task) -{ - if (EMO_OPTIONS::instance ()->alloc_task_per_proxy_ == 1) - delete task; -} - -void -TAO_Notify_Default_EMO_Factory::destroy_listener_eval_task (TAO_Notify_Worker_Task* task) -{ - if (EMO_OPTIONS::instance ()->alloc_task_per_proxy_ == 1) - delete task; -} - -void -TAO_Notify_Default_EMO_Factory::destroy_dispatching_task (TAO_Notify_Worker_Task* task) -{ - if (EMO_OPTIONS::instance ()->alloc_task_per_proxy_ == 1) - delete task; -} - -void -TAO_Notify_Default_EMO_Factory::destroy_lookup_task (TAO_Notify_Worker_Task* task) -{ - delete task; -} - -void -TAO_Notify_Default_EMO_Factory::destroy_updates_task (TAO_Notify_Worker_Task* task) -{ - delete task; -} - - -void -TAO_Notify_Default_EMO_Factory::print_values (void) -{ - if (TAO_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, - "EMO Factory = " - "mt_dispatching %d " - "mt_source_eval %d " - " mt_lookup %d " - " mt_listener_eval %d" - " dispatching_threads %d " - " source_threads %d " - " lookup_threads %d " - " listener_threads_ %d " - " AsynchUpdates %d" - " AllocateTaskperProxy %d", - EMO_OPTIONS::instance ()->mt_dispatching_, - EMO_OPTIONS::instance ()->mt_source_eval_, - EMO_OPTIONS::instance ()->mt_lookup_, - EMO_OPTIONS::instance ()->mt_listener_eval_, - EMO_OPTIONS::instance ()->dispatching_threads_, - EMO_OPTIONS::instance ()->source_threads_, - EMO_OPTIONS::instance ()->lookup_threads_, - EMO_OPTIONS::instance ()->listener_threads_, - EMO_OPTIONS::instance ()->asynch_updates_, - EMO_OPTIONS::instance ()->alloc_task_per_proxy_ - )); -} - -// **************************************************************** - -ACE_STATIC_SVC_DEFINE (TAO_Notify_Default_EMO_Factory, - ACE_TEXT (TAO_NOTIFY_DEF_EMO_FACTORY_NAME), - ACE_SVC_OBJ_T, - &ACE_SVC_NAME (TAO_Notify_Default_EMO_Factory), - ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ, - 0) -ACE_FACTORY_DEFINE (TAO_Notify, TAO_Notify_Default_EMO_Factory) - -// **************************************************************** - -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class ACE_Singleton; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Singleton -#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Notify_Default_EMO_Factory.h b/TAO/orbsvcs/orbsvcs/Notify/Notify_Default_EMO_Factory.h index b95f452a55b..0b666380e84 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Notify_Default_EMO_Factory.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Notify_Default_EMO_Factory.h @@ -5,9 +5,6 @@ * * $Id$ * - * Default factory for event manager and its helper objects. - * - * * @author Pradeep Gore */ //============================================================================= @@ -18,97 +15,24 @@ #include "ace/pre.h" #include "notify_export.h" -#include "Notify_Event_Manager_Objects_Factory.h" - -#include "ace/Service_Config.h" -#include "ace/Singleton.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -// @@ Pradeep: I appretiate the separation of concerns from having -// multiple factories, but consider that some configurations of -// Collection, Locks, and dispatchers don't go well together. The -// purpose of an Abstract Factory is to have a single object that -// returns consistently configured objects.... - -class TAO_EMO_Options // Options read by service conf. +/** + * @class TAO_Notify_Default_EMO_Factory + * + * @brief Maintained for backward compatibility. + * + */ +class TAO_Notify_Export TAO_Notify_Default_EMO_Factory { public: - TAO_EMO_Options (void); - - // Params read via the svc.conf - CORBA::Boolean mt_dispatching_; - CORBA::Boolean mt_source_eval_; - CORBA::Boolean mt_lookup_; - CORBA::Boolean mt_listener_eval_; - CORBA::Boolean asynch_updates_; - CORBA::Boolean alloc_task_per_proxy_; - - int dispatching_threads_; - int source_threads_; - int lookup_threads_; - int listener_threads_; -}; - -class TAO_Notify_Export TAO_Notify_Default_EMO_Factory : public TAO_Notify_EMO_Factory -{ - public: - TAO_Notify_Default_EMO_Factory (void); - ~TAO_Notify_Default_EMO_Factory (); - /// Helper function to register the default factory into the service /// configurator. static int init_svc (void); - - // = The Service_Object entry points - virtual int init (int argc, ACE_TCHAR* argv[]); - virtual int fini (void); - - /// Create an event manager. - virtual TAO_Notify_Event_Manager* create_event_manager (TAO_Notify_EventChannel_i* channel ACE_ENV_ARG_DECL); - - /// Create the event map. - virtual TAO_Notify_Event_Map* create_event_map (ACE_ENV_SINGLE_ARG_DECL); - - /// Create event processor. - virtual TAO_Notify_Event_Processor* create_event_processor (TAO_Notify_Event_Manager* event_manager ACE_ENV_ARG_DECL); - - // = Create processing tasks. - virtual TAO_Notify_Worker_Task* create_source_eval_task (ACE_ENV_SINGLE_ARG_DECL); - virtual TAO_Notify_Worker_Task* create_lookup_task (ACE_ENV_SINGLE_ARG_DECL); - virtual TAO_Notify_Worker_Task* create_listener_eval_task ( ACE_ENV_SINGLE_ARG_DECL); - virtual TAO_Notify_Worker_Task* create_dispatching_task (ACE_ENV_SINGLE_ARG_DECL); - virtual TAO_Notify_Worker_Task* create_updates_task (ACE_ENV_SINGLE_ARG_DECL); - - virtual void destroy_source_eval_task (TAO_Notify_Worker_Task* task); - virtual void destroy_lookup_task (TAO_Notify_Worker_Task* task); - virtual void destroy_listener_eval_task (TAO_Notify_Worker_Task* task); - virtual void destroy_dispatching_task (TAO_Notify_Worker_Task* task); - virtual void destroy_updates_task (TAO_Notify_Worker_Task* task); - - virtual void print_values (void); - int init_instance (); - -protected: - //= Protected Methods - /// Create a worker task, mt => is this a MT task, if so, tp_size is thread pool size. - TAO_Notify_Worker_Task* create_task (int mt, int tp_size ACE_ENV_ARG_DECL); - - int preallocate_tasks (void); - - //= Data Members - TAO_Notify_Worker_Task* prealloc_source_eval_task_; - TAO_Notify_Worker_Task* prealloc_listener_eval_task_; - TAO_Notify_Worker_Task* prealloc_dispatching_task_; }; -// Typedef an Options Singleton. -typedef ACE_Singleton EMO_OPTIONS; - -ACE_STATIC_SVC_DECLARE (TAO_Notify_Default_EMO_Factory) -ACE_FACTORY_DECLARE (TAO_Notify,TAO_Notify_Default_EMO_Factory) - #include "ace/post.h" #endif /* NOTIFY_DEFAULT_EMO_FACTORY_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Notify_Default_POA_Factory.cpp b/TAO/orbsvcs/orbsvcs/Notify/Notify_Default_POA_Factory.cpp index acfd1b30636..046d1c507ff 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Notify_Default_POA_Factory.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Notify_Default_POA_Factory.cpp @@ -1,262 +1,12 @@ // $Id$ #include "Notify_Default_POA_Factory.h" -#include "Notify_Factory.h" - -#define EC_POA_NAME "EC_POA" -// The POA name in which all the EC's live. ACE_RCSID(Notify, Notify_Default_POA_Factory, "$Id$") int TAO_Notify_Default_POA_Factory::init_svc (void) { - return ACE_Service_Config::static_svcs ()-> - insert (&ace_svc_desc_TAO_Notify_Default_POA_Factory); -} - -TAO_Notify_Default_POA_Factory::TAO_Notify_Default_POA_Factory (void) -{ -} - -TAO_Notify_Default_POA_Factory::~TAO_Notify_Default_POA_Factory () -{ -} - -int -TAO_Notify_Default_POA_Factory::init (int /*argc*/, ACE_TCHAR* /*argv*/[]) -{ + // NOP. return 0; } - -int -TAO_Notify_Default_POA_Factory::fini (void) -{ - return 0; -} - -PortableServer::POA_ptr -TAO_Notify_Default_POA_Factory::create_event_channel_POA (PortableServer::POA_ptr parent_poa ACE_ENV_ARG_DECL) -{ - return this->create_generic_childPOA_i (EC_POA_NAME, - parent_poa ACE_ENV_ARG_PARAMETER); -} - - -PortableServer::POA_ptr -TAO_Notify_Default_POA_Factory::create_supplier_admin_POA (PortableServer::POA_ptr parent_poa, CORBA::Long new_poa_id ACE_ENV_ARG_DECL) -{ - char child_poa_name[BUFSIZ]; - - ACE_OS::sprintf (child_poa_name, "%d%s", new_poa_id, "SA"); - - return this->create_generic_childPOA_i (child_poa_name, parent_poa - ACE_ENV_ARG_PARAMETER); -} - -PortableServer::POA_ptr -TAO_Notify_Default_POA_Factory::create_consumer_admin_POA (PortableServer::POA_ptr parent_poa, CORBA::Long new_poa_id ACE_ENV_ARG_DECL) -{ - char child_poa_name[BUFSIZ]; - - ACE_OS::sprintf (child_poa_name, "%d%s", new_poa_id, "CA"); - - return this->create_generic_childPOA_i (child_poa_name, - parent_poa ACE_ENV_ARG_PARAMETER); -} - -PortableServer::POA_ptr -TAO_Notify_Default_POA_Factory::create_proxy_pushconsumer_POA (PortableServer::POA_ptr parent_poa, CORBA::Long new_poa_id ACE_ENV_ARG_DECL) -{ - char child_poa_name[BUFSIZ]; - - ACE_OS::sprintf (child_poa_name, "%d%s", new_poa_id, "PPC"); - - return this->create_generic_childPOA_i (child_poa_name, - parent_poa ACE_ENV_ARG_PARAMETER); -} - -PortableServer::POA_ptr -TAO_Notify_Default_POA_Factory::create_proxy_pushsupplier_POA (PortableServer::POA_ptr parent_poa, CORBA::Long new_poa_id ACE_ENV_ARG_DECL) -{ - char child_poa_name[BUFSIZ]; - - ACE_OS::sprintf (child_poa_name, "%d%s", new_poa_id, "PPS"); - - return this->create_generic_childPOA_i (child_poa_name, - parent_poa ACE_ENV_ARG_PARAMETER); -} - -PortableServer::POA_ptr -TAO_Notify_Default_POA_Factory::create_generic_childPOA_i (const char* child_poa_name, PortableServer::POA_ptr poa ACE_ENV_ARG_DECL) -{ - // @@ Pradeep: if the Notification service is ever going to be - // persistent or fault tolerant you may need to create this stuff - // with the persistent policy too, probably you can handle that - // using a different 'Resource_Manager' that overrides this - // method. Just a thought... - - // Create a UNIQUE_ID and USER_ID policy because we want the POA - // to detect duplicates for us. - PortableServer::IdUniquenessPolicy_var idpolicy = - poa->create_id_uniqueness_policy (PortableServer::UNIQUE_ID - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (PortableServer::POA::_nil()); - - PortableServer::IdAssignmentPolicy_var assignpolicy = - poa->create_id_assignment_policy (PortableServer::USER_ID - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (PortableServer::POA::_nil ()); - - PortableServer::POAManager_var manager = - poa->the_POAManager (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (PortableServer::POA::_nil ()); - - // Create a PolicyList - CORBA::PolicyList policy_list; - policy_list.length (2); - policy_list [0] = - PortableServer::IdUniquenessPolicy::_duplicate (idpolicy.in ()); - policy_list [1] = - PortableServer::IdAssignmentPolicy::_duplicate (assignpolicy.in ()); - - // @@ Pradeep: is it possible to use a more meaningful name? - - // Create the child POA. - PortableServer::POA_var poa_ret = poa->create_POA (child_poa_name, - manager.in (), - policy_list - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (PortableServer::POA::_nil()); - - idpolicy->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (PortableServer::POA::_nil()); - - assignpolicy->destroy (); - ACE_CHECK_RETURN (PortableServer::POA::_nil()); - - return poa_ret._retn (); -} - -PortableServer::ObjectId * -TAO_Notify_Default_POA_Factory::long_to_ObjectId (const CORBA::Long id) -{ - // Modified code from string_to_ObjectId .. - // - - CORBA::ULong buffer_size = 4; - - // Create the buffer for the Id - CORBA::Octet *buffer = PortableServer::ObjectId::allocbuf (buffer_size); - - // Copy the contents - ACE_OS::memcpy (buffer, (char*)&id, buffer_size); - - // @@ Pradeep: TAO guarantees that Long is 4 bytes wide, but the - // standard only guarantees that it is at least 4 bytes wide. You - // may want to think about that.... - - // Create and return a new ID - PortableServer::ObjectId *obj_id = 0; - ACE_NEW_RETURN (obj_id, - PortableServer::ObjectId (buffer_size, - buffer_size, - buffer, - 1), - 0); - - return obj_id; -} - -CORBA::Object_ptr -TAO_Notify_Default_POA_Factory::activate_object_with_id (CORBA::Long id, PortableServer::POA_ptr poa, PortableServer::Servant servant ACE_ENV_ARG_DECL) -{ - // Convert CORBA::Long to ObjectId - PortableServer::ObjectId_var oid = - this->long_to_ObjectId (id); - - poa->activate_object_with_id (oid.in (), - servant - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (CORBA::Object::_nil ()); - - return poa->id_to_reference (oid.in () - ACE_ENV_ARG_PARAMETER); -} - -CORBA::Object_ptr -TAO_Notify_Default_POA_Factory::activate_object (PortableServer::POA_ptr poa, PortableServer::Servant servant ACE_ENV_ARG_DECL) -{ - PortableServer::ObjectId_var oid = poa->activate_object (servant ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (CORBA::Object::_nil ()); - - return poa->id_to_reference (oid.in () ACE_ENV_ARG_PARAMETER); -} - -CORBA::Object_ptr -TAO_Notify_Default_POA_Factory::servant_to_reference (PortableServer::POA_ptr poa, PortableServer::Servant servant ACE_ENV_ARG_DECL) -{ - PortableServer::ObjectId_var oid = poa->servant_to_id (servant ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (CORBA::Object::_nil ()); - - return poa->id_to_reference (oid.in () ACE_ENV_ARG_PARAMETER); -} - -CORBA::Object_ptr -TAO_Notify_Default_POA_Factory::id_to_reference (CORBA::Long id, PortableServer::POA_ptr poa ACE_ENV_ARG_DECL) -{ - // Convert CORBA::Long to ObjectId - PortableServer::ObjectId_var oid = - this->long_to_ObjectId (id); - - return poa->id_to_reference (oid.in () - ACE_ENV_ARG_PARAMETER); -} - -void -TAO_Notify_Default_POA_Factory::destroy_POA (PortableServer::POA_ptr poa ACE_ENV_ARG_DECL) -{ - if (!CORBA::is_nil (poa)) - poa->destroy (1,0 ACE_ENV_ARG_PARAMETER); - // The flag causes a deadlock when destroying the POA - // because we are involved in an upcall. - // TODO:I have to think about what the implications of not waiting are. -} - -void -TAO_Notify_Default_POA_Factory::deactivate_object (CORBA::Object_ptr obj, PortableServer::POA_ptr poa ACE_ENV_ARG_DECL) -{ - if (CORBA::is_nil (poa) || CORBA::is_nil (obj)) - return; - - PortableServer::ObjectId_var id = - poa->reference_to_id (obj ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - poa->deactivate_object (id.in () ACE_ENV_ARG_PARAMETER); - ACE_CHECK; -} - -void -TAO_Notify_Default_POA_Factory::deactivate_object (PortableServer::Servant servant, PortableServer::POA_ptr poa ACE_ENV_ARG_DECL) -{ - if (CORBA::is_nil (poa) || servant == 0) - return; - - PortableServer::ObjectId_var id = - poa->servant_to_id (servant ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - poa->deactivate_object (id.in () ACE_ENV_ARG_PARAMETER); - ACE_CHECK; -} - -// **************************************************************** - -ACE_STATIC_SVC_DEFINE (TAO_Notify_Default_POA_Factory, - ACE_TEXT (TAO_NOTIFY_DEF_POA_FACTORY_NAME), - ACE_SVC_OBJ_T, - &ACE_SVC_NAME (TAO_Notify_Default_POA_Factory), - ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ, - 0) -ACE_FACTORY_DEFINE (TAO_Notify, TAO_Notify_Default_POA_Factory) - -// **************************************************************** diff --git a/TAO/orbsvcs/orbsvcs/Notify/Notify_Default_POA_Factory.h b/TAO/orbsvcs/orbsvcs/Notify/Notify_Default_POA_Factory.h index 3a2237d603c..c2dc512c414 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Notify_Default_POA_Factory.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Notify_Default_POA_Factory.h @@ -5,9 +5,6 @@ * * $Id$ * - * Default factory for POA objects. - * - * * @author Pradeep Gore */ //============================================================================= @@ -17,7 +14,7 @@ #define TAO_NOTIFY_DEFAULT_POA_FACTORY_H #include "ace/pre.h" -#include "Notify_POA_Factory.h" +#include "notify_export.h" #if !defined (ACE_LACKS_PRAGMA_ONCE) # pragma once @@ -26,72 +23,15 @@ /** * @class TAO_Notify_Default_POA_Factory * - * @brief Default factory for POA objects. + * @brief Maintained for backward compatibility. */ -class TAO_Notify_Export TAO_Notify_Default_POA_Factory : public TAO_Notify_POA_Factory +class TAO_Notify_Export TAO_Notify_Default_POA_Factory { public: - TAO_Notify_Default_POA_Factory (void); - ~TAO_Notify_Default_POA_Factory (); - /// Helper function to register the default factory into the service /// configurator. static int init_svc (void); - - // = The Service_Object entry points - virtual int init (int argc, ACE_TCHAR* argv[]); - virtual int fini (void); - - /// Create the POA to activate Event Channels in. - PortableServer::POA_ptr create_event_channel_POA (PortableServer::POA_ptr parent_poa ACE_ENV_ARG_DECL); - - /// Create the POA to activate SA's in. - PortableServer::POA_ptr create_supplier_admin_POA (PortableServer::POA_ptr parent_poa, CORBA::Long new_poa_id ACE_ENV_ARG_DECL); - - /// Create the POA to activate CA's in. - PortableServer::POA_ptr create_consumer_admin_POA (PortableServer::POA_ptr parent_poa, CORBA::Long new_poa_id ACE_ENV_ARG_DECL); - - /// Create the POA to activate proxy push consumers in. - PortableServer::POA_ptr create_proxy_pushconsumer_POA (PortableServer::POA_ptr parent_poa, CORBA::Long new_poa_id ACE_ENV_ARG_DECL); - - /// Create the POA to activate proxy push suppliers in. - PortableServer::POA_ptr create_proxy_pushsupplier_POA (PortableServer::POA_ptr parent_poa, CORBA::Long new_poa_id ACE_ENV_ARG_DECL); - - // = Object activation and POA methods - /// Converts to an ObjectId and registers with the POA . - CORBA::Object_ptr activate_object_with_id (CORBA::Long id, PortableServer::POA_ptr poa,PortableServer::Servant servant ACE_ENV_ARG_DECL); - - /// Registers with the POA . - CORBA::Object_ptr activate_object (PortableServer::POA_ptr poa,PortableServer::Servant servant ACE_ENV_ARG_DECL); - - /// Registers with the POA . - CORBA::Object_ptr servant_to_reference (PortableServer::POA_ptr poa,PortableServer::Servant servant ACE_ENV_ARG_DECL); - - /// Look for the Object with id in . - CORBA::Object_ptr id_to_reference (CORBA::Long id, PortableServer::POA_ptr poa ACE_ENV_ARG_DECL); - - /// Destroy the - void destroy_POA (PortableServer::POA_ptr poa ACE_ENV_ARG_DECL); - - /// Deactivate the object. - void deactivate_object (CORBA::Object_ptr obj, PortableServer::POA_ptr poa ACE_ENV_ARG_DECL); - - /// Deactivate the object. - void deactivate_object (PortableServer::Servant servant, PortableServer::POA_ptr ACE_ENV_ARG_DECL); - -protected: - // = Helper methods - - /// Converts a CORBA::Long to an ObjectId - PortableServer::ObjectId* long_to_ObjectId (const CORBA::Long id); - - /// Create the POA with the most generic policies required of our POA's. - PortableServer::POA_ptr create_generic_childPOA_i (const char* child_poa_name, PortableServer::POA_ptr parent_poa ACE_ENV_ARG_DECL); - }; -ACE_STATIC_SVC_DECLARE (TAO_Notify_Default_POA_Factory) -ACE_FACTORY_DECLARE (TAO_Notify,TAO_Notify_Default_POA_Factory) - #include "ace/post.h" #endif /* TAO_NOTIFY_DEFAULT_POA_FACTORY_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Notify_EventChannelFactory_i.cpp b/TAO/orbsvcs/orbsvcs/Notify/Notify_EventChannelFactory_i.cpp index 6e98a60de08..d2c836538e2 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Notify_EventChannelFactory_i.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Notify_EventChannelFactory_i.cpp @@ -1,224 +1,47 @@ // $Id$ #include "Notify_EventChannelFactory_i.h" -#include "Notify_EventChannel_i.h" -#include "Notify_Channel_Objects_Factory.h" -#include "Notify_POA_Factory.h" -#include "Notify_Factory.h" -#include "Notify_FilterFactory_i.h" -#include "Notify_Event.h" -#include "tao/debug.h" - -ACE_RCSID(Notify, Notify_EventChannelFactory_i, "$Id$") - -TAO_Notify_EventChannelFactory_i::TAO_Notify_EventChannelFactory_i (void) -{ -} - -TAO_Notify_EventChannelFactory_i::~TAO_Notify_EventChannelFactory_i (void) -{ - TAO_Notify_Factory::shutdown (); - delete this->lock_; -} +#include "Service.h" +#include "ace/Dynamic_Service.h" +#include "tao/PortableServer/POA.h" +#include "tao/ORB_Core.h" CosNotifyChannelAdmin::EventChannelFactory_ptr TAO_Notify_EventChannelFactory_i::create (PortableServer::POA_ptr default_POA ACE_ENV_ARG_DECL) { - TAO_Notify_EventChannelFactory_i* channelfactory; - ACE_NEW_THROW_EX (channelfactory, - TAO_Notify_EventChannelFactory_i (), - CORBA::NO_MEMORY ()); - ACE_CHECK_RETURN (CosNotifyChannelAdmin::EventChannelFactory::_nil ()); - - PortableServer::ServantBase_var channelfactory_var (channelfactory); - - channelfactory->init_i (default_POA ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (CosNotifyChannelAdmin::EventChannelFactory::_nil ()); - - CORBA::Object_var obj = channelfactory->poa_factory_-> - activate_object (channelfactory->my_POA_.in (), - channelfactory ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (CosNotifyChannelAdmin::EventChannelFactory::_nil ()); - - return CosNotifyChannelAdmin::EventChannelFactory - ::_narrow (obj.in () ACE_ENV_ARG_PARAMETER); -} - -void -TAO_Notify_EventChannelFactory_i::init_i (PortableServer::POA_ptr default_POA ACE_ENV_ARG_DECL) -{ - TAO_Notify_Factory::init (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - this->my_POA_ = PortableServer::POA::_duplicate (default_POA); - - this->channel_objects_factory_ = - TAO_Notify_Factory::get_channel_objects_factory (); - - this->poa_factory_ = TAO_Notify_Factory::get_poa_factory (); - - // The POA that we should activate the Event Channels in. - this->ec_POA_ = this->poa_factory_-> - create_event_channel_POA (this->my_POA_.in () ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - this->lock_ = - this->channel_objects_factory_->create_channel_factory_lock (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK; - - this->default_filter_factory_ = - this->create_default_filter_factory_i (ACE_ENV_SINGLE_ARG_PARAMETER); -} - -CosNotifyChannelAdmin::EventChannelFactory_ptr -TAO_Notify_EventChannelFactory_i::get_ref (ACE_ENV_SINGLE_ARG_DECL) -{ - return CosNotifyChannelAdmin::EventChannelFactory - ::_narrow (this->poa_factory_-> - servant_to_reference (this->my_POA_.in (), this ACE_ENV_ARG_PARAMETER)); -} - -void -TAO_Notify_EventChannelFactory_i::event_channel_destroyed (CosNotifyChannelAdmin::ChannelID channel_id) -{ - this->ec_ids_.put (channel_id); - - if (TAO_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, "event_channel_destroyed %d\n", channel_id)); -} + CosNotifyChannelAdmin::EventChannelFactory_var notify_factory; -void TAO_Notify_EventChannelFactory_i::shutdown (ACE_ENV_SINGLE_ARG_DECL -#if !defined (TAO_HAS_EXCEPTIONS) || defined (ACE_ENV_BKWD_COMPAT) - , -#endif - CORBA::Boolean destroy_children) -{ - if (destroy_children == 1) - { - this->poa_factory_->destroy_POA (this->ec_POA_.in () ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - - this->poa_factory_->deactivate_object(this->default_filter_factory_.in (), - this->my_POA_.in () - ACE_ENV_ARG_PARAMETER); - ACE_CHECK; - } - // Deactivate ourselves. - this->poa_factory_->deactivate_object (this, - this->my_POA_.in () - ACE_ENV_ARG_PARAMETER); -} - -CosNotifyChannelAdmin::EventChannel_ptr -TAO_Notify_EventChannelFactory_i::create_channel(const CosNotification::QoSProperties& initial_qos, - const CosNotification::AdminProperties& initial_admin, - CosNotifyChannelAdmin::ChannelID_out ec_id - ACE_ENV_ARG_DECL - ) - ACE_THROW_SPEC (( - CORBA::SystemException, - CosNotification::UnsupportedQoS, - CosNotification::UnsupportedAdmin - )) -{ - TAO_Notify_EventChannel_i* channel = - this->channel_objects_factory_->create_event_channel (this - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (CosNotifyChannelAdmin::EventChannel::_nil ()); - - PortableServer::ServantBase_var channel_var (channel); + TAO_NS_Service* notify_service = ACE_Dynamic_Service::instance (TAO_NS_COS_NOTIFICATION_SERVICE_NAME); + if (notify_service == 0) { - ACE_GUARD_THROW_EX (ACE_Lock, ace_mon, *this->lock_, - CORBA::INTERNAL ()); - ACE_CHECK_RETURN (CosNotifyChannelAdmin::EventChannel::_nil ()); - - ec_id = this->ec_ids_.get (); - - ACE_DEBUG ((LM_DEBUG, "event_channel created %d\n", ec_id)); + ACE_DEBUG ((LM_DEBUG, "Service not found! check conf. file\n")); + return notify_factory._retn (); } - channel->init (ec_id, initial_qos, initial_admin, this->my_POA_.in (), this->ec_POA_.in () - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (CosNotifyChannelAdmin::EventChannel::_nil ()); - - CORBA::Object_var obj = this->poa_factory_-> - activate_object_with_id (ec_id, this->ec_POA_.in (), channel - ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (CosNotifyChannelAdmin::EventChannel::_nil ()); - - this->ec_ids_.next (); - return CosNotifyChannelAdmin::EventChannel::_narrow (obj.in ()); -} - -CosNotifyChannelAdmin::ChannelIDSeq* -TAO_Notify_EventChannelFactory_i::get_all_channels (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException - )) -{ - ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->lock_, 0); + TAO_POA *poa = default_POA->_tao_poa_downcast(); - return this->ec_ids_.get_sequence (ACE_ENV_SINGLE_ARG_PARAMETER); -} + if (poa == 0) + return notify_factory._retn (); -CosNotifyChannelAdmin::EventChannel_ptr -TAO_Notify_EventChannelFactory_i::get_event_channel (CosNotifyChannelAdmin::ChannelID id ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException, - CosNotifyChannelAdmin::ChannelNotFound - )) -{ - CORBA::Object_var obj; - - ACE_TRY - { - obj = this->poa_factory_->id_to_reference (id, this->ec_POA_.in () - ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY // Translate any exception to "not found" - { - ACE_TRY_THROW (CosNotifyChannelAdmin::ChannelNotFound ()); - } - ACE_ENDTRY; - ACE_CHECK_RETURN (CosNotifyChannelAdmin::EventChannel::_nil ()); - - return CosNotifyChannelAdmin::EventChannel::_narrow (obj.in () ACE_ENV_ARG_PARAMETER); -} - -CosNotifyFilter::FilterFactory_ptr -TAO_Notify_EventChannelFactory_i::create_default_filter_factory_i (ACE_ENV_SINGLE_ARG_DECL) -{ - TAO_Notify_FilterFactory_i* filterfactory = - this->channel_objects_factory_->create_filter_factory (ACE_ENV_SINGLE_ARG_PARAMETER); - ACE_CHECK_RETURN (CosNotifyFilter::FilterFactory::_nil ()); + CORBA::ORB_ptr orb = poa->orb_core ().orb () ; - PortableServer::ServantBase_var filterfactory_var (filterfactory); + notify_service->init (orb ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (notify_factory._retn ()); - // Init goes here. - // ACE_CHECK_RETURN (CosNotifyFilter::FilterFactory::_nil ()); + notify_factory = notify_service->create (default_POA ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (notify_factory._retn ()); - CORBA::Object_var obj = - this->poa_factory_->activate_object (this->my_POA_.in (), - filterfactory ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (CosNotifyFilter::FilterFactory::_nil ()); - - return CosNotifyFilter::FilterFactory::_narrow (obj.in ()); -} - -CosNotifyFilter::FilterFactory_ptr -TAO_Notify_EventChannelFactory_i::get_default_filter_factory (void) -{ - return CosNotifyFilter::FilterFactory:: - _duplicate (this->default_filter_factory_.in ()); + return notify_factory._retn (); } #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) -template class TAO_Notify_ID_Pool_Ex; + +template class ACE_Dynamic_Service; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate TAO_Notify_ID_Pool_Ex + +#pragma instantiate ACE_Dynamic_Service #endif /*ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Notify_EventChannelFactory_i.h b/TAO/orbsvcs/orbsvcs/Notify/Notify_EventChannelFactory_i.h index b3e644f04fe..89bf1bf98c9 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Notify_EventChannelFactory_i.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Notify_EventChannelFactory_i.h @@ -4,7 +4,6 @@ * * $Id$ * - * Implements the CosNotifyChannelAdmin::EventChannelFactory interface. * * @author Pradeep Gore */ @@ -15,7 +14,6 @@ #define NOTIFY_EVENTCHANNELFACTORY_I_H #include "ace/pre.h" -#include "Notify_ID_Pool_T.h" #include "orbsvcs/CosNotifyChannelAdminS.h" #include "notify_export.h" @@ -23,133 +21,19 @@ #pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#if defined(_MSC_VER) -#if (_MSC_VER >= 1200) -#pragma warning(push) -#endif /* _MSC_VER >= 1200 */ -#pragma warning(disable:4250) -#endif /* _MSC_VER */ - -class TAO_Notify_CO_Factory; -class TAO_Notify_POA_Factory; - -// @@ Pradeep: here is a crazy idea: some people may want to create -// event channels as separate processes, for protection purposes. You -// may need to strategize this class to be able to do so... You could -// probably use the ImplRepo or something similar to make that work -// portably. I don't mean that you should do that right now, but -// consider it in your design. - /** * @class TAO_Notify_EventChannelFactory_i * - * @brief The EventChannelFactory_i creates Event Channel objects and asigns - * IDs to it. + * @brief Class maintained for Backward compatibility. * - * It also has methods to get a previously created channel based on its - * ID. */ class TAO_Notify_Export TAO_Notify_EventChannelFactory_i - : public virtual POA_CosNotifyChannelAdmin::EventChannelFactory - , public virtual PortableServer::RefCountServantBase { public: - /// Destructor - virtual ~TAO_Notify_EventChannelFactory_i (void); - /// Create a factory servant and activates it with the default POA. /// Also creates a resource factory and assigns it this default_POA. static CosNotifyChannelAdmin::EventChannelFactory_ptr create (PortableServer::POA_ptr default_POA ACE_ENV_ARG_DECL); - - /// Get the CORBA object. - CosNotifyChannelAdmin::EventChannelFactory_ptr get_ref (ACE_ENV_SINGLE_ARG_DECL); - - /** - * Destroy the factory - * By default, the factory's lifetime is not coupled with its creations - * Setting the flag to 'true' will destory all event_channels that were created by this factory. - */ - void shutdown (ACE_ENV_SINGLE_ARG_DECL -#if !defined (TAO_HAS_EXCEPTIONS) || defined (ACE_ENV_BKWD_COMPAT) - , // This is ugly -- destroy_children should come BEFORE the env arg. -#endif - CORBA::Boolean destroy_children = 0); - - /// Called by child EC's when they're about to go away. - void event_channel_destroyed (CosNotifyChannelAdmin::ChannelID channel_id); - - // = Accesors - /// Accesor for the default filter factory shared by all EC's. - CosNotifyFilter::FilterFactory_ptr get_default_filter_factory (void); - - // = CosNotifyChannelAdmin::EventChannelFactory methods. - virtual CosNotifyChannelAdmin::EventChannel_ptr create_channel ( - const CosNotification::QoSProperties & initial_qos, - const CosNotification::AdminProperties & initial_admin, - CosNotifyChannelAdmin::ChannelID_out id - ACE_ENV_ARG_DECL - ) - ACE_THROW_SPEC (( - CORBA::SystemException, - CosNotification::UnsupportedQoS, - CosNotification::UnsupportedAdmin - )); - - virtual CosNotifyChannelAdmin::ChannelIDSeq * get_all_channels ( - ACE_ENV_SINGLE_ARG_DECL - ) - ACE_THROW_SPEC (( - CORBA::SystemException - )); - - virtual CosNotifyChannelAdmin::EventChannel_ptr get_event_channel ( - CosNotifyChannelAdmin::ChannelID id - ACE_ENV_ARG_DECL - ) - ACE_THROW_SPEC (( - CORBA::SystemException, - CosNotifyChannelAdmin::ChannelNotFound - )); - - protected: - /// Constructor - TAO_Notify_EventChannelFactory_i (void); - - /// Initializes this object. - void init_i (PortableServer::POA_ptr default_POA ACE_ENV_ARG_DECL); - - /// Create the default filter factory. - CosNotifyFilter::FilterFactory_ptr create_default_filter_factory_i (ACE_ENV_SINGLE_ARG_DECL); - - // = Data members - /// The factory for channel objects. - TAO_Notify_CO_Factory* channel_objects_factory_; - - /// The factory for POA based containers. - TAO_Notify_POA_Factory* poa_factory_; - - /// The POA in which we live. - /// Filter objects and COS EC style proxys live here too. - PortableServer::POA_var my_POA_; - - /// The POA in which we should activate EC's in. - /// We create and own this. - PortableServer::POA_var ec_POA_; - - /// Id generator for event channels - TAO_Notify_ID_Pool_Ex ec_ids_; - - /// The locking strategy. - ACE_Lock* lock_; - - /// The default filter factory. - CosNotifyFilter::FilterFactory_var default_filter_factory_; }; -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -#pragma warning(pop) -#endif /* _MSC_VER */ - #include "ace/post.h" #endif /* NOTIFY_EVENTCHANNELFACTORY_I_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Object.cpp b/TAO/orbsvcs/orbsvcs/Notify/Object.cpp index 58794b6bc6d..825f6ab6075 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Object.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Object.cpp @@ -1,11 +1,12 @@ // $Id$ #include "Object.h" -#include "Properties.h" -#include "Factory.h" #include "POA_Helper.h" #include "Worker_Task.h" -#include "QoSAdmin.h" +#include "Properties.h" +#include "Builder.h" +#include "ThreadPool_Task.h" +#include "Reactive_Task.h" #include "tao/debug.h" #if ! defined (__ACE_INLINE__) @@ -15,64 +16,139 @@ ACE_RCSID(RT_Notify, TAO_NS_Object, "$Id$") TAO_NS_Object::TAO_NS_Object (void) - :event_manager_ (0), qos_admin_ (0), id_ (0), poa_ (0), worker_task_ (0), delete_worker_task_ (0) + : event_manager_ (0) + , admin_properties_ (0) + , id_ (0) + , poa_ (0) + , proxy_poa_ (0) + , own_proxy_poa_ (0) + , object_poa_ (0) + , own_object_poa_ (0) + , worker_task_ (0) + , own_worker_task_ (0) + , shutdown_ (0) { - if (TAO_debug_level > 1 ) + if (TAO_debug_level > 2 ) ACE_DEBUG ((LM_DEBUG,"object:%x created\n", this )); } TAO_NS_Object::~TAO_NS_Object () { - if (TAO_debug_level > 1 ) + if (TAO_debug_level > 2 ) ACE_DEBUG ((LM_DEBUG,"object:%x destroyed\n", this )); - - this->shutdown_worker_task (); - - delete qos_admin_; } void -TAO_NS_Object::init (TAO_NS_POA_Helper* poa, TAO_NS_Worker_Task* worker_task ACE_ENV_ARG_DECL) +TAO_NS_Object::init (TAO_NS_Object* parent) { - poa_ = poa; - worker_task_ = worker_task; + this->event_manager_ = parent->event_manager_; + this->admin_properties_ = parent->admin_properties_; - TAO_NS_Factory* factory = TAO_NS_PROPERTIES::instance ()->factory (); - factory->create (this->qos_admin_ ACE_ENV_ARG_PARAMETER); + this->poa_ = parent->poa_; + this->object_poa_ = parent->object_poa_; + this->proxy_poa_ = parent->proxy_poa_; + this->worker_task_ = parent->worker_task_; + + if (this->worker_task_) + this->worker_task_->_incr_refcnt (); + + // Pass QoS + parent->qos_properties_.transfer (this->qos_properties_); + this->qos_changed (this->qos_properties_); } CORBA::Object_ptr -TAO_NS_Object::activate (ACE_ENV_SINGLE_ARG_DECL) +TAO_NS_Object::activate (PortableServer::Servant servant ACE_ENV_ARG_DECL) { - return poa_->activate (this->servant (), id_ ACE_ENV_ARG_PARAMETER); + return this->poa_->activate (servant, this->id_ ACE_ENV_ARG_PARAMETER); } void TAO_NS_Object::deactivate (ACE_ENV_SINGLE_ARG_DECL) { - poa_->deactivate (id_ ACE_ENV_ARG_PARAMETER); + this->poa_->deactivate (this->id_ ACE_ENV_ARG_PARAMETER); } -void +int TAO_NS_Object::shutdown (ACE_ENV_SINGLE_ARG_DECL) { + { + ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->lock_, 1); + + if (this->shutdown_ == 1) + return 1; // Another thread has already run shutdown. + + this->shutdown_ = 1; + } + this->deactivate (ACE_ENV_SINGLE_ARG_PARAMETER); + + this->shutdown_worker_task (); + this->shutdown_proxy_poa (); + + return 0; } CORBA::Object_ptr TAO_NS_Object::ref (ACE_ENV_SINGLE_ARG_DECL) { - return poa_->id_to_reference (id_ ACE_ENV_ARG_PARAMETER); + return this->poa_->id_to_reference (this->id_ ACE_ENV_ARG_PARAMETER); } void TAO_NS_Object::shutdown_worker_task (void) { - /// Only do this if we are the owner. - if (delete_worker_task_ == 1) + // Only do this if we are the owner. + if (this->own_worker_task_ == 1) + { + this->worker_task_->shutdown (); // the worker deletes itself when its hook is eventually called. + } + + if (this->worker_task_) + this->worker_task_->_decr_refcnt (); +} + +void +TAO_NS_Object::shutdown_proxy_poa (void) +{ + if (this->own_proxy_poa_ == 1) { - this->worker_task_->shutdown (); - delete this->worker_task_; + ACE_TRY_NEW_ENV + { + this->proxy_poa_->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + delete this->proxy_poa_; + } + ACE_CATCHANY + { + if (TAO_debug_level > 2) + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "Proxy shutdown error (%P|%t)\n"); + } + ACE_ENDTRY; + } +} + +void +TAO_NS_Object::shutdown_object_poa (void) +{ + if (this->own_object_poa_ == 1) + { + ACE_TRY_NEW_ENV + { + this->object_poa_->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + delete this->object_poa_; + } + ACE_CATCHANY + { + if (TAO_debug_level > 2) + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "Proxy shutdown error (%P|%t)\n"); + } + ACE_ENDTRY; } } @@ -81,17 +157,109 @@ TAO_NS_Object::worker_task_own (TAO_NS_Worker_Task* worker_task) { this->worker_task (worker_task); - /// claim ownership. - delete_worker_task_ = 1; + // claim ownership. + this->own_worker_task_ = 1; } void TAO_NS_Object::worker_task (TAO_NS_Worker_Task* worker_task) { - /// shutdown the current worker. + // shutdown the current worker. this->shutdown_worker_task (); this->worker_task_ = worker_task; - delete_worker_task_ = 0; + this->own_worker_task_ = 0; + + if (this->worker_task_) + this->worker_task_->_incr_refcnt (); +} + +void +TAO_NS_Object::proxy_poa_own (TAO_NS_POA_Helper* proxy_poa) +{ + // shutdown current proxy poa. + this->shutdown_proxy_poa (); + + this->proxy_poa_ = proxy_poa; + + // claim ownership. + own_proxy_poa_ = 1; +} + +void +TAO_NS_Object::object_poa_own (TAO_NS_POA_Helper* object_poa) +{ + // shutdown current object poa. + this->shutdown_object_poa (); + + // shutdown current object poa + this->object_poa_ = object_poa; + + // claim ownership. + this->own_object_poa_ = 1; +} + +void +TAO_NS_Object::set_qos (const CosNotification::QoSProperties & qos ACE_ENV_ARG_DECL) +{ + CosNotification::PropertyErrorSeq err_seq; + + TAO_NS_QoSProperties new_qos_properties; + + if (new_qos_properties.init (qos, err_seq) == -1) + ACE_THROW (CORBA::INTERNAL ()); + + // Apply the appropriate concurrency QoS + if (new_qos_properties.thread_pool ().is_valid ()) + { + if (new_qos_properties.thread_pool ().value ().static_threads == 0) + TAO_NS_PROPERTIES::instance()->builder()->apply_reactive_concurrency (*this ACE_ENV_ARG_PARAMETER); + else + TAO_NS_PROPERTIES::instance()->builder()-> + apply_thread_pool_concurrency (*this, new_qos_properties.thread_pool ().value () ACE_ENV_ARG_PARAMETER); + } + else if (new_qos_properties.thread_pool_lane ().is_valid ()) + TAO_NS_PROPERTIES::instance()->builder()-> + apply_lane_concurrency (*this, new_qos_properties.thread_pool_lane ().value () ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + // Update the Thread Task's QoS properties.. + this->worker_task_->update_qos_properties (new_qos_properties); + + // Inform subclasses of QoS changed. + this->qos_changed (new_qos_properties); + + // Init the the overall QoS on this object. + if (new_qos_properties.copy (this->qos_properties_) == -1) + ACE_THROW (CORBA::INTERNAL ()); + + if (err_seq.length () > 0) // Unsupported Property + ACE_THROW (CosNotification::UnsupportedQoS (err_seq)); +} + +CosNotification::QoSProperties* +TAO_NS_Object::get_qos (ACE_ENV_SINGLE_ARG_DECL) +{ + CosNotification::QoSProperties_var properties; + + ACE_NEW_THROW_EX (properties, + CosNotification::QoSProperties (), + CORBA::NO_MEMORY ()); + + this->qos_properties_.populate (properties); + + return properties._retn (); +} + +void +TAO_NS_Object::qos_changed (const TAO_NS_QoSProperties& /*qos_properties*/) +{ + // NOP. +} + +TAO_NS_Timer* +TAO_NS_Object::timer (void) +{ + return this->worker_task_->timer (); } diff --git a/TAO/orbsvcs/orbsvcs/Notify/Object.h b/TAO/orbsvcs/orbsvcs/Notify/Object.h index 211e10e84fa..43c2906996b 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Object.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Object.h @@ -19,16 +19,16 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#include "tao/corba.h" #include "tao/PortableServer/Servant_Base.h" -#include "Types.h" -#include "PropertySeq.h" +#include "orbsvcs/NotifyExtC.h" +#include "QoSProperties.h" +#include "AdminProperties.h" +#include "Refcountable.h" class TAO_NS_POA_Helper; class TAO_NS_Worker_Task; -class TAO_NS_QoSAdmin; class TAO_NS_Event_Manager; -class TAO_NS_AdminProperties; +class TAO_NS_Timer; /** * @class TAO_NS_Object @@ -36,29 +36,31 @@ class TAO_NS_AdminProperties; * @brief Base Object for RT_Notify's CORBA Objects. * */ -class TAO_Notify_Export TAO_NS_Object +class TAO_Notify_Export TAO_NS_Object : public TAO_NS_Refcountable { + friend class TAO_NS_Builder; + public: + /// Id for Objects. + typedef CORBA::Long ID; + /// Constuctor TAO_NS_Object (void); /// Destructor virtual ~TAO_NS_Object (void); - /// Init. - void init (TAO_NS_POA_Helper* poa, TAO_NS_Worker_Task* worker_task ACE_ENV_ARG_DECL); - /// This Object's ID - CORBA::Long id (void); + ID id (void); /// Activate - CORBA::Object_ptr activate (ACE_ENV_SINGLE_ARG_DECL); + virtual CORBA::Object_ptr activate (PortableServer::Servant servant ACE_ENV_ARG_DECL); /// Deactivate void deactivate (ACE_ENV_SINGLE_ARG_DECL); - /// shutdown - virtual void shutdown (ACE_ENV_SINGLE_ARG_DECL); + /// Have we been shutdown. returns 1 if shutdown. + int has_shutdown (void); /// Get CORBA Ref. CORBA::Object_ptr ref (ACE_ENV_SINGLE_ARG_DECL); @@ -69,46 +71,89 @@ public: /// Get the POA assigned to us. TAO_NS_POA_Helper* poa (void); + /// Setting the proxy_poa_ gives ownership to this class. + void proxy_poa_own (TAO_NS_POA_Helper* proxy_poa); + + /// Accessor for the proxy_poa_ + TAO_NS_POA_Helper* proxy_poa (void); + + /// Setting the object_poa_ gives ownership to this class. + void object_poa_own (TAO_NS_POA_Helper* object_poa); + + /// Accessor for the object_poa_ + TAO_NS_POA_Helper* object_poa (void); + /// Set Worker Task. This object assume ownership of the set object. void worker_task_own (TAO_NS_Worker_Task* worker_task); /// Set Worker Task. Does not assume ownership. void worker_task (TAO_NS_Worker_Task* worker_task); + /// Set the QoS Properties. + virtual void set_qos (const CosNotification::QoSProperties & qos ACE_ENV_ARG_DECL); + + /// Get the QoS Properties. + CosNotification::QoSProperties* get_qos (ACE_ENV_SINGLE_ARG_DECL); + + /// Obtain the Timer manager associated with this object. + virtual TAO_NS_Timer* timer (void); + + /// shutdown. Returns 1 ifif the shutdown was already run once before. + virtual int shutdown (ACE_ENV_SINGLE_ARG_DECL); + protected: - /// Servant which we use. - virtual PortableServer::Servant servant (void) = 0; + /// Init this object with data from . + void init (TAO_NS_Object* parent); /// Shutdown the current worker task and delete it if we own it. void shutdown_worker_task (void); + /// Shutdown the current proxy poa. + void shutdown_proxy_poa (void); + + /// Shutdown the current object poa. + void shutdown_object_poa (void); + + /// Notification that can be overridden by subclasses to be informed that have been modified. + virtual void qos_changed (const TAO_NS_QoSProperties& qos_properties); + ///= Protected data members. /// The event manager. TAO_NS_Event_Manager* event_manager_; - /// Administer Qos functionality. - TAO_NS_QoSAdmin* qos_admin_; - - ///=Attributes - /// Admin Properties. - TAO_NS_AdminProperties* admin_properties_; + TAO_NS_AdminProperties_var admin_properties_; /// QoS Properties. - TAO_NS_PropertySeq qos_properties_; + TAO_NS_QoSProperties qos_properties_; /// Id assigned to this object - TAO_NS_Object_Id id_; + ID id_; /// The POA in which the object is activated. TAO_NS_POA_Helper* poa_; + /// The POA in which the proxys are activated. + TAO_NS_POA_Helper* proxy_poa_; + + /// Flag that indicates if we own + int own_proxy_poa_; + + /// The POA in which the object's children are activated. + TAO_NS_POA_Helper* object_poa_; + + /// Flag that indicates if we own + int own_object_poa_; + /// Worker Task. TAO_NS_Worker_Task* worker_task_; /// Ownership flag - int delete_worker_task_; + int own_worker_task_; + + /// Are we shutdown (i,e. scheduled for destroy). + int shutdown_; }; #if defined (__ACE_INLINE__) diff --git a/TAO/orbsvcs/orbsvcs/Notify/Object.inl b/TAO/orbsvcs/orbsvcs/Notify/Object.inl index 6e46813987e..251c0655e6d 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Object.inl +++ b/TAO/orbsvcs/orbsvcs/Notify/Object.inl @@ -1,7 +1,5 @@ // $Id$ -#include "Object.h" - ACE_INLINE CORBA::Long TAO_NS_Object::id (void) { @@ -19,3 +17,21 @@ TAO_NS_Object::poa (void) { return this->poa_; } + +ACE_INLINE TAO_NS_POA_Helper* +TAO_NS_Object::object_poa (void) +{ + return this->object_poa_; +} + +ACE_INLINE TAO_NS_POA_Helper* +TAO_NS_Object::proxy_poa (void) +{ + return this->proxy_poa_; +} + +ACE_INLINE int +TAO_NS_Object::has_shutdown (void) +{ + return this->shutdown_; +} diff --git a/TAO/orbsvcs/orbsvcs/Notify/POA_Helper.cpp b/TAO/orbsvcs/orbsvcs/Notify/POA_Helper.cpp index 8d475b3cbeb..36b950eec2b 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/POA_Helper.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/POA_Helper.cpp @@ -25,7 +25,7 @@ TAO_NS_POA_Helper::init (PortableServer::POA_ptr parent_poa, const char* poa_nam CORBA::PolicyList policy_list (2); this->set_policy (parent_poa, policy_list ACE_ENV_ARG_PARAMETER); - ACE_CHECK_RETURN (0); + ACE_CHECK; this->create_i (parent_poa, poa_name, policy_list ACE_ENV_ARG_PARAMETER); } @@ -39,7 +39,6 @@ TAO_NS_POA_Helper::init (PortableServer::POA_ptr parent_poa ACE_ENV_ARG_DECL) this->init (parent_poa, child_poa_name ACE_ENV_ARG_PARAMETER); } - void TAO_NS_POA_Helper::set_policy (PortableServer::POA_ptr parent_poa, CORBA::PolicyList &policy_list ACE_ENV_ARG_DECL) { @@ -151,7 +150,8 @@ TAO_NS_POA_Helper::id_to_reference (CORBA::Long id ACE_ENV_ARG_DECL) const { // Convert CORBA::Long to ObjectId PortableServer::ObjectId_var oid = - this->long_to_ObjectId (id); + this->long_to_ObjectId (id ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (CORBA::Object::_nil ()); return poa_->id_to_reference (oid.in () ACE_ENV_ARG_PARAMETER); diff --git a/TAO/orbsvcs/orbsvcs/Notify/POA_Helper.h b/TAO/orbsvcs/orbsvcs/Notify/POA_Helper.h index 0839ec78897..122286482f3 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/POA_Helper.h +++ b/TAO/orbsvcs/orbsvcs/Notify/POA_Helper.h @@ -1,6 +1,6 @@ /* -*- C++ -*- */ /** - * @file POA.h + * @file POA_Helper.h * * $Id$ * @@ -77,7 +77,7 @@ protected: }; #if defined (__ACE_INLINE__) -#include "POA.inl" +#include "POA_Helper.inl" #endif /* __ACE_INLINE__ */ #include "ace/post.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/POA_Helper.inl b/TAO/orbsvcs/orbsvcs/Notify/POA_Helper.inl index 0e1d6d3f893..3fc996c803c 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/POA_Helper.inl +++ b/TAO/orbsvcs/orbsvcs/Notify/POA_Helper.inl @@ -1,9 +1,7 @@ // $Id$ -#include "POA_Helper.h" - ACE_INLINE PortableServer::POA_ptr TAO_NS_POA_Helper::poa (void) { return this->poa_.in (); -} +} diff --git a/TAO/orbsvcs/orbsvcs/Notify/Peer.cpp b/TAO/orbsvcs/orbsvcs/Notify/Peer.cpp index c091c3289cd..4a26d732d85 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Peer.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Peer.cpp @@ -9,7 +9,7 @@ ACE_RCSID(Notify, TAO_NS_Peer, "$id$") #include "tao/debug.h" -#include "Dispatch_Observer_T.h" +#include "Proxy.h" TAO_NS_Peer::TAO_NS_Peer (void) { @@ -20,73 +20,92 @@ TAO_NS_Peer::~TAO_NS_Peer () } void -TAO_NS_Peer::type_added (const TAO_NS_EventType& added) +TAO_NS_Peer::qos_changed (const TAO_NS_QoSProperties& /*qos_properties*/) { - ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->lock_); - this->added_.insert (added); - this->removed_.remove (added); + // NOP. } void -TAO_NS_Peer::type_removed (const TAO_NS_EventType& removed) +TAO_NS_Peer::shutdown (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) { - ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->lock_); - this->removed_.insert (removed); - this->added_.remove (removed); + // NOP. } void -TAO_NS_Peer::dispatch_pending (ACE_ENV_SINGLE_ARG_DECL) +TAO_NS_Peer::handle_dispatch_exception (ACE_ENV_SINGLE_ARG_DECL) { - if (this->added_.size () == 0 && this->removed_.size () == 0) - return; // Return if nothing to send. - - TAO_NS_EventTypeSeq added_copy; - TAO_NS_EventTypeSeq removed_copy; - TAO_NS_Reverse_Lock unlock (this->lock_); - - ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->lock_); + // Sever all association when a remote client misbehaves. Other strategies like reties are possible but not implemented. + this->proxy ()->destroy (ACE_ENV_SINGLE_ARG_PARAMETER); +} - added_copy = this->added_; - removed_copy = this->removed_; - this->added_.reset (); - this->removed_.reset (); +void +TAO_NS_Peer::dispatch_updates (const TAO_NS_EventTypeSeq & added, const TAO_NS_EventTypeSeq & removed ACE_ENV_ARG_DECL) +{ + TAO_NS_EventTypeSeq subscribed_types ; + this->proxy ()->subscribed_types (subscribed_types ACE_ENV_ARG_PARAMETER); + ACE_CHECK; ACE_TRY { - { - ACE_GUARD (TAO_NS_Reverse_Lock, ace_mon, unlock); + CosNotification::EventTypeSeq cos_added; + CosNotification::EventTypeSeq cos_removed; - this->dispatch_updates_i (added_copy, removed_copy ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; + const TAO_NS_EventType& special = TAO_NS_EventType::special (); - if (this->updates_dispatch_observer_ != 0) - this->updates_dispatch_observer_->dispatch_success (this ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } + // Don;t inform of types that we already know about. + // E.g. if we're subscribed for {A,B,C,F} + // and we receive an update with added list {A,B,G} + // then, we should only send {G} because peer already knows about {A, B} + // However if we're subscribed for everything, send all kinds of adds. - this->retry_count_ = 0; - } - ACE_CATCHANY - { - if (TAO_debug_level > 0) + // Don;t inform of removed types that we don;t care about. + // e.g. if we're currently subscribed for {A,B,C,F} + // and we receive an update with removed list {A, B, D} + // then, we should only send {A,B} because the peer is not interested in D. + // However if we're subscribed for everything, send all kinds of removes. + + TAO_NS_EventTypeSeq added_result = added; + TAO_NS_EventTypeSeq removed_result; + + if (subscribed_types.find (special) != 0) + { + added_result.remove_seq (subscribed_types); + removed_result.intersection (subscribed_types, removed); + } + else { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Peer:dispatch_pending serror sending updates\n "); + removed_result = removed; } - //ACE_RE_THROW; - ++this->retry_count_; + added_result.populate_no_special (cos_added); + removed_result.populate_no_special (cos_removed); - if (this->updates_dispatch_observer_ != 0) + if (cos_added.length () != 0 || cos_removed.length () != 0) { - /// Restore the lists. - this->added_.insert_seq (added_copy); - this->removed_.insert_seq (removed_copy); - - ACE_GUARD (TAO_NS_Reverse_Lock, ace_mon, unlock); + TAO_NS_Refcountable_Guard ref_guard(*this->proxy ()); // Protect this object from being destroyed in this scope. - this->updates_dispatch_observer_->dispatch_failure (this, this->retry_count_ ACE_ENV_ARG_PARAMETER); + this->dispatch_updates_i (cos_added, cos_removed ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; } } + ACE_CATCH (CORBA::OBJECT_NOT_EXIST, not_exist) + { + this->handle_dispatch_exception (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + } + ACE_CATCH (CORBA::NO_IMPLEMENT, no_impl) + { + // The peer does not implement the offer/subscription_change method + // Do nothing. Later, perhaps set a flag that helps us decide if we should dispatch_updates_i. + } + ACE_CATCH (CORBA::SystemException, sysex) + { + this->handle_dispatch_exception (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + } + ACE_CATCHANY + { + // Do nothing + } ACE_ENDTRY; } diff --git a/TAO/orbsvcs/orbsvcs/Notify/Peer.h b/TAO/orbsvcs/orbsvcs/Notify/Peer.h index 23d1844bf03..13dd08e5ab2 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Peer.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Peer.h @@ -21,7 +21,10 @@ #include "orbsvcs/CosNotificationC.h" #include "EventTypeSeq.h" -#include "Types.h" + +class TAO_NS_Proxy; +class TAO_NS_QoSProperties; +class TAO_NS_Peer; /** * @class TAO_NS_Peer @@ -37,50 +40,37 @@ public: TAO_NS_Peer (void); /// Destructor - ~TAO_NS_Peer (); - - void updates_dispatch_observer (TAO_NS_Updates_Dispatch_Observer* updates_dispatch_observer); - - /// Access Proxy. - virtual TAO_NS_Proxy* proxy (void) = 0; + virtual ~TAO_NS_Peer (); /// This method sigantures deliberately match the RefCounting methods required for ESF Proxy CORBA::ULong _incr_refcnt (void); CORBA::ULong _decr_refcnt (void); - ///=Subscription change - - /// Subscription type added - void type_added (const TAO_NS_EventType& added); + /// Release + virtual void release (void) = 0; - /// Subscription type removed - void type_removed (const TAO_NS_EventType& removed); + /// Shutdown the peer. + virtual void shutdown (ACE_ENV_SINGLE_ARG_DECL); - /// Dispatch Pending. - void dispatch_pending (ACE_ENV_SINGLE_ARG_DECL); - -protected: - // Dispatch updates implementation. - virtual void dispatch_updates_i (const TAO_NS_EventTypeSeq & added, - const TAO_NS_EventTypeSeq & removed - ACE_ENV_ARG_DECL) = 0; - - ///= Data Members - - /// The mutex to serialize access to state variables. - TAO_SYNCH_MUTEX lock_; + /// Access Proxy. + virtual TAO_NS_Proxy* proxy (void) = 0; - /// Types added. - TAO_NS_EventTypeSeq added_; + // Dispatch updates + virtual void dispatch_updates (const TAO_NS_EventTypeSeq & added, + const TAO_NS_EventTypeSeq & removed + ACE_ENV_ARG_DECL); - /// Types removed. - TAO_NS_EventTypeSeq removed_; + /// QoS changed notification from the Peer. + virtual void qos_changed (const TAO_NS_QoSProperties& qos_properties); - // Updates Dispatch Observer - TAO_NS_Updates_Dispatch_Observer* updates_dispatch_observer_; + /// Handle dispatch exceptions. + void handle_dispatch_exception (ACE_ENV_SINGLE_ARG_DECL); - /// Retry count. How many times have we failed to contact the remote peer? - int retry_count_; +protected: + /// Implementation of Peer specific dispatch_updates + virtual void dispatch_updates_i (const CosNotification::EventTypeSeq& added, + const CosNotification::EventTypeSeq& removed + ACE_ENV_ARG_DECL) = 0; }; #if defined (__ACE_INLINE__) diff --git a/TAO/orbsvcs/orbsvcs/Notify/Peer.inl b/TAO/orbsvcs/orbsvcs/Notify/Peer.inl index fb50a661dda..9fc05856b37 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Peer.inl +++ b/TAO/orbsvcs/orbsvcs/Notify/Peer.inl @@ -1,23 +1,15 @@ // $Id$ -#include "Peer.h" #include "Proxy.h" -CORBA::ULong +ACE_INLINE CORBA::ULong TAO_NS_Peer::_incr_refcnt (void) { return this->proxy ()->_incr_refcnt (); } -CORBA::ULong +ACE_INLINE CORBA::ULong TAO_NS_Peer::_decr_refcnt (void) { return this->proxy ()->_decr_refcnt (); } - - -void -TAO_NS_Peer::updates_dispatch_observer (TAO_NS_Updates_Dispatch_Observer* updates_dispatch_observer) -{ - this->updates_dispatch_observer_ = updates_dispatch_observer; -} diff --git a/TAO/orbsvcs/orbsvcs/Notify/Properties.cpp b/TAO/orbsvcs/orbsvcs/Notify/Properties.cpp index 6b0e229a909..421fd42a00a 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Properties.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Properties.cpp @@ -1,6 +1,7 @@ // $Id$ #include "Properties.h" +#include "orbsvcs/NotifyExtC.h" #include "tao/debug.h" #if ! defined (__ACE_INLINE__) @@ -10,12 +11,34 @@ ACE_RCSID(RT_Notify, TAO_NS_Properties, "$Id$") TAO_NS_Properties::TAO_NS_Properties (void) + : factory_ (0) + , builder_ (0) + , thr_sched_policy_ (THR_SCHED_DEFAULT) + , thr_scope_policy_ (THR_SCOPE_PROCESS) + , asynch_updates_ (0) { - //ACE_DEBUG ((LM_DEBUG, "in TAO_Properties ctos %x\n", this)); + // In case no conf. file is specified, the EC will default to reactive concurrency. + NotifyExt::ThreadPoolParams tp_params = + {0, 0, 0, 0, 0, 0, 0 }; + + this->ec_qos_.length (1); + this->ec_qos_[0].name = CORBA::string_dup (NotifyExt::ThreadPool); + this->ec_qos_[0].value <<= tp_params; + + if (TAO_debug_level > 1) + ACE_DEBUG ((LM_DEBUG, "in TAO_Properties ctos %x\n", this)); } TAO_NS_Properties::~TAO_NS_Properties () { } +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) + +template class TAO_Singleton; + +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) + +#pragma instantiate TAO_Singleton +#endif /*ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Properties.h b/TAO/orbsvcs/orbsvcs/Notify/Properties.h index d5d16fe1e5d..4a0a6a03ffc 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Properties.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Properties.h @@ -19,9 +19,10 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#include "ace/Singleton.h" +#include "tao/TAO_Singleton.h" #include "tao/ORB.h" #include "tao/PortableServer/PortableServer.h" +#include "orbsvcs/CosNotificationC.h" class TAO_NS_Factory; class TAO_NS_Builder; @@ -29,19 +30,19 @@ class TAO_NS_Builder; /** * @class TAO_NS_Properties * - * @brief Global properties that strategize RT Notify's run-time behaviour. + * @brief Global properties that strategize Notify's run-time behaviour. * */ class TAO_Notify_Export TAO_NS_Properties { - friend class ACE_Singleton; + friend class TAO_Singleton; public: /// Constuctor TAO_NS_Properties (void); /// Destructor - ~TAO_NS_Properties (); + ~TAO_NS_Properties (); // = Property Accessors TAO_NS_Factory* factory (void); @@ -62,6 +63,39 @@ public: long sched_policy (void); void sched_policy (long sched_policy); + CORBA::Boolean asynch_updates (void); + void asynch_updates (CORBA::Boolean asynch_updates); + + // The QoS Property that must be applied to each newly created Event Channel + const CosNotification::QoSProperties& default_event_channel_qos_properties (void); + + // Set the default EC QoS Property. + void default_event_channel_qos_properties (const CosNotification::QoSProperties &ec_qos); + + // The QoS Property that must be applied to each newly created Supplier Admin + const CosNotification::QoSProperties& default_supplier_admin_qos_properties (void); + + // Set the default SA QoS Property. + void default_supplier_admin_qos_properties (const CosNotification::QoSProperties &sa_qos); + + // The QoS Property that must be applied to each newly created Consumer Admin + const CosNotification::QoSProperties& default_consumer_admin_qos_properties (void); + + // Set the default CA QoS Property. + void default_consumer_admin_qos_properties (const CosNotification::QoSProperties &ca_qos); + + // The QoS Property that must be applied to each newly created Proxy Supplier + const CosNotification::QoSProperties& default_proxy_supplier_qos_properties (void); + + // Set the default PS QoS Property. + void default_proxy_supplier_qos_properties (const CosNotification::QoSProperties &ps_qos); + + // The QoS Property that must be applied to each newly created Proxy Consumer + const CosNotification::QoSProperties& default_proxy_consumer_qos_properties (void); + + // Set the default PC QoS Property. + void default_proxy_consumer_qos_properties (const CosNotification::QoSProperties &pc_qos); + protected: /// Object Factory TAO_NS_Factory* factory_; @@ -71,7 +105,7 @@ protected: /// ORB CORBA::ORB_var orb_; - + // POA PortableServer::POA_var default_poa_; @@ -80,11 +114,32 @@ protected: /// Scope policy long thr_scope_policy_; + + /// True if send asynch updates. + CORBA::Boolean asynch_updates_; + + /// The Update period for updates. + ACE_Time_Value update_period_; + + /// The default EC QoS Properties. + CosNotification::QoSProperties ec_qos_; + + /// The default SA QoS Properties. + CosNotification::QoSProperties sa_qos_; + + /// The default CA QoS Properties. + CosNotification::QoSProperties ca_qos_; + + /// The default PS QoS Properties. + CosNotification::QoSProperties ps_qos_; + + /// The default PC QoS Properties. + CosNotification::QoSProperties pc_qos_; }; -typedef ACE_Singleton TAO_NS_PROPERTIES; +typedef TAO_Singleton TAO_NS_PROPERTIES; -TAO_NOTIFY_SINGLETON_DECLARE (ACE_Singleton, TAO_NS_Properties, TAO_SYNCH_MUTEX); +TAO_NOTIFY_SINGLETON_DECLARE (TAO_Singleton, TAO_NS_Properties, TAO_SYNCH_MUTEX); #if defined (__ACE_INLINE__) #include "Properties.inl" diff --git a/TAO/orbsvcs/orbsvcs/Notify/Properties.inl b/TAO/orbsvcs/orbsvcs/Notify/Properties.inl index 64b9245d23a..a066c3907a5 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Properties.inl +++ b/TAO/orbsvcs/orbsvcs/Notify/Properties.inl @@ -1,7 +1,5 @@ // $Id$ -#include "Properties.h" - ACE_INLINE TAO_NS_Factory* TAO_NS_Properties::factory (void) { @@ -32,7 +30,7 @@ TAO_NS_Properties::orb (void) return CORBA::ORB::_duplicate (orb_.in ()); } -ACE_INLINE void +ACE_INLINE void TAO_NS_Properties::orb (CORBA::ORB_ptr orb) { orb_ = CORBA::ORB::_duplicate (orb); @@ -44,7 +42,7 @@ TAO_NS_Properties::default_poa (void) return PortableServer::POA::_duplicate (this->default_poa_.in ()); } -ACE_INLINE void +ACE_INLINE void TAO_NS_Properties::default_poa (PortableServer::POA_ptr default_poa) { this->default_poa_ = PortableServer::POA::_duplicate (default_poa); @@ -61,7 +59,7 @@ TAO_NS_Properties::scope_policy (long scope_policy) { thr_scope_policy_ = scope_policy; } - + ACE_INLINE long TAO_NS_Properties::sched_policy (void) { @@ -73,3 +71,75 @@ TAO_NS_Properties::sched_policy (long sched_policy) { thr_sched_policy_ = sched_policy; } + +ACE_INLINE CORBA::Boolean +TAO_NS_Properties::asynch_updates (void) +{ + return this->asynch_updates_; +} + +ACE_INLINE void +TAO_NS_Properties::asynch_updates (CORBA::Boolean asynch_updates) +{ + this->asynch_updates_ = asynch_updates; +} + +ACE_INLINE const CosNotification::QoSProperties& +TAO_NS_Properties::default_event_channel_qos_properties (void) +{ + return this->ec_qos_; +} + +ACE_INLINE void +TAO_NS_Properties::default_event_channel_qos_properties (const CosNotification::QoSProperties &ec_qos) +{ + this->ec_qos_ = ec_qos; +} + +ACE_INLINE const CosNotification::QoSProperties& +TAO_NS_Properties::default_supplier_admin_qos_properties (void) +{ + return this->sa_qos_; +} + +ACE_INLINE void +TAO_NS_Properties::default_supplier_admin_qos_properties (const CosNotification::QoSProperties &sa_qos) +{ + this->sa_qos_ = sa_qos; +} + +ACE_INLINE const CosNotification::QoSProperties& +TAO_NS_Properties::default_consumer_admin_qos_properties (void) +{ + return this->ca_qos_; +} + +ACE_INLINE void +TAO_NS_Properties::default_consumer_admin_qos_properties (const CosNotification::QoSProperties &ca_qos) +{ + this->ca_qos_ = ca_qos; +} + +ACE_INLINE const CosNotification::QoSProperties& +TAO_NS_Properties::default_proxy_supplier_qos_properties (void) +{ + return this->ps_qos_; +} + +ACE_INLINE void +TAO_NS_Properties::default_proxy_supplier_qos_properties (const CosNotification::QoSProperties &ps_qos) +{ + this->ps_qos_ = ps_qos; +} + +ACE_INLINE const CosNotification::QoSProperties& +TAO_NS_Properties::default_proxy_consumer_qos_properties (void) +{ + return this->pc_qos_; +} + +ACE_INLINE void +TAO_NS_Properties::default_proxy_consumer_qos_properties (const CosNotification::QoSProperties &pc_qos) +{ + this->pc_qos_ = pc_qos; +} diff --git a/TAO/orbsvcs/orbsvcs/Notify/Proxy.cpp b/TAO/orbsvcs/orbsvcs/Notify/Proxy.cpp index f0530087b1a..dd1cd160f13 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Proxy.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Proxy.cpp @@ -1,7 +1,6 @@ // $Id$ #include "Proxy.h" -#include "Admin.h" #if ! defined (__ACE_INLINE__) #include "Proxy.inl" @@ -9,36 +8,126 @@ ACE_RCSID(RT_Notify, TAO_NS_Proxy, "$Id$") +#include "Peer.h" +#include "Proxy.h" +#include "Method_Request_Updates.h" +#include "Worker_Task.h" +#include "Properties.h" + TAO_NS_Proxy::TAO_NS_Proxy (void) + :updates_off_ (0) { - // Set initial proxy mode to broadcast. - this->subscribed_types_.insert (TAO_NS_EventType::special ()); } TAO_NS_Proxy::~TAO_NS_Proxy () { } +void +TAO_NS_Proxy::init (TAO_NS_Admin *admin ACE_ENV_ARG_DECL_NOT_USED) +{ + TAO_NS_Object::init (admin); + + // For Proxy's the object should be activated in the proxy poa. + // so we override the default initialization in TAO_NS_Object + + this->poa_ = this->proxy_poa_; +} + +void +TAO_NS_Proxy::subscribed_types (TAO_NS_EventTypeSeq& subscribed_types ACE_ENV_ARG_DECL) +{ + ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, ace_mon, this->lock_, + CORBA::INTERNAL ()); + ACE_CHECK; + + // copy + subscribed_types = this->subscribed_types_; +} + +void +TAO_NS_Proxy::types_changed (const TAO_NS_EventTypeSeq& added, const TAO_NS_EventTypeSeq& removed ACE_ENV_ARG_DECL_NOT_USED) +{ + TAO_NS_Method_Request_Updates request (added, removed, this); + + if (TAO_NS_PROPERTIES::instance()->asynch_updates () == 1) // if we should send the updates synchronously. + { + this->worker_task ()->exec (request); + } + else // execute in the current thread context. + { + ACE_DECLARE_NEW_CORBA_ENV; + request.execute (ACE_ENV_SINGLE_ARG_PARAMETER); + } +} + CORBA::Boolean -TAO_NS_Proxy::check_filters (TAO_NS_Event_var &event ACE_ENV_ARG_DECL) +TAO_NS_Proxy::check_filters (const TAO_NS_Event_var &event + , TAO_NS_FilterAdmin& parent_filter_admin + , CosNotifyChannelAdmin::InterFilterGroupOperator filter_operator + ACE_ENV_ARG_DECL) { // check if it passes the parent filter. CORBA::Boolean parent_val = - this->parent_->filter_admin ().match (event ACE_ENV_ARG_PARAMETER); - ACE_CHECK; + parent_filter_admin.match (event ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); CORBA::Boolean val = 0; - if (this->parent_->filter_operator () == CosNotifyChannelAdmin::AND_OP) + if (filter_operator == CosNotifyChannelAdmin::AND_OP) { val = parent_val && this->filter_admin_.match (event ACE_ENV_ARG_PARAMETER); - ACE_CHECK; + ACE_CHECK_RETURN (0); } else { val = parent_val || this->filter_admin_.match (event ACE_ENV_ARG_PARAMETER); - ACE_CHECK; + ACE_CHECK_RETURN (0); } return val; } + +CosNotification::EventTypeSeq* +TAO_NS_Proxy::obtain_types (CosNotifyChannelAdmin::ObtainInfoMode mode, const TAO_NS_EventTypeSeq& types ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException + )) +{ + CosNotification::EventTypeSeq_var event_type_seq; + + ACE_NEW_THROW_EX (event_type_seq, + CosNotification::EventTypeSeq (), + CORBA::NO_MEMORY ()); + + ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, ace_mon, this->lock_, CORBA::INTERNAL ()); + ACE_CHECK_RETURN (event_type_seq._retn ()); + + if (mode == CosNotifyChannelAdmin::ALL_NOW_UPDATES_OFF || + mode == CosNotifyChannelAdmin::ALL_NOW_UPDATES_ON) + { + types.populate (event_type_seq); + } + + if (mode == CosNotifyChannelAdmin::NONE_NOW_UPDATES_ON || + mode == CosNotifyChannelAdmin::ALL_NOW_UPDATES_ON) + { + this->updates_off_ = 0; + } + else + { + this->updates_off_ = 1; + } + + return event_type_seq._retn (); +} + +void +TAO_NS_Proxy::qos_changed (const TAO_NS_QoSProperties& qos_properties) +{ + //Inform Peers of qos changes. + TAO_NS_Peer* peer = this->peer (); + + if (peer != 0) + peer->qos_changed (qos_properties); +} diff --git a/TAO/orbsvcs/orbsvcs/Notify/Proxy.h b/TAO/orbsvcs/orbsvcs/Notify/Proxy.h index cbac9a0effe..27f8e3ea518 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Proxy.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Proxy.h @@ -19,9 +19,10 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ -#include "Object_T.h" +#include "Object.h" #include "EventTypeSeq.h" #include "FilterAdmin.h" +#include "Admin.h" class TAO_NS_Admin; class TAO_NS_Peer; @@ -32,23 +33,37 @@ class TAO_NS_Peer; * @brief Base class proxy for all proxys in NS. * */ -class TAO_Notify_Export TAO_NS_Proxy : public TAO_NS_Object_T +class TAO_Notify_Export TAO_NS_Proxy : public virtual TAO_NS_Object { + friend class TAO_NS_Peer; + public: + typedef CosNotifyChannelAdmin::ProxyIDSeq SEQ; + typedef CosNotifyChannelAdmin::ProxyIDSeq_var SEQ_VAR; + /// Constuctor TAO_NS_Proxy (void); /// Destructor ~TAO_NS_Proxy (); - /// Init method. - // virtual void init (ACE_ENV_SINGLE_ARG_DECL); + /// Init + void init (TAO_NS_Admin *admin ACE_ENV_ARG_DECL); - /// Subscribed types. - TAO_NS_EventTypeSeq& subscribed_types (void); + /// Obtain the Proxy's subscribed types. + void subscribed_types (TAO_NS_EventTypeSeq& subscribed_types ACE_ENV_ARG_DECL); /// Check if this event passes the admin and proxy filters. - CORBA::Boolean check_filters (TAO_NS_Event_var &event ACE_ENV_ARG_DECL); + CORBA::Boolean check_filters (const TAO_NS_Event_var &event + , TAO_NS_FilterAdmin& parent_filter_admin + , CosNotifyChannelAdmin::InterFilterGroupOperator filter_operator + ACE_ENV_ARG_DECL); + + /// Inform this proxy that the following types are being advertised. + void types_changed (const TAO_NS_EventTypeSeq& added, const TAO_NS_EventTypeSeq& removed ACE_ENV_ARG_DECL); + + /// Have updates been turned off. + CORBA::Boolean updates_off (void); /// Destroy this object. virtual void destroy (ACE_ENV_SINGLE_ARG_DECL) = 0; @@ -56,18 +71,31 @@ public: /// Access our Peer. virtual TAO_NS_Peer* peer (void) = 0; + /// Implement the Obtain Types. + virtual CosNotification::EventTypeSeq* obtain_types (CosNotifyChannelAdmin::ObtainInfoMode mode, const TAO_NS_EventTypeSeq& types ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + /// Notification of subscriptions/offers set at the admin. - virtual void admin_subscription (const CosNotification::EventTypeSeq & added, - const CosNotification::EventTypeSeq & removed - ACE_ENV_ARG_DECL) = 0; + virtual void admin_types_changed (const CosNotification::EventTypeSeq & added, + const CosNotification::EventTypeSeq & removed + ACE_ENV_ARG_DECL) = 0; + + + /// Override, TAO_NS_Object::qos_changed + virtual void qos_changed (const TAO_NS_QoSProperties& qos_properties); + protected: - typedef TAO_NS_Object_T inherited; /// Filter Administration TAO_NS_FilterAdmin filter_admin_; /// The types that we're subscribed with the event manager. TAO_NS_EventTypeSeq subscribed_types_; + + /// True if updates have been turned off. + CORBA::Boolean updates_off_; }; #if defined (__ACE_INLINE__) diff --git a/TAO/orbsvcs/orbsvcs/Notify/Proxy.inl b/TAO/orbsvcs/orbsvcs/Notify/Proxy.inl index 773ecde8afd..3610f2b3167 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Proxy.inl +++ b/TAO/orbsvcs/orbsvcs/Notify/Proxy.inl @@ -1,9 +1,7 @@ // $Id$ -#include "Proxy.h" - -ACE_INLINE TAO_NS_EventTypeSeq& -TAO_NS_Proxy::subscribed_types (void) +ACE_INLINE CORBA::Boolean +TAO_NS_Proxy::updates_off (void) { - return this->subscribed_types_; + return this->updates_off_; } diff --git a/TAO/orbsvcs/orbsvcs/Notify/ProxyConsumer.cpp b/TAO/orbsvcs/orbsvcs/Notify/ProxyConsumer.cpp index 83ad52cb0f3..b2191768a07 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/ProxyConsumer.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/ProxyConsumer.cpp @@ -1,9 +1,6 @@ // $Id$ #include "ProxyConsumer.h" -#include "Supplier.h" -#include "Admin.h" -#include "tao/debug.h" #if ! defined (__ACE_INLINE__) #include "ProxyConsumer.inl" @@ -11,13 +8,27 @@ ACE_RCSID(RT_Notify, TAO_NS_ProxyConsumer, "$Id$") +#include "tao/debug.h" +#include "ace/Atomic_Op.h" +#include "Supplier.h" +#include "AdminProperties.h" +#include "Property.h" +#include "Proxy.h" +#include "Event_Manager.h" +#include "Method_Request_Lookup.h" +#include "Worker_Task.h" +#include "Properties.h" +#include "SupplierAdmin.h" + TAO_NS_ProxyConsumer::TAO_NS_ProxyConsumer (void) - :supplier_ (0) + : supplier_admin_ (0) + , supplier_ (0) { } TAO_NS_ProxyConsumer::~TAO_NS_ProxyConsumer () { + this->supplier_admin_->_decr_refcnt (); } TAO_NS_Peer* @@ -26,6 +37,22 @@ TAO_NS_ProxyConsumer::peer (void) return this->supplier (); } +void +TAO_NS_ProxyConsumer::init (TAO_NS_SupplierAdmin* supplier_admin ACE_ENV_SINGLE_ARG_DECL) +{ + TAO_NS_Proxy::init (supplier_admin ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + this->supplier_admin_ = supplier_admin; + + this->supplier_admin_->_incr_refcnt (); + + const CosNotification::QoSProperties &default_ps_qos = + TAO_NS_PROPERTIES::instance ()->default_proxy_consumer_qos_properties (); + + this->set_qos (default_ps_qos ACE_ENV_ARG_PARAMETER); +} + void TAO_NS_ProxyConsumer::connect (TAO_NS_Supplier *supplier ACE_ENV_ARG_DECL) ACE_THROW_SPEC (( @@ -33,40 +60,87 @@ TAO_NS_ProxyConsumer::connect (TAO_NS_Supplier *supplier ACE_ENV_ARG_DECL) , CosEventChannelAdmin::AlreadyConnected )) { - ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, ace_mon, this->lock_, - CORBA::INTERNAL ()); - ACE_CHECK; + TAO_NS_Atomic_Property_Long& supplier_count = this->admin_properties_->suppliers (); + const TAO_NS_Property_Long& max_suppliers = this->admin_properties_->max_suppliers (); + + if (max_suppliers != 0 && + supplier_count >= max_suppliers.value ()) + ACE_THROW (CORBA::IMP_LIMIT ()); // we've reached the limit of suppliers connected. + + { + ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, ace_mon, this->lock_, + CORBA::INTERNAL ()); + ACE_CHECK; + + if (this->is_connected ()) + { + supplier->release (); + ACE_THROW (CosEventChannelAdmin::AlreadyConnected ()); + } + + supplier_ = supplier; - if (this->is_connected ()) - ACE_THROW (CosEventChannelAdmin::AlreadyConnected ()); - else - { - supplier_ = supplier; + this->supplier_admin_->subscribed_types (this->subscribed_types_ ACE_ENV_ARG_PARAMETER); // get the parents subscribed types. + ACE_CHECK; + } - supplier->updates_dispatch_observer (this->event_manager_->updates_dispatch_observer ()); + // Inform QoS values. + supplier_->qos_changed (this->qos_properties_); - this->parent_->subscribed_types (this->subscribed_types_); // get the parents subscribed types. + TAO_NS_EventTypeSeq removed; - event_manager_->publish (this, this->subscribed_types_ ACE_ENV_ARG_PARAMETER); - } + this->event_manager_->offer_change (this, this->subscribed_types_, removed ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + this->event_manager_->connect (this ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + // Increment the global supplier count + ++supplier_count; } void -TAO_NS_ProxyConsumer::disconnect (void) +TAO_NS_ProxyConsumer::disconnect (ACE_ENV_SINGLE_ARG_DECL) { - event_manager_->un_publish (this, this->subscribed_types_ ACE_ENV_ARG_PARAMETER); + TAO_NS_EventTypeSeq added; + + event_manager_->offer_change (this, added, this->subscribed_types_ ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + this->event_manager_->disconnect (this ACE_ENV_ARG_PARAMETER); + ACE_CHECK; - this->supplier_->_decr_refcnt (); + // Decrement the global supplier count + this->admin_properties_->suppliers ()--; } -void +int TAO_NS_ProxyConsumer::shutdown (ACE_ENV_SINGLE_ARG_DECL) { + if (this->TAO_NS_Object::shutdown (ACE_ENV_SINGLE_ARG_PARAMETER) == 1) + return 1; + + ACE_CHECK_RETURN (1); + this->disconnect (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (1); + + if (this->supplier_ != 0) + this->supplier_->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); - this->inherited::shutdown (ACE_ENV_ARG_PARAMETER); + return 0; +} - //@@ inform the supplier that its disconnected? +void +TAO_NS_ProxyConsumer::destroy (ACE_ENV_SINGLE_ARG_DECL) +{ + if (this->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER) == 1) + return; + + ACE_CHECK; + + this->supplier_admin_->remove (this ACE_ENV_ARG_PARAMETER); + ACE_CHECK; } void diff --git a/TAO/orbsvcs/orbsvcs/Notify/ProxyConsumer.h b/TAO/orbsvcs/orbsvcs/Notify/ProxyConsumer.h index da157a43385..807bcf152f3 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/ProxyConsumer.h +++ b/TAO/orbsvcs/orbsvcs/Notify/ProxyConsumer.h @@ -20,19 +20,20 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ - #include "Event.h" -#include "Supplier.h" #include "Proxy.h" #include "orbsvcs/CosEventChannelAdminC.h" +class TAO_NS_SupplierAdmin; +class TAO_NS_Supplier; + /** * @class TAO_NS_ProxyConsumer * * @brief Base class for all types of ProxyConsumer implementations. * */ -class TAO_Notify_Export TAO_NS_ProxyConsumer : public TAO_NS_Proxy +class TAO_Notify_Export TAO_NS_ProxyConsumer : public virtual TAO_NS_Proxy { public: /// Constuctor @@ -41,6 +42,9 @@ public: /// Destructor ~TAO_NS_ProxyConsumer (); + /// Init + void init (TAO_NS_SupplierAdmin* supplier_admin ACE_ENV_ARG_DECL); + /// Connect void connect (TAO_NS_Supplier* supplier ACE_ENV_ARG_DECL) ACE_THROW_SPEC (( @@ -49,11 +53,15 @@ public: )); /// Disconnect - void disconnect (void); + void disconnect (ACE_ENV_SINGLE_ARG_DECL); /// Shutdown (TAO_NS_Container_T method) - virtual void shutdown (ACE_ENV_SINGLE_ARG_DECL); + virtual int shutdown (ACE_ENV_SINGLE_ARG_DECL); + + /// Destroy this object. + virtual void destroy (ACE_ENV_SINGLE_ARG_DECL); + /// Start event propagation. virtual void push (TAO_NS_Event_var &event); /// Access our Peer. @@ -62,10 +70,17 @@ public: /// Access the Supplier TAO_NS_Supplier* supplier (void); -protected: /// Return 1 if connected int is_connected (void); + /// The SA parent. + TAO_NS_SupplierAdmin* supplier_admin (void); + +protected: + ///= Data Members. + /// The SA parent. + TAO_NS_SupplierAdmin* supplier_admin_; + /// The Supplier that we're connect to. TAO_NS_Supplier* supplier_; }; diff --git a/TAO/orbsvcs/orbsvcs/Notify/ProxyConsumer.inl b/TAO/orbsvcs/orbsvcs/Notify/ProxyConsumer.inl index 37512888c80..ea4b07f8474 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/ProxyConsumer.inl +++ b/TAO/orbsvcs/orbsvcs/Notify/ProxyConsumer.inl @@ -1,11 +1,5 @@ // $Id$ -#include "ProxyConsumer.h" -#include "Worker_Task.h" - -#include "Event_Manager.h" -#include "Method_Request_Lookup.h" - ACE_INLINE int TAO_NS_ProxyConsumer::is_connected (void) { @@ -17,3 +11,9 @@ TAO_NS_ProxyConsumer::supplier (void) { return this->supplier_; } + +ACE_INLINE TAO_NS_SupplierAdmin* +TAO_NS_ProxyConsumer::supplier_admin (void) +{ + return this->supplier_admin_; +} diff --git a/TAO/orbsvcs/orbsvcs/Notify/ProxyConsumer_T.cpp b/TAO/orbsvcs/orbsvcs/Notify/ProxyConsumer_T.cpp index 90a166ec142..7c75dd56b49 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/ProxyConsumer_T.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/ProxyConsumer_T.cpp @@ -4,6 +4,7 @@ #define TAO_NS_PROXYCONSUMER_T_CPP #include "ProxyConsumer_T.h" +#include "SupplierAdmin.h" #if ! defined (__ACE_INLINE__) #include "ProxyConsumer_T.inl" @@ -39,7 +40,7 @@ TAO_NS_ProxyConsumer_T::MyAdmin (ACE_ENV_SINGLE_ARG_DECL) { CosNotifyChannelAdmin::SupplierAdmin_var ret; - CORBA::Object_var object = this->parent_->ref (ACE_ENV_SINGLE_ARG_PARAMETER); + CORBA::Object_var object = this->supplier_admin_->ref (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK_RETURN (ret._retn ()); ret = CosNotifyChannelAdmin::SupplierAdmin::_narrow (object.in () ACE_ENV_ARG_PARAMETER); diff --git a/TAO/orbsvcs/orbsvcs/Notify/ProxySupplier.cpp b/TAO/orbsvcs/orbsvcs/Notify/ProxySupplier.cpp index 8569a30bdb7..ade8865cb78 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/ProxySupplier.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/ProxySupplier.cpp @@ -1,8 +1,6 @@ // $Id$ #include "ProxySupplier.h" -#include "Event_Manager.h" -#include "Admin.h" #if ! defined (__ACE_INLINE__) #include "ProxySupplier.inl" @@ -11,19 +9,40 @@ ACE_RCSID(RT_Notify, TAO_NS_ProxySupplier, "$Id$") #include "Method_Request_Dispatch_No_Filtering.h" +#include "Event_Manager.h" +#include "AdminProperties.h" +#include "Consumer.h" +#include "Method_Request_Dispatch.h" +#include "Worker_Task.h" +#include "Buffering_Strategy.h" +#include "Properties.h" +#include "ConsumerAdmin.h" TAO_NS_ProxySupplier::TAO_NS_ProxySupplier (void) - :consumer_ (0) + : consumer_admin_ (0) + , consumer_ (0) { } TAO_NS_ProxySupplier::~TAO_NS_ProxySupplier () { + this->consumer_admin_->_decr_refcnt (); } void -TAO_NS_ProxySupplier::init_ps (ACE_ENV_SINGLE_ARG_DECL) +TAO_NS_ProxySupplier::init (TAO_NS_ConsumerAdmin* consumer_admin ACE_ENV_SINGLE_ARG_DECL) { + TAO_NS_Proxy::init (consumer_admin ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + this->consumer_admin_ = consumer_admin; + + this->consumer_admin_->_incr_refcnt (); + + const CosNotification::QoSProperties &default_ps_qos = + TAO_NS_PROPERTIES::instance ()->default_proxy_supplier_qos_properties (); + + this->set_qos (default_ps_qos ACE_ENV_ARG_PARAMETER); } TAO_NS_Peer* @@ -39,46 +58,90 @@ TAO_NS_ProxySupplier::connect (TAO_NS_Consumer *consumer ACE_ENV_ARG_DECL) , CosEventChannelAdmin::AlreadyConnected )) { - ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, ace_mon, this->lock_, - CORBA::INTERNAL ()); - ACE_CHECK; + TAO_NS_Atomic_Property_Long& consumer_count = this->admin_properties_->consumers (); + const TAO_NS_Property_Long& max_consumers = this->admin_properties_->max_consumers (); - if (this->is_connected ()) - ACE_THROW (CosEventChannelAdmin::AlreadyConnected ()); - else - { - consumer_ = consumer; + if (max_consumers != 0 && + consumer_count >= max_consumers.value ()) + ACE_THROW (CORBA::IMP_LIMIT ()); // we've reached the limit of consumers connected. - consumer->event_dispatch_observer (this->event_manager_->event_dispatch_observer ()); - consumer->updates_dispatch_observer (this->event_manager_->updates_dispatch_observer ()); + { + ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, ace_mon, this->lock_, + CORBA::INTERNAL ()); + ACE_CHECK; - this->parent_->subscribed_types (this->subscribed_types_); // get the parents subscribed types. + if (this->is_connected ()) + { + consumer->release (); + ACE_THROW (CosEventChannelAdmin::AlreadyConnected ()); + } - event_manager_->subscribe (this, this->subscribed_types_ ACE_ENV_ARG_PARAMETER); - } + consumer_ = consumer; + + this->consumer_admin_->subscribed_types (this->subscribed_types_ ACE_ENV_ARG_PARAMETER); // get the parents subscribed types. + ACE_CHECK; + } + + // Inform QoS values. + consumer_->qos_changed (this->qos_properties_); + + TAO_NS_EventTypeSeq removed; + + this->event_manager_->subscription_change (this, this->subscribed_types_, removed ACE_ENV_ARG_PARAMETER); + + this->event_manager_->connect (this ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + // Increment the global consumer count + ++consumer_count; } void TAO_NS_ProxySupplier::disconnect (ACE_ENV_SINGLE_ARG_DECL) { - event_manager_->un_subscribe (this, this->subscribed_types_ ACE_ENV_ARG_PARAMETER); + TAO_NS_EventTypeSeq added; + + this->event_manager_->subscription_change (this, added, this->subscribed_types_ ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + this->event_manager_->disconnect (this ACE_ENV_ARG_PARAMETER); ACE_CHECK; - this->consumer_->_decr_refcnt (); + // Decrement the global consumer count + this->admin_properties_->consumers ()--; } -void +int TAO_NS_ProxySupplier::shutdown (ACE_ENV_SINGLE_ARG_DECL) { + if (this->TAO_NS_Object::shutdown (ACE_ENV_SINGLE_ARG_PARAMETER) == 1) + return 1; + + ACE_CHECK_RETURN (1); + this->disconnect (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (1); - this->inherited::shutdown (ACE_ENV_ARG_PARAMETER); + if (this->consumer_ != 0) + this->consumer_->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); - //@@ inform the consumer that its disconnected? + return 0; } void -TAO_NS_ProxySupplier::push (TAO_NS_Event_var &event) +TAO_NS_ProxySupplier::destroy (ACE_ENV_SINGLE_ARG_DECL) +{ + if (this->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER) == 1) + return; + + ACE_CHECK; + + this->consumer_admin_->remove (this ACE_ENV_ARG_PARAMETER); + ACE_CHECK; +} + +void +TAO_NS_ProxySupplier::push (const TAO_NS_Event_var &event) { TAO_NS_Method_Request_Dispatch request (event, this); @@ -86,9 +149,32 @@ TAO_NS_ProxySupplier::push (TAO_NS_Event_var &event) } void -TAO_NS_ProxySupplier::push_no_filtering (TAO_NS_Event_var &event) +TAO_NS_ProxySupplier::push_no_filtering (const TAO_NS_Event_var &event) { TAO_NS_Method_Request_Dispatch_No_Filtering request (event, this); this->worker_task ()->exec (request); } + +void +TAO_NS_ProxySupplier::qos_changed (const TAO_NS_QoSProperties& qos_properties) +{ + TAO_NS_Property_Long mepc_qos (CosNotification::MaxEventsPerConsumer); + + if (mepc_qos.set (qos_properties) != -1) + { + // Does the Proxy own the Worker Task? + if (own_worker_task_) + { + TAO_NS_Buffering_Strategy* bs = this->worker_task_->buffering_strategy (); + + // Apply this QoS to the Proxy's Buffering Strategy. + if (bs) + { + bs->max_local_queue_length (mepc_qos.value ()); + } + } + } + + TAO_NS_Proxy::qos_changed (qos_properties); +} diff --git a/TAO/orbsvcs/orbsvcs/Notify/ProxySupplier.h b/TAO/orbsvcs/orbsvcs/Notify/ProxySupplier.h index 9c476e8ba55..dfb5bb590b9 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/ProxySupplier.h +++ b/TAO/orbsvcs/orbsvcs/Notify/ProxySupplier.h @@ -20,18 +20,22 @@ #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "Event.h" -#include "Consumer.h" #include "Proxy.h" #include "orbsvcs/CosEventChannelAdminC.h" +class TAO_NS_Consumer; +class TAO_NS_ConsumerAdmin; + /** * @class TAO_NS_ProxySupplier * * @brief Base class for all the ProxySuppliers. * */ -class TAO_Notify_Export TAO_NS_ProxySupplier : public TAO_NS_Proxy +class TAO_Notify_Export TAO_NS_ProxySupplier : public virtual TAO_NS_Proxy { + friend class TAO_NS_Consumer; + public: /// Constuctor TAO_NS_ProxySupplier (void); @@ -39,8 +43,8 @@ public: /// Destructor virtual ~TAO_NS_ProxySupplier (); - /// Init method. - virtual void init_ps (ACE_ENV_SINGLE_ARG_DECL); + /// Init + virtual void init (TAO_NS_ConsumerAdmin* consumer_admin ACE_ENV_ARG_DECL); /// Connect void connect (TAO_NS_Consumer* consumer ACE_ENV_ARG_DECL) @@ -52,13 +56,19 @@ public: void disconnect (ACE_ENV_SINGLE_ARG_DECL); /// Dispatch Event to consumer - virtual void push (TAO_NS_Event_var &event); + virtual void push (const TAO_NS_Event_var &event); /// Dispatch Event to consumer, no filtering - virtual void push_no_filtering (TAO_NS_Event_var &event); + virtual void push_no_filtering (const TAO_NS_Event_var &event); + + /// Override TAO_NS_Container_T::shutdown method + virtual int shutdown (ACE_ENV_SINGLE_ARG_DECL); - /// Shutdown (TAO_NS_Container_T method) - virtual void shutdown (ACE_ENV_SINGLE_ARG_DECL); + /// Destroy this object. + virtual void destroy (ACE_ENV_SINGLE_ARG_DECL); + + /// Override, TAO_NS_Proxy::qos_changed to apply MaxEventssPerConsumer QoS. + virtual void qos_changed (const TAO_NS_QoSProperties& qos_properties); /// Access our Peer. virtual TAO_NS_Peer* peer (void); @@ -66,10 +76,18 @@ public: /// Access the Consumer TAO_NS_Consumer* consumer (void); -protected: /// Return 1 if connected int is_connected (void); + /// The CA parent. + TAO_NS_ConsumerAdmin* consumer_admin (void); + +protected: + + ///= Data Members. + /// The CA parent. + TAO_NS_ConsumerAdmin* consumer_admin_; + /// The Consumer that we're connect to. TAO_NS_Consumer* consumer_; }; diff --git a/TAO/orbsvcs/orbsvcs/Notify/ProxySupplier.inl b/TAO/orbsvcs/orbsvcs/Notify/ProxySupplier.inl index 6815967ff6f..3c7852c9858 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/ProxySupplier.inl +++ b/TAO/orbsvcs/orbsvcs/Notify/ProxySupplier.inl @@ -1,9 +1,5 @@ // $Id$ -#include "ProxySupplier.h" -#include "Method_Request_Dispatch.h" -#include "Worker_Task.h" - ACE_INLINE int TAO_NS_ProxySupplier::is_connected (void) { @@ -15,3 +11,9 @@ TAO_NS_ProxySupplier::consumer (void) { return this->consumer_; } + +ACE_INLINE TAO_NS_ConsumerAdmin* +TAO_NS_ProxySupplier::consumer_admin (void) +{ + return this->consumer_admin_; +} diff --git a/TAO/orbsvcs/orbsvcs/Notify/ProxySupplier_T.cpp b/TAO/orbsvcs/orbsvcs/Notify/ProxySupplier_T.cpp index 7db52521e8b..04db7d0d999 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/ProxySupplier_T.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/ProxySupplier_T.cpp @@ -19,6 +19,7 @@ ACE_RCSID(Notify, TAO_NS_ProxySupplier_T, "$id$") #include "Method_Request_Dispatch_No_Filtering.h" #include "Worker_Task.h" #include "Event_Manager.h" +#include "ConsumerAdmin.h" template TAO_NS_ProxySupplier_T::TAO_NS_ProxySupplier_T (void) @@ -171,7 +172,7 @@ TAO_NS_ProxySupplier_T::MyAdmin (ACE_ENV_SINGLE_ARG_DECL) { CosNotifyChannelAdmin::ConsumerAdmin_var ret; - CORBA::Object_var object = this->parent_->ref (ACE_ENV_SINGLE_ARG_PARAMETER); + CORBA::Object_var object = this->consumer_admin_->ref (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK_RETURN (ret._retn ()); ret = CosNotifyChannelAdmin::ConsumerAdmin::_narrow (object.in () ACE_ENV_ARG_PARAMETER); diff --git a/TAO/orbsvcs/orbsvcs/Notify/Proxy_T.cpp b/TAO/orbsvcs/orbsvcs/Notify/Proxy_T.cpp index 06291c3cf14..dd340c2b592 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Proxy_T.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Proxy_T.cpp @@ -55,6 +55,10 @@ TAO_NS_Proxy_T::get_qos (ACE_ENV_SINGLE_ARG_DECL) CORBA::SystemException )) { + ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, ace_mon, this->lock_, + CORBA::INTERNAL ()); + ACE_CHECK_RETURN (0); + return this->TAO_NS_Object::get_qos (ACE_ENV_SINGLE_ARG_PARAMETER); } @@ -65,6 +69,9 @@ TAO_NS_Proxy_T::set_qos (const CosNotification::QoSProperties & qo CosNotification::UnsupportedQoS )) { + ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, ace_mon, this->lock_, + CORBA::INTERNAL ()); + this->TAO_NS_Object::set_qos (qos ACE_ENV_ARG_PARAMETER); } @@ -88,6 +95,10 @@ TAO_NS_Proxy_T::add_filter (CosNotifyFilter::Filter_ptr new_filter CORBA::SystemException )) { + ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, ace_mon, this->lock_, + CORBA::INTERNAL ()); + ACE_CHECK_RETURN (0); + return this->filter_admin_.add_filter (new_filter ACE_ENV_ARG_PARAMETER); } @@ -101,6 +112,9 @@ TAO_NS_Proxy_T::remove_filter ( CosNotifyFilter::FilterNotFound )) { + ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, ace_mon, this->lock_, + CORBA::INTERNAL ()); + this->filter_admin_.remove_filter (filter ACE_ENV_ARG_PARAMETER); } @@ -111,6 +125,10 @@ TAO_NS_Proxy_T::get_filter (CosNotifyFilter::FilterID filter ACE_E CosNotifyFilter::FilterNotFound )) { + ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, ace_mon, this->lock_, + CORBA::INTERNAL ()); + ACE_CHECK_RETURN (CosNotifyFilter::Filter::_nil ()); + return this->filter_admin_.get_filter (filter ACE_ENV_ARG_PARAMETER); } @@ -120,6 +138,10 @@ TAO_NS_Proxy_T::get_all_filters (ACE_ENV_SINGLE_ARG_DECL) CORBA::SystemException )) { + ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, ace_mon, this->lock_, + CORBA::INTERNAL ()); + ACE_CHECK_RETURN (0); + return this->filter_admin_.get_all_filters (ACE_ENV_SINGLE_ARG_PARAMETER); } @@ -129,6 +151,9 @@ TAO_NS_Proxy_T::remove_all_filters (ACE_ENV_SINGLE_ARG_DECL) CORBA::SystemException )) { + ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, ace_mon, this->lock_, + CORBA::INTERNAL ()); + this->filter_admin_.remove_all_filters (ACE_ENV_SINGLE_ARG_PARAMETER); } diff --git a/TAO/orbsvcs/orbsvcs/Notify/QoSProperties.cpp b/TAO/orbsvcs/orbsvcs/Notify/QoSProperties.cpp index 2a8672aa1f6..ca2e0da3330 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/QoSProperties.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/QoSProperties.cpp @@ -75,8 +75,8 @@ TAO_NS_QoSProperties::init (const CosNotification::PropertySeq& prop_seq, CosNot return err_index == -1 ? 0 : 1; } -void -TAO_NS_QoSProperties::transfer (TAO_NS_QoSProperties& qos_properties) +int +TAO_NS_QoSProperties::copy (TAO_NS_QoSProperties& qos_properties) { qos_properties.priority_ = this->priority_; qos_properties.timeout_ = this->timeout_; @@ -89,12 +89,24 @@ TAO_NS_QoSProperties::transfer (TAO_NS_QoSProperties& qos_properties) for (; iter.next (entry); iter.advance ()) { - qos_properties.property_map_.bind (entry->ext_id_, entry->int_id_); + if (qos_properties.property_map_.rebind (entry->ext_id_, entry->int_id_) == -1) + return -1; } + return 0; +} + +int +TAO_NS_QoSProperties::transfer (TAO_NS_QoSProperties& qos_properties) +{ + if (this->copy (qos_properties) == -1) + return -1; + // unbind the properties that we don't want to transfer. qos_properties.property_map_.unbind (NotifyExt::ThreadPool); qos_properties.property_map_.unbind (NotifyExt::ThreadPoolLanes); + + return 0; } #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) diff --git a/TAO/orbsvcs/orbsvcs/Notify/QoSProperties.h b/TAO/orbsvcs/orbsvcs/Notify/QoSProperties.h index 08911f86ef4..0b65e375865 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/QoSProperties.h +++ b/TAO/orbsvcs/orbsvcs/Notify/QoSProperties.h @@ -42,8 +42,11 @@ public: /// Return 0 on success, 1 if unsupported properties were detected and -1 on error. int init (const CosNotification::PropertySeq& prop_seq, CosNotification::PropertyErrorSeq& err_seq); - /// Populate with properties that can be transfered. - void transfer (TAO_NS_QoSProperties& qos_properties); + /// Populate with all properties from this object. Returns -1 on error. + int copy (TAO_NS_QoSProperties& qos_properties); + + /// Populate with properties that can be transfered.Returns -1 on error. + int transfer (TAO_NS_QoSProperties& qos_properties); ///= Accessors /// ThreadPool diff --git a/TAO/orbsvcs/orbsvcs/Notify/README b/TAO/orbsvcs/orbsvcs/Notify/README index 05684cec2d4..1f7797efc39 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/README +++ b/TAO/orbsvcs/orbsvcs/Notify/README @@ -1,4 +1,4 @@ -$Id$ +README,v 1.5 2000/12/07 05:56:27 pradeep Exp README for the Notification Service ----------------------------------- diff --git a/TAO/orbsvcs/orbsvcs/Notify/RT_Builder.cpp b/TAO/orbsvcs/orbsvcs/Notify/RT_Builder.cpp new file mode 100644 index 00000000000..be618793360 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/RT_Builder.cpp @@ -0,0 +1,106 @@ +// $Id$ + +#include "RT_Builder.h" + +#include "ace/Auto_Ptr.h" +#include "ace/Dynamic_Service.h" +#include "ETCL_FilterFactory.h" +#include "RT_POA_Helper.h" +#include "Properties.h" +#include "orbsvcs/NotifyExtC.h" + +#if ! defined (__ACE_INLINE__) +#include "RT_Builder.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(RT_Notify, TAO_NS_RT_Builder, "$Id$") + +TAO_NS_RT_Builder::TAO_NS_RT_Builder (void) +{ +} + +TAO_NS_RT_Builder::~TAO_NS_RT_Builder () +{ +} + +CosNotifyFilter::FilterFactory_ptr +TAO_NS_RT_Builder::build_filter_factory (ACE_ENV_SINGLE_ARG_DECL) +{ + return TAO_NS_Builder::build_filter_factory (ACE_ENV_SINGLE_ARG_PARAMETER); + + TAO_NS_FilterFactory* ff = ACE_Dynamic_Service::instance ("TAO_NS_FilterFactory"); + + if (ff == 0) + { + ACE_NEW_THROW_EX (ff, + TAO_NS_ETCL_FilterFactory (), + CORBA::NO_MEMORY ()); + ACE_CHECK_RETURN (CosNotifyFilter::FilterFactory::_nil ()); + } + + PortableServer::POA_var default_poa = TAO_NS_PROPERTIES::instance ()->default_poa (); + + TAO_NS_RT_POA_Helper filter_poa; + + NotifyExt::ThreadPoolParams tp_params = {0, 1, 0, 0, 0, 0, 0 }; + + //filter_poa.init (default_poa.in (), tp_params ACE_ENV_ARG_PARAMETER); + filter_poa.init (default_poa.in () ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + PortableServer::POA_var filter_poa_var = filter_poa.poa (); + + return ff->create (filter_poa_var ACE_ENV_ARG_PARAMETER); +} + +void +TAO_NS_RT_Builder::apply_thread_pool_concurrency (TAO_NS_Object& object + , const NotifyExt::ThreadPoolParams& tp_params ACE_ENV_ARG_DECL) +{ + TAO_NS_RT_POA_Helper* proxy_poa = 0; + + // Bootstrap EC Proxy POA + ACE_NEW_THROW_EX (proxy_poa, + TAO_NS_RT_POA_Helper (), + CORBA::NO_MEMORY ()); + ACE_CHECK_RETURN (ec_ret._retn ()); + + auto_ptr auto_proxy_poa (proxy_poa); + + PortableServer::POA_var default_poa = TAO_NS_PROPERTIES::instance ()->default_poa (); + + proxy_poa->init (default_poa.in (), tp_params ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + // Give ownership of proxy_poa + object.proxy_poa_own (proxy_poa); + + // release auto ref. + auto_proxy_poa.release (); +} + +void +TAO_NS_RT_Builder::apply_lane_concurrency (TAO_NS_Object& object + , const NotifyExt::ThreadPoolLanesParams& tpl_params ACE_ENV_ARG_DECL) +{ + TAO_NS_RT_POA_Helper* proxy_poa = 0; + + // Bootstrap EC Proxy POA + ACE_NEW_THROW_EX (proxy_poa, + TAO_NS_RT_POA_Helper (), + CORBA::NO_MEMORY ()); + ACE_CHECK_RETURN (ec_ret._retn ()); + + auto_ptr auto_proxy_poa (proxy_poa); + + PortableServer::POA_var default_poa = TAO_NS_PROPERTIES::instance ()->default_poa (); + + proxy_poa->init (default_poa.in (), tpl_params ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + // Give ownership of proxy_poa + object.proxy_poa_own (proxy_poa); + + // release auto ref. + auto_proxy_poa.release (); +} diff --git a/TAO/orbsvcs/orbsvcs/Notify/RT_Builder.h b/TAO/orbsvcs/orbsvcs/Notify/RT_Builder.h new file mode 100644 index 00000000000..89591289e0a --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/RT_Builder.h @@ -0,0 +1,54 @@ +/* -*- C++ -*- */ +/** + * @file RT_Builder.h + * + * $Id$ + * + * @author Pradeep Gore + * + * + */ + +#ifndef TAO_NS_RT_BUILDER_H +#define TAO_NS_RT_BUILDER_H +#include "ace/pre.h" + +#include "rt_notify_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "Builder.h" + +/** + * @class TAO_NS_RT_Builder + * + * @brief Builder for RT specific classes. + * + */ +class TAO_RT_Notify_Export TAO_NS_RT_Builder : public TAO_NS_Builder +{ +public: + /// Constuctor + TAO_NS_RT_Builder (void); + + /// Destructor + virtual ~TAO_NS_RT_Builder (); + + /// Build the Filter Factory. + virtual CosNotifyFilter::FilterFactory_ptr build_filter_factory (ACE_ENV_SINGLE_ARG_DECL); + + /// Apply Thread Pools. + virtual void apply_thread_pool_concurrency (TAO_NS_Object& object, const NotifyExt::ThreadPoolParams& tp_params ACE_ENV_ARG_DECL); + + /// Apply Thread Pools with Lanes. + virtual void apply_lane_concurrency (TAO_NS_Object& object, const NotifyExt::ThreadPoolLanesParams& tpl_params ACE_ENV_ARG_DECL); +}; + +#if defined (__ACE_INLINE__) +#include "RT_Builder.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* TAO_NS_RT_BUILDER_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/RT_Builder.inl b/TAO/orbsvcs/orbsvcs/Notify/RT_Builder.inl new file mode 100644 index 00000000000..1ce3c730804 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/RT_Builder.inl @@ -0,0 +1,3 @@ +// $Id$ + +#include "RT_Builder.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/RT_Factory.cpp b/TAO/orbsvcs/orbsvcs/Notify/RT_Factory.cpp new file mode 100644 index 00000000000..5467527c8fc --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/RT_Factory.cpp @@ -0,0 +1,29 @@ +// $Id$ + +#include "RT_Factory.h" + +#if ! defined (__ACE_INLINE__) +#include "RT_Factory.inl" +#endif /* __ACE_INLINE__ */ + +#include "Structured/RT_StructuredProxyPushSupplier.h" + +ACE_RCSID(RT_Notify, TAO_NS_RT_Factory, "$Id$") + +TAO_NS_RT_Factory::TAO_NS_RT_Factory (void) +{ +} + +TAO_NS_RT_Factory::~TAO_NS_RT_Factory () +{ +} + +void +TAO_NS_RT_Factory::create (TAO_NS_StructuredProxyPushSupplier*& proxy ACE_ENV_ARG_DECL) +{ + ACE_NEW_THROW_EX (proxy, + TAO_NS_RT_StructuredProxyPushSupplier (), + CORBA::NO_MEMORY ()); +} + +ACE_FACTORY_DECLARE (TAO_Notify, TAO_NS_RT_Factory) diff --git a/TAO/orbsvcs/orbsvcs/Notify/RT_Factory.h b/TAO/orbsvcs/orbsvcs/Notify/RT_Factory.h new file mode 100644 index 00000000000..f447f01f0ca --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/RT_Factory.h @@ -0,0 +1,50 @@ +/* -*- C++ -*- */ +/** + * @file RT_Factory.h + * + * $Id$ + * + * @author Pradeep Gore + * + * + */ + +#ifndef TAO_NS_RT_FACTORY_H +#define TAO_NS_RT_FACTORY_H +#include "ace/pre.h" + +#include "rt_notify_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "Default_Factory.h" + +/** + * @class TAO_NS_RT_Factory + * + * @brief The Factory for the RT aware Notify classes. + * + */ +class TAO_RT_Notify_Export TAO_NS_RT_Factory : public TAO_NS_Default_Factory +{ +public: + /// Constuctor + TAO_NS_RT_Factory (void); + + /// Destructor + virtual ~TAO_NS_RT_Factory (); + + /// Create StructuredProxyPushSupplier + virtual void create (TAO_NS_StructuredProxyPushSupplier*& proxy ACE_ENV_ARG_DECL); +}; + +ACE_FACTORY_DECLARE (TAO_Notify, TAO_NS_RT_Factory) + +#if defined (__ACE_INLINE__) +#include "RT_Factory.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* TAO_NS_RT_FACTORY_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/RT_Factory.inl b/TAO/orbsvcs/orbsvcs/Notify/RT_Factory.inl new file mode 100644 index 00000000000..adb4497a7fa --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/RT_Factory.inl @@ -0,0 +1,3 @@ +// $Id$ + +#include "RT_Factory.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/RT_Notify_Service.cpp b/TAO/orbsvcs/orbsvcs/Notify/RT_Notify_Service.cpp new file mode 100644 index 00000000000..448ac8a612d --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/RT_Notify_Service.cpp @@ -0,0 +1,96 @@ +// $Id$ + +#include "RT_Notify_Service.h" + +#if ! defined (__ACE_INLINE__) +#include "RT_Notify_Service.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(RT_Notify, TAO_NS_RT_Notify_Service, "$Id$") + +#include "Properties.h" +#include "RT_Properties.h" +#include "RT_Factory.h" +#include "RT_Builder.h" + +TAO_NS_RT_Notify_Service::TAO_NS_RT_Notify_Service (void) +{ +} + +TAO_NS_RT_Notify_Service::~TAO_NS_RT_Notify_Service () +{ +} + +void +TAO_NS_RT_Notify_Service::init (CORBA::ORB_ptr orb ACE_ENV_ARG_DECL) +{ + ACE_DEBUG ((LM_DEBUG, "Loading the Real-Time Notification Service...\n")); + + this->init_i (orb ACE_ENV_ARG_PARAMETER); + ACE_CHECK; +} + +void +TAO_NS_RT_Notify_Service::init_i (CORBA::ORB_ptr orb ACE_ENV_ARG_DECL) +{ + //init the base class. + TAO_NS_CosNotify_Service::init_i (orb ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + TAO_NS_RT_Properties* properties = TAO_NS_RT_PROPERTIES::instance(); + + // Resolve RTORB + CORBA::Object_var object = + orb->resolve_initial_references ("RTORB" + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + RTCORBA::RTORB_var rt_orb = + RTCORBA::RTORB::_narrow (object.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + // Resolve RTCurrent + object = + orb->resolve_initial_references ("RTCurrent" + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + RTCORBA::Current_var current = + RTCORBA::Current::_narrow (object.in () + ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (-1); + + /// Set the properties + properties->rt_orb (rt_orb.in ()); + properties->current (current.in ()); +} + +void +TAO_NS_RT_Notify_Service::init_factory (ACE_ENV_SINGLE_ARG_DECL) +{ + this->factory_ = ACE_Dynamic_Service::instance ("TAO_NS_Factory"); + + if (this->factory_ == 0) + { + ACE_NEW_THROW_EX (this->factory_, + TAO_NS_RT_Factory (), + CORBA::NO_MEMORY ()); + ACE_CHECK; + } + + TAO_NS_PROPERTIES::instance()->factory (this->factory_); +} + +void +TAO_NS_RT_Notify_Service::init_builder (ACE_ENV_SINGLE_ARG_DECL) +{ + ACE_NEW_THROW_EX (this->builder_, + TAO_NS_RT_Builder (), + CORBA::NO_MEMORY ()); + ACE_CHECK; + + TAO_NS_PROPERTIES::instance()->builder (this->builder_); +} + +ACE_FACTORY_DEFINE (TAO_RT_Notify,TAO_NS_RT_Notify_Service) diff --git a/TAO/orbsvcs/orbsvcs/Notify/RT_Notify_Service.h b/TAO/orbsvcs/orbsvcs/Notify/RT_Notify_Service.h new file mode 100644 index 00000000000..4ea50500350 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/RT_Notify_Service.h @@ -0,0 +1,60 @@ +/* -*- C++ -*- */ +/** + * @file RT_Notify_Service.h + * + * $Id$ + * + * @author Pradeep Gore + * + * + */ + +#ifndef TAO_NS_RT_NOTIFY_SERVICE_H +#define TAO_NS_RT_NOTIFY_SERVICE_H + +#include "ace/pre.h" +#include "rt_notify_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "CosNotify_Service.h" + +/** + * @class TAO_NS_RT_Notify_Service + * + * @brief Implemetation of the TAO_NS_Service interface for RT Notification. + * + */ +class TAO_RT_Notify_Export TAO_NS_RT_Notify_Service : public TAO_NS_CosNotify_Service +{ +public: + /// Constuctor + TAO_NS_RT_Notify_Service (void); + + /// Destructor + ~TAO_NS_RT_Notify_Service (); + + /// Init the service. + virtual void init (CORBA::ORB_ptr orb ACE_ENV_ARG_DECL); + +protected: + /// Init the data members + virtual void init_i (CORBA::ORB_ptr orb ACE_ENV_ARG_DECL); + + /// Create the Factory for RT Notify objects. + virtual void init_factory (ACE_ENV_SINGLE_ARG_DECL); + + /// Creates the Builder for RT Notify objects. + virtual void init_builder (ACE_ENV_SINGLE_ARG_DECL); +}; + +ACE_FACTORY_DECLARE (TAO_RT_Notify,TAO_NS_RT_Notify_Service) + +#if defined (__ACE_INLINE__) +#include "RT_Notify_Service.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* TAO_NS_RT_NOTIFY_SERVICE_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/RT_Notify_Service.inl b/TAO/orbsvcs/orbsvcs/Notify/RT_Notify_Service.inl new file mode 100644 index 00000000000..2274b4dbd69 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/RT_Notify_Service.inl @@ -0,0 +1,3 @@ +// $Id$ + +#include "RT_Notify_Service.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/RT_POA_Helper.cpp b/TAO/orbsvcs/orbsvcs/Notify/RT_POA_Helper.cpp new file mode 100644 index 00000000000..7e0868f8bf9 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/RT_POA_Helper.cpp @@ -0,0 +1,153 @@ +// $Id$ + +#include "RT_POA_Helper.h" +#include "tao/RTCORBA/RTCORBA.h" +#include "tao/debug.h" +#include "orbsvcs/NotifyExtC.h" +#include "RT_Properties.h" + +#if ! defined (__ACE_INLINE__) +#include "RT_POA_Helper.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(RT_Notify, TAO_NS_RT_POA_Helper, "$Id$") + +TAO_NS_RT_POA_Helper::~TAO_NS_RT_POA_Helper () +{ +} + +void +TAO_NS_RT_POA_Helper::init (PortableServer::POA_ptr parent_poa, const NotifyExt::ThreadPoolParams& tp_params ACE_ENV_ARG_DECL) +{ + char child_poa_name[32]; + ACE_OS_String::itoa (ACE_OS::rand (), child_poa_name, 10); + + this->init (parent_poa, child_poa_name, tp_params ACE_ENV_ARG_PARAMETER); +} + +void +TAO_NS_RT_POA_Helper::init (PortableServer::POA_ptr parent_poa, const char* poa_name + , const NotifyExt::ThreadPoolParams& tp_params ACE_ENV_ARG_DECL) +{ + CORBA::PolicyList policy_list (4); + + this->set_policy (parent_poa, policy_list ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + RTCORBA::RTORB_var rt_orb = TAO_NS_RT_PROPERTIES::instance ()->rt_orb (); + + policy_list.length (3); + policy_list[2] = + rt_orb->create_priority_model_policy (RTCORBA::CLIENT_PROPAGATED, + 0 + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + if (TAO_debug_level > 0) + ACE_DEBUG ((LM_DEBUG, "Creating threadpool: static threads = %d, def. prio = %d\n" + , tp_params.static_threads, tp_params.default_priority)); + + // Create the thread-pool. + RTCORBA::ThreadpoolId threadpool_id = + rt_orb->create_threadpool (tp_params.stacksize, + tp_params.static_threads, + tp_params.dynamic_threads, + tp_params.default_priority, + tp_params.allow_request_buffering, + tp_params.max_buffered_requests, + tp_params.max_request_buffer_size + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + policy_list.length (4); + policy_list[3] = + rt_orb->create_threadpool_policy (threadpool_id + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + this->create_i (parent_poa, poa_name, policy_list ACE_ENV_ARG_PARAMETER); +} + +void +TAO_NS_RT_POA_Helper::init (PortableServer::POA_ptr parent_poa, const NotifyExt::ThreadPoolLanesParams& tpl_params ACE_ENV_ARG_DECL) +{ + char child_poa_name[32]; + ACE_OS_String::itoa (ACE_OS::rand (), child_poa_name, 10); + + this->init (parent_poa, child_poa_name, tpl_params ACE_ENV_ARG_PARAMETER); +} + +void +TAO_NS_RT_POA_Helper::init (PortableServer::POA_ptr parent_poa, const char* poa_name + , const NotifyExt::ThreadPoolLanesParams& tpl_params ACE_ENV_ARG_DECL) +{ + CORBA::PolicyList policy_list (4); + + this->set_policy (parent_poa, policy_list ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + RTCORBA::RTORB_var rt_orb = TAO_NS_RT_PROPERTIES::instance ()->rt_orb (); + + policy_list.length (3); + policy_list[2] = + rt_orb->create_priority_model_policy (RTCORBA::CLIENT_PROPAGATED, + 0 + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + // Populate RTCORBA Lanes. + RTCORBA::ThreadpoolLanes lanes (tpl_params.lanes.length ()); + + for (CORBA::ULong index = 0; index < tpl_params.lanes.length (); ++index) + { + if (TAO_debug_level > 0) + { + ACE_DEBUG ((LM_DEBUG, "Creating threadpool lane %d: priority = %d, static threads = %d\n", + index, tpl_params.lanes[index].lane_priority, tpl_params.lanes[index].static_threads)); + } + + lanes[index].lane_priority = tpl_params.lanes[index].lane_priority; + lanes[index].static_threads = tpl_params.lanes[index].static_threads; + lanes[index].dynamic_threads = tpl_params.lanes[index].dynamic_threads; + } + + // Create the thread-pool. + RTCORBA::ThreadpoolId threadpool_id = + rt_orb->create_threadpool_with_lanes (tpl_params.stacksize, + lanes, + tpl_params.allow_borrowing, + tpl_params.allow_request_buffering, + tpl_params.max_buffered_requests, + tpl_params.max_request_buffer_size + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + policy_list.length (4); + policy_list[3] = + rt_orb->create_threadpool_policy (threadpool_id + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + this->create_i (parent_poa, poa_name, policy_list ACE_ENV_ARG_PARAMETER); +} + +void +TAO_NS_RT_POA_Helper::init (PortableServer::POA_ptr parent_poa ACE_ENV_ARG_DECL) +{ + CORBA::PolicyList policy_list (1); + + RTCORBA::RTORB_var rt_orb = TAO_NS_RT_PROPERTIES::instance ()->rt_orb (); + + policy_list.length (1); + + policy_list[0] = + rt_orb->create_priority_model_policy (RTCORBA::CLIENT_PROPAGATED, + 0 + ACE_ENV_ARG_PARAMETER); + ACE_CHECK; + + char child_poa_name[32]; + ACE_OS_String::itoa (ACE_OS::rand (), child_poa_name, 10); + + this->create_i (parent_poa, child_poa_name, policy_list ACE_ENV_ARG_PARAMETER); +} diff --git a/TAO/orbsvcs/orbsvcs/Notify/RT_POA_Helper.h b/TAO/orbsvcs/orbsvcs/Notify/RT_POA_Helper.h new file mode 100644 index 00000000000..63150165467 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/RT_POA_Helper.h @@ -0,0 +1,64 @@ +/* -*- C++ -*- */ +/** + * @file RT_POA_Helper.h + * + * $Id$ + * + * @author Pradeep Gore + * + * + */ + +#ifndef TAO_NS_RT_POA_Helper_H +#define TAO_NS_RT_POA_Helper_H +#include "ace/pre.h" + +#include "rt_notify_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "POA_Helper.h" +#include "orbsvcs/NotifyExtC.h" + +/** + * @class TAO_NS_RT_POA_Helper + * + * @brief Helper for creating RT POA objects. + * + */ +class TAO_RT_Notify_Export TAO_NS_RT_POA_Helper : public TAO_NS_POA_Helper +{ +public: + /// Destructor + ~TAO_NS_RT_POA_Helper (); + + /// Create a new PortableServer::POA. + /// The UNIQUE_ID, USER_ID , CLIENT_PROPAGATED and thread pool policy is applied to the new POA. + void init (PortableServer::POA_ptr parent_poa, const char* poa_name, const NotifyExt::ThreadPoolParams& tp_params ACE_ENV_ARG_DECL); + + /// Create a new PortableServer::POA. The name is chosen at random. + /// The UNIQUE_ID, USER_ID , CLIENT_PROPAGATED and thread pool policy is applied to the new POA. + void init (PortableServer::POA_ptr parent_poa, const NotifyExt::ThreadPoolParams& tp_params ACE_ENV_ARG_DECL); + + /// Create a new PortableServer::POA. + /// The UNIQUE_ID, USER_ID , CLIENT_PROPAGATED and thread lane policy is applied to the new POA. + void init (PortableServer::POA_ptr parent_poa, const char* poa_name, + const NotifyExt::ThreadPoolLanesParams& tpl_params ACE_ENV_ARG_DECL); + + /// Create a new PortableServer::POA. The name is chosen at random. + /// The UNIQUE_ID, USER_ID , CLIENT_PROPAGATED and thread lane policy is applied to the new POA. + void init (PortableServer::POA_ptr parent_poa, const NotifyExt::ThreadPoolLanesParams& tpl_params ACE_ENV_ARG_DECL); + + /// Create a new PortableServer::POA. The name is chosen at random. + /// The CLIENT_PROPAGATED policy is applied to the new POA. + void init (PortableServer::POA_ptr parent_poa ACE_ENV_ARG_DECL); +}; + +#if defined (__ACE_INLINE__) +#include "RT_POA_Helper.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* TAO_NS_RT_POA_Helper_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/RT_POA_Helper.inl b/TAO/orbsvcs/orbsvcs/Notify/RT_POA_Helper.inl new file mode 100644 index 00000000000..a06831e3235 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/RT_POA_Helper.inl @@ -0,0 +1,3 @@ +// $Id$ + +#include "RT_POA_Helper.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/RT_Properties.cpp b/TAO/orbsvcs/orbsvcs/Notify/RT_Properties.cpp new file mode 100644 index 00000000000..b732a196e4d --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/RT_Properties.cpp @@ -0,0 +1,17 @@ +// $Id$ + +#include "RT_Properties.h" + +#if ! defined (__ACE_INLINE__) +#include "RT_Properties.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(RT_Notify, TAO_NS_RT_Properties, "$Id$") + +TAO_NS_RT_Properties::TAO_NS_RT_Properties (void) +{ +} + +TAO_NS_RT_Properties::~TAO_NS_RT_Properties () +{ +} diff --git a/TAO/orbsvcs/orbsvcs/Notify/RT_Properties.h b/TAO/orbsvcs/orbsvcs/Notify/RT_Properties.h new file mode 100644 index 00000000000..415d0dbd79c --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/RT_Properties.h @@ -0,0 +1,65 @@ +/* -*- C++ -*- */ +/** + * @file RT_Properties.h + * + * $Id$ + * + * @author Pradeep Gore + * + * + */ + +#ifndef TAO_NS_RT_PROPERTIES_H +#define TAO_NS_RT_PROPERTIES_H +#include "ace/pre.h" + +#include "rt_notify_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/TAO_Singleton.h" +#include "tao/RTCORBA/RTCORBA.h" + +/** + * @class TAO_NS_RT_Properties + * + * @brief RT specifc global properties are stored here. + * + */ +class TAO_RT_Notify_Export TAO_NS_RT_Properties +{ + friend class TAO_Singleton; + +public: + /// Constuctor + TAO_NS_RT_Properties (void); + + /// Destructor + ~TAO_NS_RT_Properties (); + + RTCORBA::RTORB_ptr rt_orb (void); + void rt_orb (RTCORBA::RTORB_ptr rt_orb); + + RTCORBA::Current_ptr current (void); + void current (RTCORBA::Current_ptr current); + +protected: + /// RT-ORB + RTCORBA::RTORB_var rt_orb_; + + /// Current + RTCORBA::Current_var current_; +}; + +typedef TAO_Singleton TAO_NS_RT_PROPERTIES; + +TAO_RT_NOTIFY_SINGLETON_DECLARE (TAO_Singleton, TAO_NS_RT_Properties, TAO_SYNCH_MUTEX); + +#if defined (__ACE_INLINE__) +#include "RT_Properties.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* TAO_NS_RT_PROPERTIES_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/RT_Properties.inl b/TAO/orbsvcs/orbsvcs/Notify/RT_Properties.inl new file mode 100644 index 00000000000..77ba96126a0 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/RT_Properties.inl @@ -0,0 +1,27 @@ +// $Id$ + +#include "RT_Properties.h" + +ACE_INLINE RTCORBA::RTORB_ptr +TAO_NS_RT_Properties::rt_orb (void) +{ + return RTCORBA::RTORB::_duplicate (rt_orb_.in ()); +} + +ACE_INLINE void +TAO_NS_RT_Properties::rt_orb (RTCORBA::RTORB_ptr rt_orb) +{ + rt_orb_ = RTCORBA::RTORB::_duplicate (rt_orb); +} + +ACE_INLINE RTCORBA::Current_ptr +TAO_NS_RT_Properties::current (void) +{ + return RTCORBA::Current::_duplicate (current_.in()); +} + +ACE_INLINE void +TAO_NS_RT_Properties::current (RTCORBA::Current_ptr current) +{ + current_ = RTCORBA::Current::_duplicate (current); +} diff --git a/TAO/orbsvcs/orbsvcs/Notify/RT_ProxySupplier.cpp b/TAO/orbsvcs/orbsvcs/Notify/RT_ProxySupplier.cpp new file mode 100644 index 00000000000..a902546e7ce --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/RT_ProxySupplier.cpp @@ -0,0 +1,48 @@ +// $Id$ + +#include "RT_ProxySupplier.h" + +#include "ace/Refcounted_Auto_Ptr.h" +#include "tao/debug.h" +#include "RT_Properties.h" +#include "Event.h" +#include "Structured/StructuredEvent.h" +#include "Method_Request_Dispatch.h" +#include "Method_Request_Dispatch_No_Filtering.h" +#include "Worker_Task.h" + +#if ! defined (__ACE_INLINE__) +#include "RT_ProxySupplier.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(RT_Notify, TAO_NS_RT_ProxySupplier, "$Id$") + +TAO_NS_RT_ProxySupplier::TAO_NS_RT_ProxySupplier (void) +{ +} + +TAO_NS_RT_ProxySupplier::~TAO_NS_RT_ProxySupplier () +{ +} + +void +TAO_NS_RT_ProxySupplier::init (TAO_NS_ConsumerAdmin* consumer_admin ACE_ENV_SINGLE_ARG_DECL) +{ + // Obtain our ref. + CORBA::Object_var obj = this->ref (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK; + + this->event_forwarder_ = Notify_Internal::Event_Forwarder::_narrow (obj.in () ACE_ENV_ARG_PARAMETER); +} + +void +TAO_NS_RT_ProxySupplier::push (TAO_NS_Event_var &event) +{ + event->push (this->event_forwarder_.in () ACE_ENV_ARG_PARAMETER); +} + +void +TAO_NS_RT_ProxySupplier::push_no_filtering (TAO_NS_Event_var &event) +{ + event->push_no_filtering (this->event_forwarder_.in () ACE_ENV_ARG_PARAMETER); +} diff --git a/TAO/orbsvcs/orbsvcs/Notify/RT_ProxySupplier.h b/TAO/orbsvcs/orbsvcs/Notify/RT_ProxySupplier.h new file mode 100644 index 00000000000..0969e4ad403 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/RT_ProxySupplier.h @@ -0,0 +1,64 @@ +/* -*- C++ -*- */ +/** + * @file RT_ProxySupplier.h + * + * $Id$ + * + * @author Pradeep Gore + * + * + */ + +#ifndef TAO_NS_RT_PROXYSUPPLIER_H +#define TAO_NS_RT_PROXYSUPPLIER_H +#include "ace/pre.h" + +#include "rt_notify_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "ProxySupplier.h" + +/** + * @class TAO_NS_RT_ProxySupplier + * + * @brief ProxySupplier implementation for RT aware Suppliers. + * + */ +class TAO_RT_Notify_Export TAO_NS_RT_ProxySupplier : public virtual TAO_NS_ProxySupplier +{ +public: + /// Constuctor + TAO_NS_RT_ProxySupplier (void); + + /// Destructor + virtual ~TAO_NS_RT_ProxySupplier (); + + /// Init + virtual void init (TAO_NS_ConsumerAdmin* consumer_admin ACE_ENV_ARG_DECL); + + /// POA_Notify_Internal::Event_Forwarder method + virtual void forward (const CosNotification::StructuredEvent & event ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + + /// POA_Notify_Internal::Event_Forwarder method + virtual void forward_no_filtering (const CosNotification::StructuredEvent & event ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException + )); + +private: + /// Our ref. + Notify_Internal::Event_Forwarder_var event_forwarder_; +}; + +#if defined (__ACE_INLINE__) +#include "RT_ProxySupplier.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* TAO_NS_RT_PROXYSUPPLIER_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/RT_ProxySupplier.inl b/TAO/orbsvcs/orbsvcs/Notify/RT_ProxySupplier.inl new file mode 100644 index 00000000000..d012e5d0036 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/RT_ProxySupplier.inl @@ -0,0 +1,3 @@ +// $Id$ + +#include "RTCORBA_ProxySupplier.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/Reactive_Task.cpp b/TAO/orbsvcs/orbsvcs/Notify/Reactive_Task.cpp index 494cbae2add..705ebf295f9 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Reactive_Task.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Reactive_Task.cpp @@ -8,7 +8,10 @@ ACE_RCSID(RT_Notify, TAO_NS_Reactive_Task, "$Id$") +#include "Timer_Reactor.h" + TAO_NS_Reactive_Task::TAO_NS_Reactive_Task (void) + :timer_ (0) { } @@ -16,8 +19,36 @@ TAO_NS_Reactive_Task::~TAO_NS_Reactive_Task () { } +void +TAO_NS_Reactive_Task::init (TAO_NS_AdminProperties_var& /*admin_properties*/ ACE_ENV_ARG_DECL) +{ + ACE_NEW_THROW_EX (this->timer_, + TAO_NS_Timer_Reactor (), + CORBA::NO_MEMORY ()); +} + +void +TAO_NS_Reactive_Task::release (void) +{ + this->timer_->_decr_refcnt (); + delete this; //TODO: Release via factory. +} + +void +TAO_NS_Reactive_Task::shutdown (void) +{ +} + void TAO_NS_Reactive_Task::exec (TAO_NS_Method_Request& method_request) { - method_request.call (); + ACE_DECLARE_NEW_CORBA_ENV; + method_request.execute (ACE_ENV_SINGLE_ARG_PARAMETER); +} + +TAO_NS_Timer* +TAO_NS_Reactive_Task::timer (void) +{ + this->timer_->_incr_refcnt (); + return this->timer_; } diff --git a/TAO/orbsvcs/orbsvcs/Notify/Reactive_Task.h b/TAO/orbsvcs/orbsvcs/Notify/Reactive_Task.h index 81ca7876efb..8b1d7e7dbea 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Reactive_Task.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Reactive_Task.h @@ -20,6 +20,10 @@ #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "Worker_Task.h" +#include "AdminProperties.h" +#include "Destroy_Callback.h" + +class TAO_NS_Timer_Reactor; /** * @class TAO_NS_Reactive_Task @@ -27,7 +31,7 @@ * @brief A reactive worker task. Simply executes the command in the caller's context. * */ -class TAO_Notify_Export TAO_NS_Reactive_Task : public TAO_NS_Worker_Task +class TAO_Notify_Export TAO_NS_Reactive_Task : public TAO_NS_Worker_Task, public TAO_NS_Destroy_Callback { public: /// Constuctor @@ -36,8 +40,27 @@ public: /// Destructor ~TAO_NS_Reactive_Task (); + /// Release + virtual void release (void); + + /// Init the reactive task. + void init (TAO_NS_AdminProperties_var& admin_properties ACE_ENV_ARG_DECL); + + /// Shutdown task + virtual void shutdown (void); + /// Exec the request. virtual void exec (TAO_NS_Method_Request& method_request); + + /// The object used by clients to register timers. This method returns a Reactor based Timer. + virtual TAO_NS_Timer* timer (void); + + /// Returns NULL. + virtual TAO_NS_Buffering_Strategy* buffering_strategy (void); + +protected: + /// The timer. + TAO_NS_Timer_Reactor* timer_; }; #if defined (__ACE_INLINE__) diff --git a/TAO/orbsvcs/orbsvcs/Notify/Reactive_Task.inl b/TAO/orbsvcs/orbsvcs/Notify/Reactive_Task.inl index d20c1cc441c..348e107c4ad 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Reactive_Task.inl +++ b/TAO/orbsvcs/orbsvcs/Notify/Reactive_Task.inl @@ -1,3 +1,7 @@ // $Id$ -#include "Reactive_Task.h" +ACE_INLINE TAO_NS_Buffering_Strategy* +TAO_NS_Reactive_Task::buffering_strategy (void) +{ + return 0; +} diff --git a/TAO/orbsvcs/orbsvcs/Notify/Refcountable.cpp b/TAO/orbsvcs/orbsvcs/Notify/Refcountable.cpp index 46178ac6b46..a5c277a611d 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Refcountable.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Refcountable.cpp @@ -1,9 +1,8 @@ // $Id$ #include "Refcountable.h" -#include "Destroy_Callback.h" - #include "tao/debug.h" +#include "ace/Log_Msg.h" #if ! defined (__ACE_INLINE__) #include "Refcountable.inl" @@ -25,7 +24,7 @@ TAO_NS_Refcountable::_incr_refcnt (void) { ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->lock_, 0); - if (TAO_debug_level > 0 ) + if (TAO_debug_level > 1 ) ACE_DEBUG ((LM_DEBUG,"object:%x incr refcount = %d\n", this, refcount_+1 )); @@ -38,7 +37,7 @@ TAO_NS_Refcountable::_decr_refcnt (void) { ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->lock_, 0); - if (TAO_debug_level > 0 ) + if (TAO_debug_level > 1 ) ACE_DEBUG ((LM_DEBUG,"object:%x decr refcount = %d\n", this, refcount_-1 )); this->refcount_--; @@ -46,14 +45,7 @@ TAO_NS_Refcountable::_decr_refcnt (void) return this->refcount_; } - if (this->destroy_callback_ != 0) - this->destroy_callback_->release (); + this->release (); return 0; } - -void -TAO_NS_Refcountable::destroy_callback (TAO_NS_Destroy_Callback* destroy_callback) -{ - destroy_callback_ = destroy_callback; -} diff --git a/TAO/orbsvcs/orbsvcs/Notify/Refcountable.h b/TAO/orbsvcs/orbsvcs/Notify/Refcountable.h index 33dbbb22ed7..77a45cd16fa 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Refcountable.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Refcountable.h @@ -23,12 +23,10 @@ #include "tao/orbconf.h" #include "tao/corbafwd.h" -class TAO_NS_Destroy_Callback; - /** * @class TAO_NS_Refcountable * - * @brief Thread-safe refounting, calls a Destroy_Callback when refcount falls to 0. + * @brief Thread-safe refounting, calls the method when refcount falls to 0. * */ class TAO_Notify_Export TAO_NS_Refcountable @@ -38,24 +36,41 @@ public: TAO_NS_Refcountable (void); /// Destructor - ~TAO_NS_Refcountable (); - - /// Set the destroy callback. - void destroy_callback (TAO_NS_Destroy_Callback* destroy_callback); + virtual ~TAO_NS_Refcountable (); /// This method sigantures deliberately match the RefCounting methods required for ESF Proxy CORBA::ULong _incr_refcnt (void); CORBA::ULong _decr_refcnt (void); + /// The release method is called when the refcount reaches 0. + virtual void release (void) = 0; + protected: /// The reference count. CORBA::ULong refcount_; /// The mutex to serialize access to state variables. TAO_SYNCH_MUTEX lock_; +}; + +/***********************************************************************/ + +/** + * @class TAO_NS_Refcountable_Guard + * + * @brief Ref. Count Guard + * Increments the reference count in the constructor, the count is decremented when the guard's is destructor. + * + */ +class TAO_Notify_Export TAO_NS_Refcountable_Guard +{ +public: + TAO_NS_Refcountable_Guard (TAO_NS_Refcountable& refcountable); + + ~TAO_NS_Refcountable_Guard (); - /// The callback when refcount falls to 0. - TAO_NS_Destroy_Callback* destroy_callback_; +protected: + TAO_NS_Refcountable& refcountable_; }; #if defined (__ACE_INLINE__) diff --git a/TAO/orbsvcs/orbsvcs/Notify/Refcountable.inl b/TAO/orbsvcs/orbsvcs/Notify/Refcountable.inl index 5220e418ae5..be75f075cd8 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Refcountable.inl +++ b/TAO/orbsvcs/orbsvcs/Notify/Refcountable.inl @@ -1,3 +1,14 @@ // $Id$ -#include "Refcountable.h" +ACE_INLINE +TAO_NS_Refcountable_Guard::TAO_NS_Refcountable_Guard (TAO_NS_Refcountable& refcountable) + :refcountable_ (refcountable) +{ + this->refcountable_._incr_refcnt (); +} + +ACE_INLINE +TAO_NS_Refcountable_Guard::~TAO_NS_Refcountable_Guard () +{ + this->refcountable_._decr_refcnt (); +} diff --git a/TAO/orbsvcs/orbsvcs/Notify/Seq_Worker_T.cpp b/TAO/orbsvcs/orbsvcs/Notify/Seq_Worker_T.cpp new file mode 100644 index 00000000000..d6a9d03f7f2 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Seq_Worker_T.cpp @@ -0,0 +1,37 @@ +// $Id$ + +#ifndef TAO_NS_SEQ_WORKER_T_CPP +#define TAO_NS_SEQ_WORKER_T_CPP + +#include "Seq_Worker_T.h" + +#if ! defined (__ACE_INLINE__) +#include "Seq_Worker_T.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(Notify, TAO_NS_Seq_Worker_T, "$id$") + +template +TAO_NS_Seq_Worker_T::TAO_NS_Seq_Worker_T (void) +{ +} + +template TAO_NS_Seq_Worker_T::SEQ* +TAO_NS_Seq_Worker_T::create (CONTAINER &container ACE_ENV_ARG_DECL) +{ + SEQ* tmp; + ACE_NEW_THROW_EX (tmp, //this->seq_, + SEQ (), + CORBA::INTERNAL ()); + + this->seq_ = tmp; + + container.collection ()->for_each (this ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (0); + + return this->seq_._retn (); + +} + +#endif /* TAO_NS_SEQ_WORKER_T_CPP */ + diff --git a/TAO/orbsvcs/orbsvcs/Notify/Seq_Worker_T.h b/TAO/orbsvcs/orbsvcs/Notify/Seq_Worker_T.h new file mode 100644 index 00000000000..c4cb69c2f6d --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Seq_Worker_T.h @@ -0,0 +1,68 @@ +/* -*- C++ -*- */ +/** + * @file Seq_Worker_T.h + * + * $Id$ + * + * @author Pradeep Gore + * + * + */ + +#ifndef TAO_NS_SEQ_WORKER_T_H +#define TAO_NS_SEQ_WORKER_T_H +#include "ace/pre.h" + +#include "notify_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "orbsvcs/ESF/ESF_Proxy_Collection.h" +#include "orbsvcs/ESF/ESF_Worker.h" +#include "Container_T.h" + +/** + * @class TAO_NS_Seq_Worker_T + * + * @brief Helper to construct a sequence of IDS in a collections. + * + */ +template +class TAO_Notify_Export TAO_NS_Seq_Worker_T : public TAO_ESF_Worker +{ + typedef TAO_NS_Container_T CONTAINER; + typedef TAO_ESF_Proxy_Collection COLLECTION; + typedef typename TYPE::SEQ SEQ; + typedef typename TYPE::SEQ_VAR SEQ_VAR; + +public: + /// Constructor + TAO_NS_Seq_Worker_T (void); + + /// create a SEQ + SEQ* create (CONTAINER& container ACE_ENV_ARG_DECL); + +protected: + ///= TAO_ESF_Worker method + void work (TYPE* object ACE_ENV_ARG_DECL); + + /// The result + SEQ_VAR seq_; +}; + +#if defined (__ACE_INLINE__) +#include "Seq_Worker_T.inl" +#endif /* __ACE_INLINE__ */ + +#if defined (ACE_TEMPLATES_REQUIRE_SOURCE) +#include "Seq_Worker_T.cpp" +#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ + +#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) +#pragma implementation ("Seq_Worker_T.cpp") +#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ + +#include "ace/post.h" +#endif /* TAO_NS_SEQ_WORKER_T_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Seq_Worker_T.inl b/TAO/orbsvcs/orbsvcs/Notify/Seq_Worker_T.inl new file mode 100644 index 00000000000..97489c1811e --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Seq_Worker_T.inl @@ -0,0 +1,9 @@ +// $Id$ + +template ACE_INLINE void +TAO_NS_Seq_Worker_T::work (TYPE* type ACE_ENV_ARG_DECL_NOT_USED) +{ + this->seq_->length (this->seq_->length () + 1); + + this->seq_[this->seq_->length () - 1] = type->id (); +} diff --git a/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushConsumer.cpp b/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushConsumer.cpp index 9101583601c..c1b7ea4bdfa 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushConsumer.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushConsumer.cpp @@ -8,10 +8,8 @@ ACE_RCSID(Notify, TAO_NS_SequenceProxyPushConsumer, "$id$") -#include "ace/Refcounted_Auto_Ptr.h" #include "tao/debug.h" #include "SequencePushSupplier.h" -#include "../Admin.h" #include "../AdminProperties.h" #include "../Structured/StructuredEvent.h" @@ -40,7 +38,10 @@ TAO_NS_SequenceProxyPushConsumer::destroy (ACE_ENV_SINGLE_ARG_DECL) if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "In TAO_NS_SequenceProxyPushConsumer::destroy \n")); - this->inherited::destroy (this ACE_ENV_ARG_PARAMETER); + if (this->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER) == 1) + return; + + ACE_CHECK; } CosNotifyChannelAdmin::ProxyType diff --git a/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushConsumer.h b/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushConsumer.h index 647ce01b185..068d39067ac 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushConsumer.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushConsumer.h @@ -21,7 +21,6 @@ #include "orbsvcs/CosNotifyChannelAdminS.h" #include "../ProxyConsumer_T.h" -#include "../Destroy_Callback.h" #if defined(_MSC_VER) #if (_MSC_VER >= 1200) @@ -36,7 +35,7 @@ * @brief * */ -class TAO_Notify_Export TAO_NS_SequenceProxyPushConsumer : public virtual TAO_NS_ProxyConsumer_T , public TAO_NS_Destroy_Callback +class TAO_Notify_Export TAO_NS_SequenceProxyPushConsumer : public virtual TAO_NS_ProxyConsumer_T { friend class TAO_NS_Builder; public: diff --git a/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushSupplier.cpp b/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushSupplier.cpp index f92380f1260..8660198e8f2 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushSupplier.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushSupplier.cpp @@ -10,12 +10,6 @@ ACE_RCSID(Notify, TAO_NS_SequenceProxyPushSupplier, "$id$") #include "tao/debug.h" #include "SequencePushConsumer.h" -#include "../Proxy.h" -#include "../Admin.h" -#include "../EventChannel.h" -#include "../EventChannelFactory.h" -#include "../Notify_Service.h" - TAO_NS_SequenceProxyPushSupplier::TAO_NS_SequenceProxyPushSupplier (void) { @@ -31,7 +25,10 @@ TAO_NS_SequenceProxyPushSupplier::destroy (ACE_ENV_SINGLE_ARG_DECL) if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "In TAO_NS_SequenceProxyPushConsumer::destroy \n")); - this->inherited::destroy (this ACE_ENV_ARG_PARAMETER); + if (this->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER) == 1) + return; + + ACE_CHECK; } void diff --git a/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushSupplier.h b/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushSupplier.h index 722aecf4b8f..49ee0d951c8 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushSupplier.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequenceProxyPushSupplier.h @@ -41,7 +41,7 @@ TAO_NS_ProxySupplier_T; * * */ -class TAO_Notify_Export TAO_NS_SequenceProxyPushSupplier : public virtual TAO_NS_ProxySupplier_T , public TAO_NS_Destroy_Callback +class TAO_Notify_Export TAO_NS_SequenceProxyPushSupplier : public virtual TAO_NS_ProxySupplier_T { friend class TAO_NS_Builder; diff --git a/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequencePushSupplier.h b/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequencePushSupplier.h index b83256362da..e981c1b9fae 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequencePushSupplier.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequencePushSupplier.h @@ -21,7 +21,6 @@ #include "orbsvcs/CosNotifyCommC.h" #include "../Supplier.h" -#include "../Destroy_Callback.h" class TAO_NS_ProxyConsumer; diff --git a/TAO/orbsvcs/orbsvcs/Notify/Service.h b/TAO/orbsvcs/orbsvcs/Notify/Service.h index 37575cef1a7..d10636f5b12 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Service.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Service.h @@ -19,6 +19,7 @@ # pragma once #endif /* ACE_LACKS_PRAGMA_ONCE */ +#include "ace/Service_Object.h" #include "ace/Service_Config.h" #include "orbsvcs/CosNotifyChannelAdminS.h" #include "tao/PortableServer/PortableServer.h" @@ -26,19 +27,33 @@ /** * @class TAO_NS_Service * - * @brief Abstract ACE_Service_Object interface that is a factory for creating a Notify EventChannelFactory. + * @brief Abstract ACE_Service_Object interface that is a + * factory for creating a Notify EventChannelFactory. * Note that a Service creates only 1 Factory object. * */ class TAO_Notify_Export TAO_NS_Service : public ACE_Service_Object { public: + /// Define Service_Object method otherwise SunCC compiler complains. + virtual int init (int argc, char *argv[]) = 0; + /// Init the service. virtual void init (CORBA::ORB_ptr orb ACE_ENV_ARG_DECL) = 0; /// Create the Channel Factory. - virtual CosNotifyChannelAdmin::EventChannelFactory_ptr create (PortableServer::POA_ptr default_POA ACE_ENV_ARG_DECL) = 0; + virtual CosNotifyChannelAdmin::EventChannelFactory_ptr create ( + PortableServer::POA_ptr default_POA ACE_ENV_ARG_DECL + ) = 0; }; +#define TAO_NOTIFY_DEF_EMO_FACTORY_NAME "Notify_Default_Event_Manager_Objects_Factory" + +#define TAO_NS_NOTIFICATION_SERVICE_NAME "TAO_NS_Service" + +#define TAO_NS_COS_NOTIFICATION_SERVICE_NAME "TAO_NS_CosNotify_Service" + +#define TAO_NS_RT_NOTIFICATION_SERVICE_NAME "TAO_NS_RT_Notify_Service" + #include "ace/post.h" #endif /* TAO_NS_SERVICE_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/RTCORBA_StructuredProxyPushConsumer.cpp b/TAO/orbsvcs/orbsvcs/Notify/Structured/RTCORBA_StructuredProxyPushConsumer.cpp deleted file mode 100644 index 7232351da5a..00000000000 --- a/TAO/orbsvcs/orbsvcs/Notify/Structured/RTCORBA_StructuredProxyPushConsumer.cpp +++ /dev/null @@ -1,21 +0,0 @@ -// $Id$ - -#include "RTCORBA_StructuredProxyPushConsumer.h" -#include "ace/Refcounted_Auto_Ptr.h" -#include "StructuredEvent.h" - -#if ! defined (__ACE_INLINE__) -#include "RTCORBA_StructuredProxyPushConsumer.inl" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(RT_Notify, TAO_NS_RTCORBA_StructuredProxyPushConsumer, "$Id$") - -TAO_NS_RTCORBA_StructuredProxyPushConsumer::TAO_NS_RTCORBA_StructuredProxyPushConsumer (void) -{ -} - -TAO_NS_RTCORBA_StructuredProxyPushConsumer::~TAO_NS_RTCORBA_StructuredProxyPushConsumer () -{ -} - - diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/RTCORBA_StructuredProxyPushConsumer.h b/TAO/orbsvcs/orbsvcs/Notify/Structured/RTCORBA_StructuredProxyPushConsumer.h deleted file mode 100644 index 1236821657b..00000000000 --- a/TAO/orbsvcs/orbsvcs/Notify/Structured/RTCORBA_StructuredProxyPushConsumer.h +++ /dev/null @@ -1,46 +0,0 @@ -/* -*- C++ -*- */ -/** - * @file RTCORBA_StructuredProxyPushConsumer.h - * - * $Id$ - * - * @author Pradeep Gore - * - * - */ - -#ifndef TAO_NS_RTCORBA_STRUCTUREDPROXYPUSHCONSUMER_H -#define TAO_NS_RTCORBA_STRUCTUREDPROXYPUSHCONSUMER_H -#include "ace/pre.h" - -#include "../rt_notify_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "StructuredProxyPushConsumer.h" -#include "../RTCORBA_ProxyConsumer.h" - -/** - * @class TAO_NS_RTCORBA_StructuredProxyPushConsumer - * - * @brief RTCORBA specific StructuredProxyPushConsumer - * - */ -class TAO_RT_Notify_Export TAO_NS_RTCORBA_StructuredProxyPushConsumer : public TAO_NS_StructuredProxyPushConsumer, public TAO_NS_RTCORBA_ProxyConsumer -{ -public: - /// Constuctor - TAO_NS_RTCORBA_StructuredProxyPushConsumer (void); - - /// Destructor - ~TAO_NS_RTCORBA_StructuredProxyPushConsumer (); -}; - -#if defined (__ACE_INLINE__) -#include "RTCORBA_StructuredProxyPushConsumer.inl" -#endif /* __ACE_INLINE__ */ - -#include "ace/post.h" -#endif /* TAO_NS_RTCORBA_STRUCTUREDPROXYPUSHCONSUMER_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/RTCORBA_StructuredProxyPushConsumer.inl b/TAO/orbsvcs/orbsvcs/Notify/Structured/RTCORBA_StructuredProxyPushConsumer.inl deleted file mode 100644 index cf92fc592e7..00000000000 --- a/TAO/orbsvcs/orbsvcs/Notify/Structured/RTCORBA_StructuredProxyPushConsumer.inl +++ /dev/null @@ -1,3 +0,0 @@ -// $Id$ - -#include "RTCORBA_StructuredProxyPushConsumer.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/RTCORBA_StructuredProxyPushSupplier.cpp b/TAO/orbsvcs/orbsvcs/Notify/Structured/RTCORBA_StructuredProxyPushSupplier.cpp deleted file mode 100644 index ab03c690ab2..00000000000 --- a/TAO/orbsvcs/orbsvcs/Notify/Structured/RTCORBA_StructuredProxyPushSupplier.cpp +++ /dev/null @@ -1,20 +0,0 @@ -// $Id$ - -#include "RTCORBA_StructuredProxyPushSupplier.h" - -#if ! defined (__ACE_INLINE__) -#include "RTCORBA_StructuredProxyPushSupplier.inl" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(RT_Notify, TAO_NS_RTCORBA_StructuredProxyPushSupplier, "$Id$") - -TAO_NS_RTCORBA_StructuredProxyPushSupplier::TAO_NS_RTCORBA_StructuredProxyPushSupplier (void) -{ -} - -TAO_NS_RTCORBA_StructuredProxyPushSupplier::~TAO_NS_RTCORBA_StructuredProxyPushSupplier () -{ -} - - - diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/RTCORBA_StructuredProxyPushSupplier.h b/TAO/orbsvcs/orbsvcs/Notify/Structured/RTCORBA_StructuredProxyPushSupplier.h deleted file mode 100644 index 9fd56c31fa1..00000000000 --- a/TAO/orbsvcs/orbsvcs/Notify/Structured/RTCORBA_StructuredProxyPushSupplier.h +++ /dev/null @@ -1,51 +0,0 @@ -/* -*- C++ -*- */ -/** - * @file RTCORBA_StructuredProxyPushSupplier.h - * - * $Id$ - * - * @author Pradeep Gore - * - * - */ - -#ifndef TAO_NS_RTCORBA_STRUCTUREDPROXYPUSHSUPPLIER_H -#define TAO_NS_RTCORBA_STRUCTUREDPROXYPUSHSUPPLIER_H -#include "ace/pre.h" - -#include "../rt_notify_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "StructuredProxyPushSupplier.h" -#include "../RTCORBA_ProxySupplier.h" -#include "orbsvcs/Event_ForwarderS_T.h" -#include "orbsvcs/CosNotificationS_T.h" - -/** - * @class TAO_NS_RTCORBA_StructuredProxyPushSupplier - * - * @brief RTCORBA specific StructuredProxyPushSupplier - * - */ - -class TAO_RT_Notify_Export TAO_NS_RTCORBA_StructuredProxyPushSupplier : public TAO_NS_StructuredProxyPushSupplier, public TAO_NS_RTCORBA_ProxySupplier -{ -public: - /// Constuctor - TAO_NS_RTCORBA_StructuredProxyPushSupplier (void); - - /// Destructor - virtual ~TAO_NS_RTCORBA_StructuredProxyPushSupplier (); -}; - - - -#if defined (__ACE_INLINE__) -#include "RTCORBA_StructuredProxyPushSupplier.inl" -#endif /* __ACE_INLINE__ */ - -#include "ace/post.h" -#endif /* TAO_NS_RTCORBA_STRUCTUREDPROXYPUSHSUPPLIER_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/RTCORBA_StructuredProxyPushSupplier.inl b/TAO/orbsvcs/orbsvcs/Notify/Structured/RTCORBA_StructuredProxyPushSupplier.inl deleted file mode 100644 index b667bb40908..00000000000 --- a/TAO/orbsvcs/orbsvcs/Notify/Structured/RTCORBA_StructuredProxyPushSupplier.inl +++ /dev/null @@ -1,3 +0,0 @@ -// $Id$ - -#include "RTCORBA_StructuredProxyPushSupplier.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/RTCORBA_StructuredProxyPushSupplier_Tie.cpp b/TAO/orbsvcs/orbsvcs/Notify/Structured/RTCORBA_StructuredProxyPushSupplier_Tie.cpp deleted file mode 100644 index 755fb827d96..00000000000 --- a/TAO/orbsvcs/orbsvcs/Notify/Structured/RTCORBA_StructuredProxyPushSupplier_Tie.cpp +++ /dev/null @@ -1,43 +0,0 @@ -// $Id$ -#include "RTCORBA_StructuredProxyPushSupplier_Tie.h" - -#if ! defined (__ACE_INLINE__) -#include "RTCORBA_StructuredProxyPushSupplier_Tie.inl" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(RT_Notify, TAO_NS_RTCORBA_StructuredProxyPushSupplier_Tie, "$Id$") - -TAO_NS_RTCORBA_StructuredProxyPushSupplier_Tie::TAO_NS_RTCORBA_StructuredProxyPushSupplier_Tie (void) -: inherited (this->tied_) -{ - this->tied_.servant (this); -} - -TAO_NS_RTCORBA_StructuredProxyPushSupplier_Tie::~TAO_NS_RTCORBA_StructuredProxyPushSupplier_Tie () -{ -} - - -void -TAO_NS_RTCORBA_StructuredProxyPushSupplier_Tie::_add_ref (ACE_ENV_SINGLE_ARG_DECL) -{ - this->tied_._incr_refcnt (); -} - -void -TAO_NS_RTCORBA_StructuredProxyPushSupplier_Tie::_remove_ref (ACE_ENV_SINGLE_ARG_DECL) -{ - this->tied_._decr_refcnt (); -} - -void -TAO_NS_RTCORBA_StructuredProxyPushSupplier_Tie::release (void) -{ - delete this; - //@@ inform factory -} - - - - - diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/RTCORBA_StructuredProxyPushSupplier_Tie.h b/TAO/orbsvcs/orbsvcs/Notify/Structured/RTCORBA_StructuredProxyPushSupplier_Tie.h deleted file mode 100644 index 531bddaa53c..00000000000 --- a/TAO/orbsvcs/orbsvcs/Notify/Structured/RTCORBA_StructuredProxyPushSupplier_Tie.h +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- C++ -*- */ -/** - * @file RTCORBA_StructuredProxyPushSupplier_Tie.h - * - * $Id$ - * - * @author Pradeep Gore - * - * - */ -#ifndef TAO_NS_RTCORBA_STRUCTUREDPROXYPUSHSUPPLIER_TIE_H -#define TAO_NS_RTCORBA_STRUCTUREDPROXYPUSHSUPPLIER_TIE_H - -#include "ace/pre.h" -#include "../rt_notify_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "tao/corba.h" -#include "tao/PortableServer/PortableServer.h" -#include "orbsvcs/CosNotificationC.h" -#include "orbsvcs/CosNotifyCommC.h" -#include "orbsvcs/CosNotifyChannelAdminC.h" -#include "orbsvcs/Event_ForwarderS.h" -#include "orbsvcs/Event_ForwarderS_T.h" -#include "RTCORBA_StructuredProxyPushSupplier.h" -#include "../Destroy_Callback.h" - -/** - * @class TAO_NS_RTCORBA_StructuredProxyPushSupplier_Tie - * - * @brief Tie implementation of the StructuredProxyPushSupplier - * - */ - -class TAO_RT_Notify_Export TAO_NS_RTCORBA_StructuredProxyPushSupplier_Tie : public POA_Notify_Internal::Event_Forwarder_tie , public TAO_NS_Destroy_Callback -{ - typedef POA_Notify_Internal::Event_Forwarder_tie inherited; -public: - /// Constuctor - TAO_NS_RTCORBA_StructuredProxyPushSupplier_Tie (void); - - /// Destructor - ~TAO_NS_RTCORBA_StructuredProxyPushSupplier_Tie (); - - /// ServantBase refcount methods. - virtual void _add_ref (ACE_ENV_SINGLE_ARG_DECL); - virtual void _remove_ref (ACE_ENV_SINGLE_ARG_DECL); - - /// TAO_NS_Destroy_Callback methods - virtual void release (void); - -private: - TAO_NS_RTCORBA_StructuredProxyPushSupplier tied_; -}; - -#if defined (__ACE_INLINE__) -#include "RTCORBA_StructuredProxyPushSupplier_Tie.inl" -#endif /* __ACE_INLINE__ */ - -#include "ace/post.h" -#endif /* TAO_NS_RTCORBA_STRUCTUREDPROXYPUSHSUPPLIER_TIE_H */ - diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/RTCORBA_StructuredProxyPushSupplier_Tie.inl b/TAO/orbsvcs/orbsvcs/Notify/Structured/RTCORBA_StructuredProxyPushSupplier_Tie.inl deleted file mode 100644 index 6cb93c8be17..00000000000 --- a/TAO/orbsvcs/orbsvcs/Notify/Structured/RTCORBA_StructuredProxyPushSupplier_Tie.inl +++ /dev/null @@ -1,3 +0,0 @@ -// $Id$ - -#include "RTCORBA_StructuredProxyPushSupplier_Tie.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/RT_StructuredProxyPushSupplier.cpp b/TAO/orbsvcs/orbsvcs/Notify/Structured/RT_StructuredProxyPushSupplier.cpp new file mode 100644 index 00000000000..4d15210ad6c --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Structured/RT_StructuredProxyPushSupplier.cpp @@ -0,0 +1,44 @@ +// $Id$ + +#include "RT_StructuredProxyPushSupplier.h" + +#if ! defined (__ACE_INLINE__) +#include "RT_StructuredProxyPushSupplier.inl" +#endif /* __ACE_INLINE__ */ + +ACE_RCSID(Notify, TAO_NS_RT_StructuredProxyPushSupplier, "$id$") + +TAO_NS_RT_StructuredProxyPushSupplier::TAO_NS_RT_StructuredProxyPushSupplier (void) +{ +} + +TAO_NS_RT_StructuredProxyPushSupplier::~TAO_NS_RT_StructuredProxyPushSupplier () +{ +} + +CORBA::Object_ptr +TAO_NS_RT_StructuredProxyPushSupplier::activate (PortableServer::Servant servant ACE_ENV_ARG_DECL) +{ + CORBA::Object_var object = TAO_NS_Object::activate (servant ACE_ENV_ARG_DECL); + ACE_CHECK_RETURN (CORBA::Object::_nil ()); + + // Obtain our ref. + CORBA::Object_var obj = this->ref (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_CHECK_RETURN (CORBA::Object::_nil ()); + + this->event_forwarder_ = Event_Forwarder::StructuredProxyPushSupplier::_narrow (obj.in () ACE_ENV_ARG_PARAMETER); + + return object._retn (); +} + +void +TAO_NS_RT_StructuredProxyPushSupplier::push (const TAO_NS_Event_var &event) +{ + event->push (this->event_forwarder_.in () ACE_ENV_ARG_PARAMETER); +} + +void +TAO_NS_RT_StructuredProxyPushSupplier::push_no_filtering (const TAO_NS_Event_var &event) +{ + event->push_no_filtering (this->event_forwarder_.in () ACE_ENV_ARG_PARAMETER); +} diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/RT_StructuredProxyPushSupplier.h b/TAO/orbsvcs/orbsvcs/Notify/Structured/RT_StructuredProxyPushSupplier.h new file mode 100644 index 00000000000..a183a8193c7 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Structured/RT_StructuredProxyPushSupplier.h @@ -0,0 +1,58 @@ +/* -*- C++ -*- */ +/** + * @file RT_StructuredProxyPushSupplier.h + * + * $Id$ + * + * @author Pradeep Gore + * + * + */ + +#ifndef TAO_NS_RT_STRUCTUREDPROXYPUSHSUPPLIER_H +#define TAO_NS_RT_STRUCTUREDPROXYPUSHSUPPLIER_H +#include "ace/pre.h" + +#include "../rt_notify_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "StructuredProxyPushSupplier.h" + +/** + * @class TAO_NS_RT_StructuredProxyPushSupplier + * + * @brief + * + */ +class TAO_RT_Notify_Export TAO_NS_RT_StructuredProxyPushSupplier : public virtual TAO_NS_StructuredProxyPushSupplier +{ +public: + /// Constuctor + TAO_NS_RT_StructuredProxyPushSupplier (void); + + /// Destructor + ~TAO_NS_RT_StructuredProxyPushSupplier (); + + /// Activate this object and obtain the Event_Forwarder interface. + virtual CORBA::Object_ptr activate (PortableServer::Servant servant ACE_ENV_ARG_DECL); + + /// Override TAO_NS_ProxySupplier::push + virtual void push (const TAO_NS_Event_var &event); + + /// Dispatch Event to consumer, no filtering + virtual void push_no_filtering (const TAO_NS_Event_var &event); + +private: + /// Our ref. + Event_Forwarder::StructuredProxyPushSupplier_var event_forwarder_; +}; + +#if defined (__ACE_INLINE__) +#include "RT_StructuredProxyPushSupplier.inl" +#endif /* __ACE_INLINE__ */ + +#include "ace/post.h" +#endif /* TAO_NS_RT_STRUCTUREDPROXYPUSHSUPPLIER_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/RT_StructuredProxyPushSupplier.inl b/TAO/orbsvcs/orbsvcs/Notify/Structured/RT_StructuredProxyPushSupplier.inl new file mode 100644 index 00000000000..2387811a56a --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Structured/RT_StructuredProxyPushSupplier.inl @@ -0,0 +1,3 @@ +// $Id$ + +#include "RT_StructuredProxyPushSupplier.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredEvent.cpp b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredEvent.cpp deleted file mode 100644 index 7efb3f603d0..00000000000 --- a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredEvent.cpp +++ /dev/null @@ -1,44 +0,0 @@ -// $Id$ - -#include "StructuredEvent.h" -#include "../Consumer.h" -#include "tao/debug.h" - -#if ! defined (__ACE_INLINE__) -#include "StructuredEvent.inl" -#endif /* __ACE_INLINE__ */ - - -ACE_RCSID(RT_Notify, TAO_NS_StructuredEvent, "$Id$") - -TAO_NS_StructuredEvent::TAO_NS_StructuredEvent (const CosNotification::StructuredEvent ¬ification) - : notification_ (notification), type_ (notification.header.fixed_header.event_type) -{ -} - -TAO_NS_StructuredEvent::~TAO_NS_StructuredEvent () -{ -} - -const TAO_NS_EventType& -TAO_NS_StructuredEvent::type (void) const -{ - return this->type_; -} - -void -TAO_NS_StructuredEvent::push (TAO_NS_Consumer* consumer ACE_ENV_ARG_DECL) const -{ - if (TAO_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, "Notify (%P|%t) - " - "TAO_Notify_StructuredEvent::do_push (" - "CosNotifyComm::StructuredPushConsumer_ptr)\n")); - - consumer->push (notification_ ACE_ENV_ARG_PARAMETER); -} - -void -TAO_NS_StructuredEvent::push (Notify_Internal::Event_Forwarder_ptr forwarder ACE_ENV_ARG_DECL) -{ - forwarder->forward (notification_ ACE_ENV_ARG_PARAMETER); -} diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredEvent.h b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredEvent.h deleted file mode 100644 index 6b6781ec2d6..00000000000 --- a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredEvent.h +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- C++ -*- */ -/** - * @file StructuredEvent.h - * - * $Id$ - * - * @author Pradeep Gore - * - * - */ -#ifndef TAO_NS_STRUCTUREDEVENT_H -#define TAO_NS_STRUCTUREDEVENT_H - -#include "ace/pre.h" -#include "../notify_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "../Event.h" -#include "../EventType.h" -#include "orbsvcs/CosNotificationC.h" - -/** - * @class TAO_NS_StructuredEvent - * - * @brief StructuredEvent implementation. - * - */ - -class TAO_Notify_Export TAO_NS_StructuredEvent : public TAO_NS_Event -{ -public: - /// Constuctor - TAO_NS_StructuredEvent (const CosNotification::StructuredEvent& notification); - - /// Destructor - ~TAO_NS_StructuredEvent (); - - virtual const TAO_NS_EventType& type (void) const; - - /// Push event to consumer - virtual void push (TAO_NS_Consumer* consumer ACE_ENV_ARG_DECL) const; - - /// Push event to the Event_Forwarder interface - virtual void push (Notify_Internal::Event_Forwarder_ptr forwarder ACE_ENV_ARG_DECL); -protected: - /// Structured Event - CosNotification::StructuredEvent notification_; - - /// Our type. - const TAO_NS_EventType type_; -}; - -#if defined (__ACE_INLINE__) -#include "StructuredEvent.inl" -#endif /* __ACE_INLINE__ */ - -#include "ace/post.h" -#endif /* TAO_NS_STRUCTUREDEVENT_H */ - diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredEvent.inl b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredEvent.inl deleted file mode 100644 index f92715e126c..00000000000 --- a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredEvent.inl +++ /dev/null @@ -1,4 +0,0 @@ -// $Id$ - -#include "StructuredEvent.h" - diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushConsumer.cpp b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushConsumer.cpp deleted file mode 100644 index 5d98d1195e4..00000000000 --- a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushConsumer.cpp +++ /dev/null @@ -1,249 +0,0 @@ -// $Id$ - -#include "StructuredProxyPushConsumer.h" -#include "ace/Refcounted_Auto_Ptr.h" -#include "StructuredPushSupplier.h" -#include "StructuredEvent.h" -#include "../Admin.h" - -#if ! defined (__ACE_INLINE__) -#include "StructuredProxyPushConsumer.inl" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(RT_Notify, TAO_NS_StructuredProxyPushConsumer, "$Id$") - -TAO_NS_StructuredProxyPushConsumer::TAO_NS_StructuredProxyPushConsumer (void) -{ -} - -TAO_NS_StructuredProxyPushConsumer::~TAO_NS_StructuredProxyPushConsumer () -{ - -} - -PortableServer::Servant -TAO_NS_StructuredProxyPushConsumer::servant (void) -{ - return this; -} - -void -TAO_NS_StructuredProxyPushConsumer::_add_ref (ACE_ENV_SINGLE_ARG_DECL) -{ - this->_incr_refcnt (); -} - -void -TAO_NS_StructuredProxyPushConsumer::_remove_ref (ACE_ENV_SINGLE_ARG_DECL) -{ - this->_decr_refcnt (); -} - -void -TAO_NS_StructuredProxyPushConsumer::release (void) -{ - delete this; - //@@ inform factory -} - -void -TAO_NS_StructuredProxyPushConsumer::connect_structured_push_supplier (CosNotifyComm::StructuredPushSupplier_ptr push_supplier ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException - , CosEventChannelAdmin::AlreadyConnected - )) -{ - // Convert Supplier to Base Type - TAO_NS_StructuredPushSupplier * supplier; - ACE_NEW_THROW_EX (supplier, - TAO_NS_StructuredPushSupplier (push_supplier), - CORBA::NO_MEMORY ()); - - supplier->destroy_callback (supplier); - - this->connect (supplier ACE_ENV_ARG_PARAMETER); -} - - -void -TAO_NS_StructuredProxyPushConsumer::push_structured_event (const CosNotification::StructuredEvent & notification ACE_ENV_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException - , CosEventComm::Disconnected - )) -{ - // Convert - TAO_NS_Event_var event (new TAO_NS_StructuredEvent (notification)); - //this->proxy ()->push (event); - this->push (event); -} - - -::CosNotifyChannelAdmin::ProxyType TAO_NS_StructuredProxyPushConsumer::MyType ( - - ) - ACE_THROW_SPEC (( - CORBA::SystemException - )) - -{ - //Add your implementation here - return ::CosNotifyChannelAdmin::PUSH_STRUCTURED; -} - -::CosNotifyChannelAdmin::SupplierAdmin_ptr TAO_NS_StructuredProxyPushConsumer::MyAdmin ( - - ) - ACE_THROW_SPEC (( - CORBA::SystemException - )) - -{ - //Add your implementation here - return 0; -} - -::CosNotification::EventTypeSeq * TAO_NS_StructuredProxyPushConsumer::obtain_subscription_types ( - CosNotifyChannelAdmin::ObtainInfoMode mode - ) - ACE_THROW_SPEC (( - CORBA::SystemException - )) - -{ - //Add your implementation here - return 0; -} - -void TAO_NS_StructuredProxyPushConsumer::validate_event_qos ( - const CosNotification::QoSProperties & required_qos, - CosNotification::NamedPropertyRangeSeq_out available_qos - ) - ACE_THROW_SPEC (( - CORBA::SystemException - , CosNotification::UnsupportedQoS - )) - -{ - //Add your implementation here -} - -void -TAO_NS_StructuredProxyPushConsumer::disconnect_structured_push_consumer (ACE_ENV_SINGLE_ARG_DECL) - ACE_THROW_SPEC (( - CORBA::SystemException - )) -{ - this->inherited::destroy (this ACE_ENV_ARG_PARAMETER); -} - -::CosNotification::QoSProperties * TAO_NS_StructuredProxyPushConsumer::get_qos ( - - ) - ACE_THROW_SPEC (( - CORBA::SystemException - )) - -{ - //Add your implementation here - return 0; -} - -void TAO_NS_StructuredProxyPushConsumer::set_qos ( - const CosNotification::QoSProperties & qos - ) - ACE_THROW_SPEC (( - CORBA::SystemException - , CosNotification::UnsupportedQoS - )) - -{ - //Add your implementation here -} - -void TAO_NS_StructuredProxyPushConsumer::validate_qos ( - const CosNotification::QoSProperties & required_qos, - CosNotification::NamedPropertyRangeSeq_out available_qos - ) - ACE_THROW_SPEC (( - CORBA::SystemException - , CosNotification::UnsupportedQoS - )) - -{ - //Add your implementation here -} - -CosNotifyFilter::FilterID TAO_NS_StructuredProxyPushConsumer::add_filter ( - CosNotifyFilter::Filter_ptr new_filter - ) - ACE_THROW_SPEC (( - CORBA::SystemException - )) - -{ - //Add your implementation here - return 0; -} - -void TAO_NS_StructuredProxyPushConsumer::remove_filter ( - CosNotifyFilter::FilterID filter - ) - ACE_THROW_SPEC (( - CORBA::SystemException - , CosNotifyFilter::FilterNotFound - )) - -{ - //Add your implementation here -} - -::CosNotifyFilter::Filter_ptr TAO_NS_StructuredProxyPushConsumer::get_filter ( - CosNotifyFilter::FilterID filter - ) - ACE_THROW_SPEC (( - CORBA::SystemException - , CosNotifyFilter::FilterNotFound - )) - -{ - //Add your implementation here - return 0; -} - -::CosNotifyFilter::FilterIDSeq * TAO_NS_StructuredProxyPushConsumer::get_all_filters ( - - ) - ACE_THROW_SPEC (( - CORBA::SystemException - )) - -{ - //Add your implementation here - return 0; -} - -void TAO_NS_StructuredProxyPushConsumer::remove_all_filters ( - - ) - ACE_THROW_SPEC (( - CORBA::SystemException - )) - -{ - //Add your implementation here -} - -void TAO_NS_StructuredProxyPushConsumer::offer_change ( - const CosNotification::EventTypeSeq & added, - const CosNotification::EventTypeSeq & removed - ) - ACE_THROW_SPEC (( - CORBA::SystemException - , CosNotifyComm::InvalidEventType - )) - -{ - //Add your implementation here -} - diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushConsumer.h b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushConsumer.h deleted file mode 100644 index 2df2fa54ccb..00000000000 --- a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushConsumer.h +++ /dev/null @@ -1,185 +0,0 @@ -/* -*- C++ -*- */ -/** - * @file StructuredProxyPushConsumer.h - * - * $Id$ - * - * @author Pradeep Gore - * - * - */ - -#ifndef TAO_NS_STRUCTUREDPROXYPUSHCONSUMER_H -#define TAO_NS_STRUCTUREDPROXYPUSHCONSUMER_H -#include "ace/pre.h" - -#include "../notify_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "orbsvcs/CosNotifyChannelAdminS.h" -#include "../ProxyConsumer.h" -#include "../Destroy_Callback.h" - -/** - * @class TAO_NS_StructuredProxyPushConsumer - * - * @brief CosNotifyChannelAdmin::StructuredProxyPushConsumer implementation. - * - */ -class TAO_Notify_Export TAO_NS_StructuredProxyPushConsumer : public virtual POA_CosNotifyChannelAdmin::StructuredProxyPushConsumer, public virtual TAO_NS_ProxyConsumer, public TAO_NS_Destroy_Callback -{ - friend class TAO_NS_Builder; - -public: - /// Constuctor - TAO_NS_StructuredProxyPushConsumer (void); - - /// Destructor - ~TAO_NS_StructuredProxyPushConsumer (); - - /// Implements TAO_NS_Object::servant method. - virtual PortableServer::Servant servant (void); - - /// ServantBase refcount methods. - virtual void _add_ref (ACE_ENV_SINGLE_ARG_DECL); - virtual void _remove_ref (ACE_ENV_SINGLE_ARG_DECL); - - /// TAO_NS_Destroy_Callback methods - virtual void release (void); - -protected: - /// = Servant methods - virtual void connect_structured_push_supplier ( - CosNotifyComm::StructuredPushSupplier_ptr push_supplier - ) - ACE_THROW_SPEC (( - CORBA::SystemException - , CosEventChannelAdmin::AlreadyConnected - )); - - virtual ::CosNotifyChannelAdmin::ProxyType MyType ( - - ) - ACE_THROW_SPEC (( - CORBA::SystemException - )); - - virtual ::CosNotifyChannelAdmin::SupplierAdmin_ptr MyAdmin ( - - ) - ACE_THROW_SPEC (( - CORBA::SystemException - )); - - virtual ::CosNotification::EventTypeSeq * obtain_subscription_types ( - CosNotifyChannelAdmin::ObtainInfoMode mode - ) - ACE_THROW_SPEC (( - CORBA::SystemException - )); - - virtual void validate_event_qos ( - const CosNotification::QoSProperties & required_qos, - CosNotification::NamedPropertyRangeSeq_out available_qos - ) - ACE_THROW_SPEC (( - CORBA::SystemException - , CosNotification::UnsupportedQoS - )); - - virtual void push_structured_event ( - const CosNotification::StructuredEvent & notification - ACE_ENV_ARG_DECL - ) - ACE_THROW_SPEC (( - CORBA::SystemException - , CosEventComm::Disconnected - )); - - virtual void disconnect_structured_push_consumer ( - - ) - ACE_THROW_SPEC (( - CORBA::SystemException - )); - - virtual ::CosNotification::QoSProperties * get_qos ( - - ) - ACE_THROW_SPEC (( - CORBA::SystemException - )); - - virtual void set_qos ( - const CosNotification::QoSProperties & qos - ) - ACE_THROW_SPEC (( - CORBA::SystemException - , CosNotification::UnsupportedQoS - )); - - virtual void validate_qos ( - const CosNotification::QoSProperties & required_qos, - CosNotification::NamedPropertyRangeSeq_out available_qos - ) - ACE_THROW_SPEC (( - CORBA::SystemException - , CosNotification::UnsupportedQoS - )); - - virtual CosNotifyFilter::FilterID add_filter ( - CosNotifyFilter::Filter_ptr new_filter - ) - ACE_THROW_SPEC (( - CORBA::SystemException - )); - - virtual void remove_filter ( - CosNotifyFilter::FilterID filter - ) - ACE_THROW_SPEC (( - CORBA::SystemException - , CosNotifyFilter::FilterNotFound - )); - - virtual ::CosNotifyFilter::Filter_ptr get_filter ( - CosNotifyFilter::FilterID filter - ) - ACE_THROW_SPEC (( - CORBA::SystemException - , CosNotifyFilter::FilterNotFound - )); - - virtual ::CosNotifyFilter::FilterIDSeq * get_all_filters ( - - ) - ACE_THROW_SPEC (( - CORBA::SystemException - )); - - virtual void remove_all_filters ( - - ) - ACE_THROW_SPEC (( - CORBA::SystemException - )); - - virtual void offer_change ( - const CosNotification::EventTypeSeq & added, - const CosNotification::EventTypeSeq & removed - ) - ACE_THROW_SPEC (( - CORBA::SystemException - , CosNotifyComm::InvalidEventType - )); -}; - -#if defined (__ACE_INLINE__) -#include "StructuredProxyPushConsumer.inl" -#endif /* __ACE_INLINE__ */ - -#include "ace/post.h" -#endif /* TAO_NS_STRUCTUREDPROXYPUSHCONSUMER_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushConsumer.inl b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushConsumer.inl deleted file mode 100644 index 0ae697976e7..00000000000 --- a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushConsumer.inl +++ /dev/null @@ -1,3 +0,0 @@ -// $Id$ - -#include "StructuredProxyPushConsumer.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier.cpp b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier.cpp deleted file mode 100644 index 43aa28e5abe..00000000000 --- a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier.cpp +++ /dev/null @@ -1,311 +0,0 @@ - // $Id$ - -#include "StructuredProxyPushSupplier.h" -#include "tao/PortableServer/Servant_Base.h" - -#include "StructuredPushConsumer.h" -#include "../Event_Manager.h" -#include "../Admin.h" - -#if ! defined (__ACE_INLINE__) -#include "StructuredProxyPushSupplier.inl" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(RT_Notify, TAO_NS_StructuredProxyPushSupplier, "$Id$") - -TAO_NS_StructuredProxyPushSupplier::TAO_NS_StructuredProxyPushSupplier (void) -{ -} - -TAO_NS_StructuredProxyPushSupplier::~TAO_NS_StructuredProxyPushSupplier () -{ -} - -void -TAO_NS_StructuredProxyPushSupplier::servant (PortableServer::Servant servant) -{ - servant_ = servant; -} - -PortableServer::Servant -TAO_NS_StructuredProxyPushSupplier::servant (void) -{ - return servant_; -} - -void TAO_NS_StructuredProxyPushSupplier::connect_structured_push_consumer ( - CosNotifyComm::StructuredPushConsumer_ptr push_consumer ACE_ENV_ARG_DECL - ) - ACE_THROW_SPEC (( - CORBA::SystemException - , CosEventChannelAdmin::AlreadyConnected - , CosEventChannelAdmin::TypeError - )) -{ - // Convert Consumer to Base Type - TAO_NS_StructuredPushConsumer* consumer; - ACE_NEW_THROW_EX (consumer, - TAO_NS_StructuredPushConsumer (push_consumer), - CORBA::NO_MEMORY ()); - - consumer->destroy_callback (consumer); - - this->connect (consumer ACE_ENV_ARG_PARAMETER); -} - - -void TAO_NS_StructuredProxyPushSupplier::subscription_change ( - const CosNotification::EventTypeSeq & added, - const CosNotification::EventTypeSeq & removed - ACE_ENV_ARG_DECL - ) - ACE_THROW_SPEC (( - CORBA::SystemException - , CosNotifyComm::InvalidEventType - )) - -{ - TAO_NS_EventTypeSeq seq_added (added); - TAO_NS_EventTypeSeq seq_removed (removed); - - ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, ace_mon, this->lock_, - CORBA::INTERNAL ()); - ACE_CHECK; - - this->preprocess (seq_added, seq_removed); - - if (this->is_connected () == 1) - { - event_manager_->subscribe (this, seq_added); - event_manager_->un_subscribe (this, seq_removed); - } -} - -void TAO_NS_StructuredProxyPushSupplier::disconnect_structured_push_supplier ( - - ) - ACE_THROW_SPEC (( - CORBA::SystemException - )) - - { - this->inherited::destroy (this ACE_ENV_ARG_PARAMETER); - } - -void TAO_NS_StructuredProxyPushSupplier::suspend_connection ( - - ) - ACE_THROW_SPEC (( - CORBA::SystemException - , CosNotifyChannelAdmin::ConnectionAlreadyInactive - , CosNotifyChannelAdmin::NotConnected - )) - - { - //Add your implementation here - } - -void TAO_NS_StructuredProxyPushSupplier::resume_connection ( - - ) - ACE_THROW_SPEC (( - CORBA::SystemException - , CosNotifyChannelAdmin::ConnectionAlreadyActive - , CosNotifyChannelAdmin::NotConnected - )) - - { - //Add your implementation here - } - -::CosNotifyChannelAdmin::ProxyType TAO_NS_StructuredProxyPushSupplier::MyType ( - - ) - ACE_THROW_SPEC (( - CORBA::SystemException - )) - - { - //Add your implementation here - return ::CosNotifyChannelAdmin::PUSH_STRUCTURED; - } - -::CosNotifyChannelAdmin::ConsumerAdmin_ptr TAO_NS_StructuredProxyPushSupplier::MyAdmin ( - - ) - ACE_THROW_SPEC (( - CORBA::SystemException - )) - - { - //Add your implementation here - return 0; - } - -::CosNotifyFilter::MappingFilter_ptr TAO_NS_StructuredProxyPushSupplier::priority_filter ( - - ) - ACE_THROW_SPEC (( - CORBA::SystemException - )) - - { - //Add your implementation here - return 0; - } - -void TAO_NS_StructuredProxyPushSupplier::priority_filter ( - CosNotifyFilter::MappingFilter_ptr priority_filter - ) - ACE_THROW_SPEC (( - CORBA::SystemException - )) - - { - //Add your implementation here - } - -::CosNotifyFilter::MappingFilter_ptr TAO_NS_StructuredProxyPushSupplier::lifetime_filter ( - - ) - ACE_THROW_SPEC (( - CORBA::SystemException - )) - - { - //Add your implementation here - return 0; - } - -void TAO_NS_StructuredProxyPushSupplier::lifetime_filter ( - CosNotifyFilter::MappingFilter_ptr lifetime_filter - ) - ACE_THROW_SPEC (( - CORBA::SystemException - )) - - { - //Add your implementation here - } - -::CosNotification::EventTypeSeq * TAO_NS_StructuredProxyPushSupplier::obtain_offered_types ( - CosNotifyChannelAdmin::ObtainInfoMode mode - ) - ACE_THROW_SPEC (( - CORBA::SystemException - )) - - { - //Add your implementation here - return 0; - } - -void TAO_NS_StructuredProxyPushSupplier::validate_event_qos ( - const CosNotification::QoSProperties & required_qos, - CosNotification::NamedPropertyRangeSeq_out available_qos - ) - ACE_THROW_SPEC (( - CORBA::SystemException - , CosNotification::UnsupportedQoS - )) - - { - //Add your implementation here - } - -::CosNotification::QoSProperties * TAO_NS_StructuredProxyPushSupplier::get_qos ( - - ) - ACE_THROW_SPEC (( - CORBA::SystemException - )) - - { - //Add your implementation here - return 0; - } - -void TAO_NS_StructuredProxyPushSupplier::set_qos ( - const CosNotification::QoSProperties & qos - ) - ACE_THROW_SPEC (( - CORBA::SystemException - , CosNotification::UnsupportedQoS - )) - - { - //Add your implementation here - } - -void TAO_NS_StructuredProxyPushSupplier::validate_qos ( - const CosNotification::QoSProperties & required_qos, - CosNotification::NamedPropertyRangeSeq_out available_qos - ) - ACE_THROW_SPEC (( - CORBA::SystemException - , CosNotification::UnsupportedQoS - )) - - { - //Add your implementation here - } - -CosNotifyFilter::FilterID TAO_NS_StructuredProxyPushSupplier::add_filter ( - CosNotifyFilter::Filter_ptr new_filter - ) - ACE_THROW_SPEC (( - CORBA::SystemException - )) - - { - //Add your implementation here - return 0; - } - -void TAO_NS_StructuredProxyPushSupplier::remove_filter ( - CosNotifyFilter::FilterID filter - ) - ACE_THROW_SPEC (( - CORBA::SystemException - , CosNotifyFilter::FilterNotFound - )) - - { - //Add your implementation here - } - -::CosNotifyFilter::Filter_ptr TAO_NS_StructuredProxyPushSupplier::get_filter ( - CosNotifyFilter::FilterID filter - ) - ACE_THROW_SPEC (( - CORBA::SystemException - , CosNotifyFilter::FilterNotFound - )) - - { - //Add your implementation here - return 0; - } - -::CosNotifyFilter::FilterIDSeq * TAO_NS_StructuredProxyPushSupplier::get_all_filters ( - - ) - ACE_THROW_SPEC (( - CORBA::SystemException - )) - - { - //Add your implementation here - return 0; - } - -void TAO_NS_StructuredProxyPushSupplier::remove_all_filters ( - - ) - ACE_THROW_SPEC (( - CORBA::SystemException - )) - - { - //Add your implementation here - } diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier.h b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier.h deleted file mode 100644 index 4ac7d23658c..00000000000 --- a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier.h +++ /dev/null @@ -1,222 +0,0 @@ -/* -*- C++ -*- */ -/** - * @file StructuredProxyPushSupplier.h - * - * $Id$ - * - * @author Pradeep Gore - * - * - */ - -#ifndef TAO_NS_STRUCTUREDPROXYPUSHSUPPLIER_H -#define TAO_NS_STRUCTUREDPROXYPUSHSUPPLIER_H -#include "ace/pre.h" - -#include "../notify_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "tao/PortableServer/PortableServerC.h" -#include "orbsvcs/CosNotifyChannelAdminS.h" -#include "../ProxySupplier.h" - -/** - * @class TAO_NS_StructuredProxyPushSupplier - * - * @brief Implements the CosNotifyChannelAdmin::StructuredProxyPushSupplier methods. However does not derive from it. This class is to be used by specific Tie implementations of the Notify ProxySupplier interface. - * - */ -class TAO_Notify_Export TAO_NS_StructuredProxyPushSupplier : public virtual TAO_NS_ProxySupplier -{ - friend class TAO_NS_Builder; - -public: - /// Constuctor - TAO_NS_StructuredProxyPushSupplier (void); - - /// Destructor - ~TAO_NS_StructuredProxyPushSupplier (); - - /// Set the servant. - void servant (PortableServer::Servant servant); - - /// Return servant - virtual PortableServer::Servant servant (void); - - /// = Servant methods - virtual void connect_structured_push_consumer ( - CosNotifyComm::StructuredPushConsumer_ptr push_consumer ACE_ENV_ARG_DECL - ) - ACE_THROW_SPEC (( - CORBA::SystemException - , CosEventChannelAdmin::AlreadyConnected - , CosEventChannelAdmin::TypeError - )); - -virtual void suspend_connection ( - - ) - ACE_THROW_SPEC (( - CORBA::SystemException - , CosNotifyChannelAdmin::ConnectionAlreadyInactive - , CosNotifyChannelAdmin::NotConnected - )); - -virtual void resume_connection ( - - ) - ACE_THROW_SPEC (( - CORBA::SystemException - , CosNotifyChannelAdmin::ConnectionAlreadyActive - , CosNotifyChannelAdmin::NotConnected - )); - -virtual ::CosNotifyChannelAdmin::ProxyType MyType ( - - ) - ACE_THROW_SPEC (( - CORBA::SystemException - )); - -virtual ::CosNotifyChannelAdmin::ConsumerAdmin_ptr MyAdmin ( - - ) - ACE_THROW_SPEC (( - CORBA::SystemException - )); - -virtual ::CosNotifyFilter::MappingFilter_ptr priority_filter ( - - ) - ACE_THROW_SPEC (( - CORBA::SystemException - )); - -virtual void priority_filter ( - CosNotifyFilter::MappingFilter_ptr priority_filter - ) - ACE_THROW_SPEC (( - CORBA::SystemException - )); - -virtual ::CosNotifyFilter::MappingFilter_ptr lifetime_filter ( - - ) - ACE_THROW_SPEC (( - CORBA::SystemException - )); - -virtual void lifetime_filter ( - CosNotifyFilter::MappingFilter_ptr lifetime_filter - ) - ACE_THROW_SPEC (( - CORBA::SystemException - )); - -virtual ::CosNotification::EventTypeSeq * obtain_offered_types ( - CosNotifyChannelAdmin::ObtainInfoMode mode - ) - ACE_THROW_SPEC (( - CORBA::SystemException - )); - -virtual void validate_event_qos ( - const CosNotification::QoSProperties & required_qos, - CosNotification::NamedPropertyRangeSeq_out available_qos - ) - ACE_THROW_SPEC (( - CORBA::SystemException - , CosNotification::UnsupportedQoS - )); - -virtual void disconnect_structured_push_supplier ( - - ) - ACE_THROW_SPEC (( - CORBA::SystemException - )); - -virtual ::CosNotification::QoSProperties * get_qos ( - - ) - ACE_THROW_SPEC (( - CORBA::SystemException - )); - -virtual void set_qos ( - const CosNotification::QoSProperties & qos - ) - ACE_THROW_SPEC (( - CORBA::SystemException - , CosNotification::UnsupportedQoS - )); - -virtual void validate_qos ( - const CosNotification::QoSProperties & required_qos, - CosNotification::NamedPropertyRangeSeq_out available_qos - ) - ACE_THROW_SPEC (( - CORBA::SystemException - , CosNotification::UnsupportedQoS - )); - -virtual CosNotifyFilter::FilterID add_filter ( - CosNotifyFilter::Filter_ptr new_filter - ) - ACE_THROW_SPEC (( - CORBA::SystemException - )); - -virtual void remove_filter ( - CosNotifyFilter::FilterID filter - ) - ACE_THROW_SPEC (( - CORBA::SystemException - , CosNotifyFilter::FilterNotFound - )); - -virtual ::CosNotifyFilter::Filter_ptr get_filter ( - CosNotifyFilter::FilterID filter - ) - ACE_THROW_SPEC (( - CORBA::SystemException - , CosNotifyFilter::FilterNotFound - )); - -virtual ::CosNotifyFilter::FilterIDSeq * get_all_filters ( - - ) - ACE_THROW_SPEC (( - CORBA::SystemException - )); - -virtual void remove_all_filters ( - - ) - ACE_THROW_SPEC (( - CORBA::SystemException - )); - -virtual void subscription_change ( - const CosNotification::EventTypeSeq & added, - const CosNotification::EventTypeSeq & removed - ACE_ENV_ARG_DECL - ) - ACE_THROW_SPEC (( - CORBA::SystemException - , CosNotifyComm::InvalidEventType - )); - -protected: - PortableServer::Servant servant_; -}; - -#if defined (__ACE_INLINE__) -#include "StructuredProxyPushSupplier.inl" -#endif /* __ACE_INLINE__ */ - -#include "ace/post.h" -#endif /* TAO_NS_STRUCTUREDPROXYPUSHSUPPLIER_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier.inl b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier.inl deleted file mode 100644 index 1e0efbafba2..00000000000 --- a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier.inl +++ /dev/null @@ -1,3 +0,0 @@ -// $Id$ - -#include "StructuredProxyPushSupplier.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier_Tie.cpp b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier_Tie.cpp deleted file mode 100644 index 9157f0eb7ab..00000000000 --- a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier_Tie.cpp +++ /dev/null @@ -1,42 +0,0 @@ -// $Id$ - -#include "StructuredProxyPushSupplier_Tie.h" - -#if ! defined (__ACE_INLINE__) -#include "StructuredProxyPushSupplier_Tie.inl" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(RT_Notify, TAO_NS_StructuredProxyPushSupplier_Tie, "$Id$") - -TAO_NS_StructuredProxyPushSupplier_Tie::TAO_NS_StructuredProxyPushSupplier_Tie (void) - :inherited (tied_) -{ - this->tied_.servant (this); -} - -TAO_NS_StructuredProxyPushSupplier_Tie::~TAO_NS_StructuredProxyPushSupplier_Tie () -{ -} - -void -TAO_NS_StructuredProxyPushSupplier_Tie::_add_ref (ACE_ENV_SINGLE_ARG_DECL) -{ - this->tied_._incr_refcnt (); -} - -void -TAO_NS_StructuredProxyPushSupplier_Tie::_remove_ref (ACE_ENV_SINGLE_ARG_DECL) -{ - this->tied_._decr_refcnt (); -} - -void -TAO_NS_StructuredProxyPushSupplier_Tie::release (void) -{ - delete this; - //@@ inform factory -} - - - - diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier_Tie.h b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier_Tie.h deleted file mode 100644 index ff4b129d0df..00000000000 --- a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier_Tie.h +++ /dev/null @@ -1,60 +0,0 @@ -/* -*- C++ -*- */ -/** - * @file StructuredProxyPushSupplier_Tie.h - * - * $Id$ - * - * @author Pradeep Gore - * - * - */ - -#ifndef TAO_NS_STRUCTUREDPROXYPUSHSUPPLIER_TIE_H -#define TAO_NS_STRUCTUREDPROXYPUSHSUPPLIER_TIE_H -#include "ace/pre.h" - -#include "../notify_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "orbsvcs/CosNotifyChannelAdminS.h" -#include "StructuredProxyPushSupplier.h" -#include "../Destroy_Callback.h" - -/** - * @class TAO_NS_StructuredProxyPushSupplier_Tie - * - * @brief Tie implementation that implements CosNotifyChannelAdmin::StructuredProxyPushSupplier. - * - */ -class TAO_Notify_Export TAO_NS_StructuredProxyPushSupplier_Tie : public POA_CosNotifyChannelAdmin::StructuredProxyPushSupplier_tie , public TAO_NS_Destroy_Callback -{ - typedef POA_CosNotifyChannelAdmin::StructuredProxyPushSupplier_tie inherited; - -public: - /// Constuctor - TAO_NS_StructuredProxyPushSupplier_Tie (void); - - /// Destructor - ~TAO_NS_StructuredProxyPushSupplier_Tie (); - - /// ServantBase refcount methods. - virtual void _add_ref (ACE_ENV_SINGLE_ARG_DECL); - virtual void _remove_ref (ACE_ENV_SINGLE_ARG_DECL); - - /// TAO_NS_Destroy_Callback methods - virtual void release (void); - -protected: - /// The Tied object providing the required proxy functionality. - TAO_NS_StructuredProxyPushSupplier tied_; -}; - -#if defined (__ACE_INLINE__) -#include "StructuredProxyPushSupplier_Tie.inl" -#endif /* __ACE_INLINE__ */ - -#include "ace/post.h" -#endif /* TAO_NS_STRUCTUREDPROXYPUSHSUPPLIER_TIE_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier_Tie.inl b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier_Tie.inl deleted file mode 100644 index 31069fec8a5..00000000000 --- a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredProxyPushSupplier_Tie.inl +++ /dev/null @@ -1,3 +0,0 @@ -// $Id$ - -#include "StructuredProxyPushSupplier_Tie.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushConsumer.cpp b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushConsumer.cpp deleted file mode 100644 index 86f79d7dbcd..00000000000 --- a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushConsumer.cpp +++ /dev/null @@ -1,32 +0,0 @@ -// $Id$ -#include "StructuredPushConsumer.h" -#include "ace/Refcounted_Auto_Ptr.h" -#include "../Event.h" - -#if ! defined (__ACE_INLINE__) -#include "StructuredPushConsumer.inl" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(RT_Notify, TAO_NS_StructuredPushConsumer, "$Id$") - -TAO_NS_StructuredPushConsumer::TAO_NS_StructuredPushConsumer (CosNotifyComm::StructuredPushConsumer_ptr push_consumer) - :push_consumer_ (CosNotifyComm::StructuredPushConsumer::_duplicate (push_consumer)) -{ -} - -TAO_NS_StructuredPushConsumer::~TAO_NS_StructuredPushConsumer () -{ -} - -void -TAO_NS_StructuredPushConsumer::release (void) -{ - delete this; - //@@ inform factory -} - -void -TAO_NS_StructuredPushConsumer::push (const CosNotification::StructuredEvent & event ACE_ENV_ARG_DECL) -{ - this->push_consumer_->push_structured_event (event ACE_ENV_ARG_PARAMETER); -} diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushConsumer.h b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushConsumer.h deleted file mode 100644 index b9bc1af56f3..00000000000 --- a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushConsumer.h +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- C++ -*- */ -/** - * @file StructuredPushConsumer.h - * - * $Id$ - * - * @author Pradeep Gore - * - * - */ - -#ifndef TAO_NS_STRUCTUREDPUSHCONSUMER_H -#define TAO_NS_STRUCTUREDPUSHCONSUMER_H -#include "ace/pre.h" - -#include "../notify_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "orbsvcs/CosNotifyCommC.h" -#include "../Consumer.h" -#include "../Destroy_Callback.h" - -/** - * @class TAO_NS_StructuredPushConsumer - * - * @brief Wrapper for the StructuredPushConsumer that connect to the EventChannel. - * - */ -class TAO_Notify_Export TAO_NS_StructuredPushConsumer : public TAO_NS_Consumer, public TAO_NS_Destroy_Callback -{ -public: - /// Constuctor - TAO_NS_StructuredPushConsumer (CosNotifyComm::StructuredPushConsumer_ptr push_consumer); - - /// Destructor - ~TAO_NS_StructuredPushConsumer (); - - /// TAO_NS_Destroy_Callback methods. - virtual void release (void); - - virtual void push (const CosNotification::StructuredEvent & event ACE_ENV_ARG_DECL); - -protected: - /// The Consumer - CosNotifyComm::StructuredPushConsumer_var push_consumer_; -}; - -#if defined (__ACE_INLINE__) -#include "StructuredPushConsumer.inl" -#endif /* __ACE_INLINE__ */ - -#include "ace/post.h" -#endif /* TAO_NS_STRUCTUREDPUSHCONSUMER_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushConsumer.inl b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushConsumer.inl deleted file mode 100644 index 24e952b7ae8..00000000000 --- a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushConsumer.inl +++ /dev/null @@ -1,3 +0,0 @@ -// $Id$ - -#include "StructuredPushConsumer.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushSupplier.cpp b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushSupplier.cpp deleted file mode 100644 index ae78d805b38..00000000000 --- a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushSupplier.cpp +++ /dev/null @@ -1,26 +0,0 @@ -// $Id$ - -#include "StructuredPushSupplier.h" - -#if ! defined (__ACE_INLINE__) -#include "StructuredPushSupplier.inl" -#endif /* __ACE_INLINE__ */ - -ACE_RCSID(RT_Notify, TAO_NS_StructuredPushSupplier, "$Id$") - -TAO_NS_StructuredPushSupplier::TAO_NS_StructuredPushSupplier (CosNotifyComm::StructuredPushSupplier_ptr push_supplier) - :push_supplier_ (CosNotifyComm::StructuredPushSupplier::_duplicate (push_supplier)) -{ -} - -TAO_NS_StructuredPushSupplier::~TAO_NS_StructuredPushSupplier () -{ -} - -void -TAO_NS_StructuredPushSupplier::release (void) -{ - delete this; - //@@ inform factory -} - diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushSupplier.h b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushSupplier.h deleted file mode 100644 index 8ed8893ff22..00000000000 --- a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushSupplier.h +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- C++ -*- */ -/** - * @file StructuredPushSupplier.h - * - * $Id$ - * - * @author Pradeep Gore - * - * - */ - -#ifndef TAO_NS_STRUCTUREDPUSHSUPPLIER_H -#define TAO_NS_STRUCTUREDPUSHSUPPLIER_H -#include "ace/pre.h" - -#include "../notify_export.h" - -#if !defined (ACE_LACKS_PRAGMA_ONCE) -# pragma once -#endif /* ACE_LACKS_PRAGMA_ONCE */ - -#include "orbsvcs/CosNotifyCommC.h" -#include "../Supplier.h" -#include "../Destroy_Callback.h" - -/** - * @class TAO_NS_StructuredPushSupplier - * - * @brief Wrapper for the StructuredPushSupplier that connect to the EventChannel. - * - */ -class TAO_Notify_Export TAO_NS_StructuredPushSupplier : public TAO_NS_Supplier, public TAO_NS_Destroy_Callback -{ -public: - /// Constuctor - TAO_NS_StructuredPushSupplier (CosNotifyComm::StructuredPushSupplier_ptr push_supplier); - - /// Destructor - ~TAO_NS_StructuredPushSupplier (); - - /// TAO_NS_Destroy_Callback methods - virtual void release (void); - -protected: - /// The Supplier - CosNotifyComm::StructuredPushSupplier_var push_supplier_; -}; - -#if defined (__ACE_INLINE__) -#include "StructuredPushSupplier.inl" -#endif /* __ACE_INLINE__ */ - -#include "ace/post.h" -#endif /* TAO_NS_STRUCTUREDPUSHSUPPLIER_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushSupplier.inl b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushSupplier.inl deleted file mode 100644 index 12cb29daaef..00000000000 --- a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushSupplier.inl +++ /dev/null @@ -1,3 +0,0 @@ -// $Id$ - -#include "StructuredPushSupplier.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/Subscription_Change_Worker.inl b/TAO/orbsvcs/orbsvcs/Notify/Subscription_Change_Worker.inl index afce0cf8cf4..cb6180d5d7a 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Subscription_Change_Worker.inl +++ b/TAO/orbsvcs/orbsvcs/Notify/Subscription_Change_Worker.inl @@ -1,10 +1,9 @@ // $Id$ -#include "Subscription_Change_Worker.h" #include "Proxy.h" -void +ACE_INLINE void TAO_NS_Subscription_Change_Worker::work (TAO_NS_Proxy* proxy ACE_ENV_ARG_DECL) { - proxy->admin_subscription (this->added_, this->removed_ ACE_ENV_ARG_PARAMETER); + proxy->admin_types_changed (this->added_, this->removed_ ACE_ENV_ARG_PARAMETER); } diff --git a/TAO/orbsvcs/orbsvcs/Notify/Supplier.cpp b/TAO/orbsvcs/orbsvcs/Notify/Supplier.cpp index ecc2ee5279c..f03f91207e2 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Supplier.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Supplier.cpp @@ -9,6 +9,7 @@ ACE_RCSID(RT_Notify, TAO_NS_Supplier, "$Id$") #include "ProxyConsumer.h" +#include "Proxy.h" TAO_NS_Supplier::TAO_NS_Supplier (TAO_NS_ProxyConsumer* proxy) :proxy_ (proxy) @@ -24,3 +25,11 @@ TAO_NS_Supplier::proxy (void) { return this->proxy_consumer (); } + +void +TAO_NS_Supplier::dispatch_updates_i (const CosNotification::EventTypeSeq& added, const CosNotification::EventTypeSeq& removed + ACE_ENV_ARG_DECL) +{ + if (!CORBA::is_nil (this->subscribe_.in ())) + this->subscribe_->subscription_change (added, removed ACE_ENV_ARG_PARAMETER); +} diff --git a/TAO/orbsvcs/orbsvcs/Notify/Supplier.h b/TAO/orbsvcs/orbsvcs/Notify/Supplier.h index fcfe29292ad..f24bddae07c 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Supplier.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Supplier.h @@ -21,6 +21,7 @@ #include "Peer.h" +#include "orbsvcs/CosNotifyCommC.h" class TAO_NS_ProxyConsumer; /** @@ -45,8 +46,16 @@ public: virtual TAO_NS_Proxy* proxy (void); protected: + /// Dispatch updates implementation. + virtual void dispatch_updates_i (const CosNotification::EventTypeSeq& added, + const CosNotification::EventTypeSeq& removed + ACE_ENV_ARG_DECL); + /// The proxy that we associate with. TAO_NS_ProxyConsumer* proxy_; + + /// Interface that accepts subscription_changes + CosNotifyComm::NotifySubscribe_var subscribe_; }; #if defined (__ACE_INLINE__) diff --git a/TAO/orbsvcs/orbsvcs/Notify/Supplier.inl b/TAO/orbsvcs/orbsvcs/Notify/Supplier.inl index 8250f996547..6df91e0fd9a 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Supplier.inl +++ b/TAO/orbsvcs/orbsvcs/Notify/Supplier.inl @@ -1,7 +1,5 @@ // $Id$ -#include "Supplier.h" - ACE_INLINE TAO_NS_ProxyConsumer* TAO_NS_Supplier::proxy_consumer (void) { diff --git a/TAO/orbsvcs/orbsvcs/Notify/SupplierAdmin.cpp b/TAO/orbsvcs/orbsvcs/Notify/SupplierAdmin.cpp index a7ffa89f53a..a90e8a16e62 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/SupplierAdmin.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/SupplierAdmin.cpp @@ -1,12 +1,6 @@ // $Id$ #include "SupplierAdmin.h" -#include "Builder.h" -#include "Proxy.h" -#include "EventChannel.h" -#include "orbsvcs/ESF/ESF_Proxy_Collection.h" -#include "QoSAdmin.h" -#include "Subscription_Change_Worker.h" #if ! defined (__ACE_INLINE__) #include "SupplierAdmin.inl" @@ -14,6 +8,15 @@ ACE_RCSID(RT_Notify, TAO_NS_SupplierAdmin, "$Id$") +#include "orbsvcs/ESF/ESF_Proxy_Collection.h" +#include "Builder.h" +#include "Proxy.h" +#include "EventChannel.h" +#include "Subscription_Change_Worker.h" +#include "Find_Worker_T.h" +#include "Seq_Worker_T.h" +#include "Properties.h" + TAO_NS_SupplierAdmin::TAO_NS_SupplierAdmin (void) { } @@ -22,21 +25,25 @@ TAO_NS_SupplierAdmin::~TAO_NS_SupplierAdmin () { } - -PortableServer::Servant -TAO_NS_SupplierAdmin::servant (void) +void +TAO_NS_SupplierAdmin::init (TAO_NS_EventChannel *ec ACE_ENV_ARG_DECL) { - return this; + TAO_NS_Admin::init (ec); + + const CosNotification::QoSProperties &default_sa_qos = + TAO_NS_PROPERTIES::instance ()->default_supplier_admin_qos_properties (); + + this->set_qos (default_sa_qos ACE_ENV_ARG_PARAMETER); } void -TAO_NS_SupplierAdmin::_add_ref (ACE_ENV_SINGLE_ARG_DECL) +TAO_NS_SupplierAdmin::_add_ref (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) { this->_incr_refcnt (); } void -TAO_NS_SupplierAdmin::_remove_ref (ACE_ENV_SINGLE_ARG_DECL) +TAO_NS_SupplierAdmin::_remove_ref (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) { this->_decr_refcnt (); } @@ -54,138 +61,110 @@ TAO_NS_SupplierAdmin::destroy (ACE_ENV_SINGLE_ARG_DECL) CORBA::SystemException )) { - this->inherited::destroy (this ACE_ENV_ARG_PARAMETER); + if (this->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER) == 1) + return; + + ACE_CHECK; + + this->ec_->remove (this ACE_ENV_ARG_PARAMETER); + ACE_CHECK; } void -TAO_NS_SupplierAdmin::set_qos (const CosNotification::QoSProperties & qos) +TAO_NS_SupplierAdmin::set_qos (const CosNotification::QoSProperties & qos ACE_ENV_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException , CosNotification::UnsupportedQoS )) { - this->qos_admin_->apply_qos (this, qos ACE_ENV_ARG_PARAMETER); + this->TAO_NS_Object::set_qos (qos ACE_ENV_ARG_PARAMETER); } -CosNotifyChannelAdmin::ProxyConsumer_ptr -TAO_NS_SupplierAdmin::obtain_notification_push_consumer (CosNotifyChannelAdmin::ClientType ctype, CosNotifyChannelAdmin::ProxyID_out proxy_id ACE_ENV_ARG_DECL) +CosNotification::QoSProperties* +TAO_NS_SupplierAdmin::get_qos (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException - , CosNotifyChannelAdmin::AdminLimitExceeded )) - { - return TAO_NS_PROPERTIES::instance()->builder ()->build_notification_push_consumer (this, - ctype, - proxy_id ACE_ENV_ARG_PARAMETER); + return this->TAO_NS_Object::get_qos (ACE_ENV_SINGLE_ARG_PARAMETER); } -CosNotifyChannelAdmin::AdminID TAO_NS_SupplierAdmin::MyID ( - - ) +CosNotifyChannelAdmin::ProxyConsumer_ptr +TAO_NS_SupplierAdmin::obtain_notification_push_consumer (CosNotifyChannelAdmin::ClientType ctype + , CosNotifyChannelAdmin::ProxyID_out proxy_id + ACE_ENV_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException + , CosNotifyChannelAdmin::AdminLimitExceeded )) { - return this->id (); + return TAO_NS_PROPERTIES::instance()->builder()->build_proxy (this + , ctype + , proxy_id + ACE_ENV_ARG_PARAMETER); } -::CosNotifyChannelAdmin::EventChannel_ptr TAO_NS_SupplierAdmin::MyChannel ( - - ) +CosEventChannelAdmin::ProxyPushConsumer_ptr +TAO_NS_SupplierAdmin::obtain_push_consumer (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException )) - { - //Add your implementation here - return 0; + return TAO_NS_PROPERTIES::instance()->builder()->build_proxy (this ACE_ENV_ARG_PARAMETER); } -::CosNotifyChannelAdmin::InterFilterGroupOperator -TAO_NS_SupplierAdmin::MyOperator (ACE_ENV_SINGLE_ARG_DECL) +CosNotifyChannelAdmin::AdminID +TAO_NS_SupplierAdmin::MyID (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) ACE_THROW_SPEC (( CORBA::SystemException )) { - return this->filter_operator_; + return this->id (); } -::CosNotifyChannelAdmin::ProxyIDSeq * TAO_NS_SupplierAdmin::pull_consumers ( - - ) +CosNotifyChannelAdmin::EventChannel_ptr +TAO_NS_SupplierAdmin::MyChannel (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException )) - { - //Add your implementation here - return 0; + return this->ec_->_this (ACE_ENV_SINGLE_ARG_DECL); } -::CosNotifyChannelAdmin::ProxyIDSeq * TAO_NS_SupplierAdmin::push_consumers ( - - ) +::CosNotifyChannelAdmin::InterFilterGroupOperator +TAO_NS_SupplierAdmin::MyOperator (ACE_ENV_SINGLE_ARG_DECL_NOT_USED) ACE_THROW_SPEC (( CORBA::SystemException )) - { - //Add your implementation here - return 0; + return this->filter_operator_; } -::CosNotifyChannelAdmin::ProxyConsumer_ptr TAO_NS_SupplierAdmin::get_proxy_consumer ( - CosNotifyChannelAdmin::ProxyID proxy_id - ) +CosNotifyChannelAdmin::ProxyIDSeq* +TAO_NS_SupplierAdmin::push_consumers (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException - , CosNotifyChannelAdmin::ProxyNotFound )) - { - //Add your implementation here - return 0; -} + TAO_NS_Seq_Worker_T seq_worker; -::CosNotifyChannelAdmin::ProxyConsumer_ptr TAO_NS_SupplierAdmin::obtain_notification_pull_consumer ( - CosNotifyChannelAdmin::ClientType ctype, - CosNotifyChannelAdmin::ProxyID_out proxy_id - ) - ACE_THROW_SPEC (( - CORBA::SystemException - , CosNotifyChannelAdmin::AdminLimitExceeded - )) - -{ - //Add your implementation here - return 0; + return seq_worker.create (*this->proxy_container_ ACE_ENV_ARG_PARAMETER); } -::CosNotification::QoSProperties * TAO_NS_SupplierAdmin::get_qos ( - - ) +CosNotifyChannelAdmin::ProxyConsumer_ptr +TAO_NS_SupplierAdmin::get_proxy_consumer (CosNotifyChannelAdmin::ProxyID proxy_id ACE_ENV_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException + , CosNotifyChannelAdmin::ProxyNotFound )) - { - //Add your implementation here - return 0; -} + TAO_NS_Find_Worker_T find_worker; -void TAO_NS_SupplierAdmin::validate_qos ( - const CosNotification::QoSProperties & required_qos, - CosNotification::NamedPropertyRangeSeq_out available_qos - ) - ACE_THROW_SPEC (( - CORBA::SystemException - , CosNotification::UnsupportedQoS - )) - -{ - //Add your implementation here + return find_worker.resolve (proxy_id, *this->proxy_container_ ACE_ENV_ARG_PARAMETER); } void @@ -208,11 +187,11 @@ TAO_NS_SupplierAdmin::offer_change (const CosNotification::EventTypeSeq & added, ACE_CHECK; this->subscribed_types_.init (seq_added, seq_removed); - } - TAO_NS_Subscription_Change_Worker worker (added, removed); + TAO_NS_Subscription_Change_Worker worker (added, removed); - this->collection_->for_each (&worker ACE_ENV_ARG_PARAMETER); + this->proxy_container_->collection ()->for_each (&worker ACE_ENV_ARG_PARAMETER); + } } CosNotifyFilter::FilterID @@ -259,29 +238,63 @@ TAO_NS_SupplierAdmin::remove_all_filters (ACE_ENV_SINGLE_ARG_DECL) CORBA::SystemException )) { - this->filter_admin_.get_all_filters (ACE_ENV_SINGLE_ARG_PARAMETER); + this->filter_admin_.remove_all_filters (ACE_ENV_SINGLE_ARG_PARAMETER); } -::CosEventChannelAdmin::ProxyPushConsumer_ptr TAO_NS_SupplierAdmin::obtain_push_consumer ( +/************** UNIMPLEMENTED METHODS ***************/ - ) +CosEventChannelAdmin::ProxyPullConsumer_ptr +TAO_NS_SupplierAdmin::obtain_pull_consumer (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException )) +{ + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), CosEventChannelAdmin::ProxyPullConsumer::_nil ()); +} +CosNotifyChannelAdmin::ProxyIDSeq* +TAO_NS_SupplierAdmin::pull_consumers (ACE_ENV_SINGLE_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException + )) { - //Add your implementation here - return 0; + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), 0); } -::CosEventChannelAdmin::ProxyPullConsumer_ptr TAO_NS_SupplierAdmin::obtain_pull_consumer ( - ) +void +TAO_NS_SupplierAdmin::validate_qos (const CosNotification::QoSProperties & /*required_qos*/, + CosNotification::NamedPropertyRangeSeq_out /*available_qos*/ + ACE_ENV_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException + , CosNotification::UnsupportedQoS )) +{ + ACE_THROW (CORBA::NO_IMPLEMENT ()); +} +CosNotifyChannelAdmin::ProxyConsumer_ptr +TAO_NS_SupplierAdmin::obtain_notification_pull_consumer (CosNotifyChannelAdmin::ClientType /*ctype*/, + CosNotifyChannelAdmin::ProxyID_out /*proxy_id*/ + ACE_ENV_ARG_DECL) + ACE_THROW_SPEC (( + CORBA::SystemException + , CosNotifyChannelAdmin::AdminLimitExceeded + )) { - //Add your implementation here - return 0; + ACE_THROW_RETURN (CORBA::NO_IMPLEMENT (), CosNotifyChannelAdmin::ProxyConsumer::_nil ()); } + + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) + +template class TAO_NS_Find_Worker_T; +template class TAO_NS_Find_Worker_T; + +#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) + +#pragma instantiate TAO_NS_Find_Worker_T +#pragma instantiate TAO_NS_Find_Worker_T + +#endif /*ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/SupplierAdmin.h b/TAO/orbsvcs/orbsvcs/Notify/SupplierAdmin.h index 28d75a6fd28..248c4335d6c 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/SupplierAdmin.h +++ b/TAO/orbsvcs/orbsvcs/Notify/SupplierAdmin.h @@ -21,7 +21,13 @@ #include "orbsvcs/CosNotifyChannelAdminS.h" #include "Admin.h" -#include "Destroy_Callback.h" + +#if defined(_MSC_VER) +#if (_MSC_VER >= 1200) +#pragma warning(push) +#endif /* _MSC_VER >= 1200 */ +#pragma warning(disable:4250) +#endif /* _MSC_VER */ /** * @class TAO_NS_SupplierAdmin @@ -29,9 +35,9 @@ * @brief Implementation of CosNotifyChannelAdmin::SupplierAdmin * */ -class TAO_Notify_Export TAO_NS_SupplierAdmin : public virtual POA_CosNotifyChannelAdmin::SupplierAdmin, public TAO_NS_Admin, public TAO_NS_Destroy_Callback +class TAO_Notify_Export TAO_NS_SupplierAdmin : public virtual POA_CosNotifyChannelAdmin::SupplierAdmin + , public virtual TAO_NS_Admin { - friend class TAO_NS_Builder; public: /// Constuctor TAO_NS_SupplierAdmin (void); @@ -39,171 +45,142 @@ public: /// Destructor ~TAO_NS_SupplierAdmin (); - /// Return servant - virtual PortableServer::Servant servant (void); + /// Init + void init (TAO_NS_EventChannel *ec ACE_ENV_ARG_DECL); /// ServantBase refcount methods. virtual void _add_ref (ACE_ENV_SINGLE_ARG_DECL); virtual void _remove_ref (ACE_ENV_SINGLE_ARG_DECL); - /// TAO_NS_Destroy_Callback methods + /// Release virtual void release (void); protected: /// = CosNotifyChannelAdmin::SupplierAdmin methods - virtual CosNotifyChannelAdmin::AdminID MyID ( - - ) + virtual CosNotifyChannelAdmin::AdminID MyID (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException )); - virtual ::CosNotifyChannelAdmin::EventChannel_ptr MyChannel ( - - ) + virtual ::CosNotifyChannelAdmin::EventChannel_ptr MyChannel (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException )); - virtual ::CosNotifyChannelAdmin::InterFilterGroupOperator MyOperator ( - - ) + virtual ::CosNotifyChannelAdmin::InterFilterGroupOperator MyOperator (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException )); - virtual ::CosNotifyChannelAdmin::ProxyIDSeq * pull_consumers ( - - ) + virtual ::CosNotifyChannelAdmin::ProxyIDSeq * pull_consumers (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException )); - virtual ::CosNotifyChannelAdmin::ProxyIDSeq * push_consumers ( - - ) + virtual ::CosNotifyChannelAdmin::ProxyIDSeq * push_consumers (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException )); - virtual ::CosNotifyChannelAdmin::ProxyConsumer_ptr get_proxy_consumer ( - CosNotifyChannelAdmin::ProxyID proxy_id - ) + virtual ::CosNotifyChannelAdmin::ProxyConsumer_ptr get_proxy_consumer (CosNotifyChannelAdmin::ProxyID proxy_id + ACE_ENV_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException , CosNotifyChannelAdmin::ProxyNotFound )); - virtual ::CosNotifyChannelAdmin::ProxyConsumer_ptr obtain_notification_pull_consumer ( - CosNotifyChannelAdmin::ClientType ctype, + virtual ::CosNotifyChannelAdmin::ProxyConsumer_ptr obtain_notification_pull_consumer (CosNotifyChannelAdmin::ClientType ctype, CosNotifyChannelAdmin::ProxyID_out proxy_id + ACE_ENV_ARG_DECL ) ACE_THROW_SPEC (( CORBA::SystemException , CosNotifyChannelAdmin::AdminLimitExceeded )); - virtual ::CosNotifyChannelAdmin::ProxyConsumer_ptr obtain_notification_push_consumer ( - CosNotifyChannelAdmin::ClientType ctype, + virtual ::CosNotifyChannelAdmin::ProxyConsumer_ptr obtain_notification_push_consumer (CosNotifyChannelAdmin::ClientType ctype, CosNotifyChannelAdmin::ProxyID_out proxy_id + ACE_ENV_ARG_DECL ) ACE_THROW_SPEC (( CORBA::SystemException , CosNotifyChannelAdmin::AdminLimitExceeded )); - virtual void destroy ( - - ) + virtual void destroy (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException )); - virtual ::CosNotification::QoSProperties * get_qos ( - - ) + virtual ::CosNotification::QoSProperties* get_qos (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException )); - virtual void set_qos ( - const CosNotification::QoSProperties & qos - ) + virtual void set_qos (const CosNotification::QoSProperties& qos ACE_ENV_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException , CosNotification::UnsupportedQoS )); - virtual void validate_qos ( - const CosNotification::QoSProperties & required_qos, + virtual void validate_qos (const CosNotification::QoSProperties & required_qos, CosNotification::NamedPropertyRangeSeq_out available_qos - ) + ACE_ENV_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException , CosNotification::UnsupportedQoS )); - virtual void offer_change ( - const CosNotification::EventTypeSeq & added, + virtual void offer_change (const CosNotification::EventTypeSeq & added, const CosNotification::EventTypeSeq & removed - ) + ACE_ENV_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException , CosNotifyComm::InvalidEventType )); - virtual CosNotifyFilter::FilterID add_filter ( - CosNotifyFilter::Filter_ptr new_filter - ) + virtual CosNotifyFilter::FilterID add_filter (CosNotifyFilter::Filter_ptr new_filter ACE_ENV_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException )); - virtual void remove_filter ( - CosNotifyFilter::FilterID filter - ) + virtual void remove_filter (CosNotifyFilter::FilterID filter ACE_ENV_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException , CosNotifyFilter::FilterNotFound )); - virtual ::CosNotifyFilter::Filter_ptr get_filter ( - CosNotifyFilter::FilterID filter - ) + virtual ::CosNotifyFilter::Filter_ptr get_filter (CosNotifyFilter::FilterID filter ACE_ENV_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException , CosNotifyFilter::FilterNotFound )); - virtual ::CosNotifyFilter::FilterIDSeq * get_all_filters ( - - ) + virtual ::CosNotifyFilter::FilterIDSeq * get_all_filters (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException )); - virtual void remove_all_filters ( - - ) + virtual void remove_all_filters (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException )); - virtual ::CosEventChannelAdmin::ProxyPushConsumer_ptr obtain_push_consumer ( - - ) + virtual ::CosEventChannelAdmin::ProxyPushConsumer_ptr obtain_push_consumer (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException )); - virtual ::CosEventChannelAdmin::ProxyPullConsumer_ptr obtain_pull_consumer ( - - ) + virtual ::CosEventChannelAdmin::ProxyPullConsumer_ptr obtain_pull_consumer (ACE_ENV_SINGLE_ARG_DECL) ACE_THROW_SPEC (( CORBA::SystemException )); }; +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +#pragma warning(pop) +#endif /* _MSC_VER */ + #if defined (__ACE_INLINE__) #include "SupplierAdmin.inl" #endif /* __ACE_INLINE__ */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/SupplierAdmin.inl b/TAO/orbsvcs/orbsvcs/Notify/SupplierAdmin.inl index 42ef0b9d672..cfa1da318d3 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/SupplierAdmin.inl +++ b/TAO/orbsvcs/orbsvcs/Notify/SupplierAdmin.inl @@ -1,3 +1 @@ // $Id$ - -#include "SupplierAdmin.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/Supplier_Map.h b/TAO/orbsvcs/orbsvcs/Notify/Supplier_Map.h new file mode 100644 index 00000000000..9a1d8034548 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Notify/Supplier_Map.h @@ -0,0 +1,35 @@ +/* -*- C++ -*- */ +/** + * @file Supplier_Map.h + * + * $Id$ + * + * @author Pradeep Gore + * + * + */ + +#ifndef TAO_NS_SUPPLIER_MAP_H +#define TAO_NS_SUPPLIER_MAP_H +#include "ace/pre.h" + +#include "notify_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "Event_Map_T.h" +#include "ProxyConsumer.h" + +/** + * @class TAO_NS_Supplier_Map + * + * @brief The Event Map for Suppliers. + * + */ + +typedef TAO_NS_Event_Map_T TAO_NS_Supplier_Map; + +#include "ace/post.h" +#endif /* TAO_NS_SUPPLIER_MAP_H */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/ThreadPool_Task.cpp b/TAO/orbsvcs/orbsvcs/Notify/ThreadPool_Task.cpp index 726ccb47499..5829dd3348e 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/ThreadPool_Task.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/ThreadPool_Task.cpp @@ -1,9 +1,6 @@ // $Id$ -#include "tao/debug.h" #include "ThreadPool_Task.h" -#include "Properties.h" -#include "Method_Request_Shutdown.h" #if ! defined (__ACE_INLINE__) #include "ThreadPool_Task.inl" @@ -11,30 +8,74 @@ ACE_RCSID(RT_Notify, TAO_NS_ThreadPool_Task, "$Id$") +#include "tao/debug.h" +#include "Properties.h" +#include "Timer_Queue.h" + TAO_NS_ThreadPool_Task::TAO_NS_ThreadPool_Task (void) - : activation_queue_ (msg_queue ()) + : buffering_strategy_ (0), shutdown_ (0), timer_ (0) { } TAO_NS_ThreadPool_Task::~TAO_NS_ThreadPool_Task () { + delete this->buffering_strategy_; +} + +int +TAO_NS_ThreadPool_Task::init (int argc, char **argv) +{ + return this->ACE_Task::init (argc, argv); +} + +TAO_NS_Timer* +TAO_NS_ThreadPool_Task::timer (void) +{ + this->timer_->_incr_refcnt (); + + return this->timer_; } void -TAO_NS_ThreadPool_Task::init (NotifyExt::ThreadPoolParams* tp_params ACE_ENV_ARG_DECL) +TAO_NS_ThreadPool_Task::init (const NotifyExt::ThreadPoolParams& tp_params, TAO_NS_AdminProperties_var& admin_properties ACE_ENV_ARG_DECL) { + ACE_NEW_THROW_EX (this->timer_, + TAO_NS_Timer_Queue (), + CORBA::NO_MEMORY ()); + ACE_CHECK; + + ACE_NEW_THROW_EX (this->buffering_strategy_, + TAO_NS_Buffering_Strategy (*msg_queue (), admin_properties, 1), + CORBA::NO_MEMORY ()); + ACE_CHECK; + long flags = THR_NEW_LWP | THR_JOINABLE; flags |= TAO_NS_PROPERTIES::instance()->scope_policy () | TAO_NS_PROPERTIES::instance()->sched_policy (); + // Increment the count on this object by the number of threads using it. + { + ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->TAO_NS_Refcountable::lock_); + + this->refcount_+=tp_params.static_threads; + } + // Become an active object. - if (this->ACE_Task ::activate (flags, - tp_params->static_threads, - 0, - tp_params->default_priority) == -1) + if (this->ACE_Task ::activate (flags, + tp_params.static_threads, + 0, + ACE_THR_PRI_OTHER_DEF) == -1) { + // Decrement the count on this object. We know that this object's owner is holding a count on this object so + // we can neglect our responsibility of checking if the refcount is decremented to 0. + { + ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->TAO_NS_Refcountable::lock_); + + this->refcount_-=tp_params.static_threads; + } + if (TAO_debug_level > 0) { if (ACE_OS::last_error () == EPERM) @@ -43,56 +84,97 @@ TAO_NS_ThreadPool_Task::init (NotifyExt::ThreadPoolParams* tp_params ACE_ENV_ARG ACE_DEBUG ((LM_ERROR, ACE_TEXT ("(%t) task activation at priority %d failed\n") ACE_TEXT ("exiting!\n%a"), - tp_params->default_priority)); + tp_params.default_priority)); } - ACE_THROW (CORBA::BAD_PARAM ()); - } + ACE_THROW (CORBA::BAD_PARAM ()); + } } void TAO_NS_ThreadPool_Task::exec (TAO_NS_Method_Request& method_request) { - /// Use Buffering Strategy - - TAO_NS_Method_Request* request_copy = method_request.copy (); + TAO_NS_Method_Request& request_copy = *method_request.copy (); - this->activation_queue_.enqueue (request_copy); + if (this->buffering_strategy_->enqueue (request_copy) == -1) + { + if (TAO_debug_level > 0) + ACE_DEBUG ((LM_DEBUG, "NS_ThreadPool_Task (%P|%t) - " + "failed to enqueue\n")); + } } int TAO_NS_ThreadPool_Task::svc (void) { - for (;;) - { - // Dequeue the next method request (we use an auto pointer in - // case an exception is thrown in the ). - ACE_Method_Request *mo_p = this->activation_queue_.dequeue (); + TAO_NS_Method_Request* method_request; - if (0 == mo_p) + while (!shutdown_) + { + ACE_TRY_NEW_ENV { - if (TAO_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, - ACE_LIB_TEXT ("(%t) activation queue shut down\n"))); - break; + ACE_Time_Value* dequeue_blocking_time = 0; + ACE_Time_Value earliest_time; + + if (!this->timer_->impl().is_empty ()) + { + earliest_time = this->timer_->impl().earliest_time (); + dequeue_blocking_time = &earliest_time; + } + + // Dequeue 1 item + int result = buffering_strategy_->dequeue (method_request, dequeue_blocking_time); + + if (result > 0) + { + method_request->execute (ACE_ENV_SINGLE_ARG_PARAMETER); + ACE_TRY_CHECK; + + ACE_Message_Block::release (method_request); + } + else if (errno == ETIME) + { + this->timer_->impl ().expire (); + } + else if (result == -1) + { + if (TAO_debug_level > 0) + ACE_DEBUG ((LM_DEBUG, "ThreadPool_Task dequeue failed\n")); + } } - auto_ptr mo (mo_p); - - // Call it. - if(mo->call () == -1) - break; - - // Destructor automatically deletes it. - } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, + "ThreadPool_Task (%P|%t) exception in method request\n"); + } + ACE_ENDTRY; + } /* while */ return 0; } - void TAO_NS_ThreadPool_Task::shutdown (void) { - this->activation_queue_.enqueue (new TAO_NS_Method_Request_Shutdown (this)); - this->wait (); + this->shutdown_ = 1; + + this->buffering_strategy_->shutdown (); + return; } + +void +TAO_NS_ThreadPool_Task::release (void) +{ + this->timer_->_decr_refcnt (); + + delete this; +} + +int +TAO_NS_ThreadPool_Task::close (u_long /*flags*/) +{ + this->_decr_refcnt (); + + return 0; +} diff --git a/TAO/orbsvcs/orbsvcs/Notify/ThreadPool_Task.h b/TAO/orbsvcs/orbsvcs/Notify/ThreadPool_Task.h index 8b6515877d1..256e45c54fd 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/ThreadPool_Task.h +++ b/TAO/orbsvcs/orbsvcs/Notify/ThreadPool_Task.h @@ -20,9 +20,14 @@ #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "ace/Task.h" -#include "ace/Activation_Queue.h" -#include "orbsvcs/NotifyExtC.h" +#include "ace/Message_Queue.h" +#include "ace/Reactor.h" +#include "AdminProperties.h" #include "Worker_Task.h" +#include "Destroy_Callback.h" + +class TAO_NS_Buffering_Strategy; +class TAO_NS_Timer_Queue; /** * @class TAO_NS_ThreadPool_Task @@ -30,7 +35,7 @@ * @brief Implements a Thread Pool Worker Task. * */ -class TAO_Notify_Export TAO_NS_ThreadPool_Task : public TAO_NS_Worker_Task, ACE_Task +class TAO_Notify_Export TAO_NS_ThreadPool_Task : public TAO_NS_Worker_Task, ACE_Task, public TAO_NS_Destroy_Callback { friend class TAO_NS_Method_Request_Shutdown; @@ -41,8 +46,16 @@ public: /// Destructor ~TAO_NS_ThreadPool_Task (); + /// Call the base class init + virtual int init (int argc, char **argv); + + virtual int close (u_long flags); + + /// Release + virtual void release (void); + /// Activate the threadpool - void init (NotifyExt::ThreadPoolParams* tp_params ACE_ENV_ARG_DECL); + void init (const NotifyExt::ThreadPoolParams& tp_params, TAO_NS_AdminProperties_var& admin_properties ACE_ENV_ARG_DECL); /// Queue the request virtual void exec (TAO_NS_Method_Request& method_request); @@ -50,13 +63,28 @@ public: /// Shutdown task virtual void shutdown (void); + /// Update QoS Properties. + virtual void update_qos_properties (const TAO_NS_QoSProperties& qos_properties); + + /// The object used by clients to register timers. + virtual TAO_NS_Timer* timer (void); + + /// Access the Buffering Strategy. + TAO_NS_Buffering_Strategy* buffering_strategy (void); + protected: /// task svc virtual int svc (void); private: - /// Activation Queue - ACE_Activation_Queue activation_queue_; + /// The buffering strategy to use. + TAO_NS_Buffering_Strategy* buffering_strategy_; + + /// Shutdown + int shutdown_; + + /// The Queue based timer. + TAO_NS_Timer_Queue* timer_; }; #if defined (__ACE_INLINE__) diff --git a/TAO/orbsvcs/orbsvcs/Notify/ThreadPool_Task.inl b/TAO/orbsvcs/orbsvcs/Notify/ThreadPool_Task.inl index fbfedd2a6d5..27f363d90ce 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/ThreadPool_Task.inl +++ b/TAO/orbsvcs/orbsvcs/Notify/ThreadPool_Task.inl @@ -1,3 +1,15 @@ // $Id$ -#include "ThreadPool_Task.h" +#include "Buffering_Strategy.h" + +ACE_INLINE void +TAO_NS_ThreadPool_Task::update_qos_properties (const TAO_NS_QoSProperties& qos_properties) +{ + this->buffering_strategy_->update_qos_properties (qos_properties); +} + +ACE_INLINE TAO_NS_Buffering_Strategy* +TAO_NS_ThreadPool_Task::buffering_strategy (void) +{ + return this->buffering_strategy_; +} diff --git a/TAO/orbsvcs/orbsvcs/Notify/Timer_Queue.cpp b/TAO/orbsvcs/orbsvcs/Notify/Timer_Queue.cpp index b7d4bbcd16e..aa80ab73163 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Timer_Queue.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Timer_Queue.cpp @@ -8,10 +8,8 @@ ACE_RCSID(Notify, TAO_NS_Timer_Queue, "$id$") - TAO_NS_Timer_Queue::TAO_NS_Timer_Queue (void) { - this->destroy_callback (this); } TAO_NS_Timer_Queue::~TAO_NS_Timer_Queue () diff --git a/TAO/orbsvcs/orbsvcs/Notify/Timer_Queue.h b/TAO/orbsvcs/orbsvcs/Notify/Timer_Queue.h index 3e8bbdb30f3..52dea61911b 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Timer_Queue.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Timer_Queue.h @@ -20,7 +20,6 @@ #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "Timer.h" -#include "Destroy_Callback.h" #include "ace/Timer_Queue.h" #include "ace/Timer_Heap.h" @@ -32,7 +31,6 @@ * */ class TAO_Notify_Export TAO_NS_Timer_Queue : public TAO_NS_Timer - , public TAO_NS_Destroy_Callback { public: /// Constuctor @@ -41,7 +39,7 @@ public: /// Destructor virtual ~TAO_NS_Timer_Queue (); - /// TAO_NS_Destroy_Callback methods + /// Release virtual void release (void); /// Schedule a timer diff --git a/TAO/orbsvcs/orbsvcs/Notify/Timer_Reactor.cpp b/TAO/orbsvcs/orbsvcs/Notify/Timer_Reactor.cpp index 6e57a1cdd62..41709be90df 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Timer_Reactor.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Timer_Reactor.cpp @@ -15,9 +15,7 @@ ACE_RCSID(Notify, TAO_NS_Timer_Reactor, "$id$") TAO_NS_Timer_Reactor::TAO_NS_Timer_Reactor (void) :reactor_ (0) { - this->destroy_callback (this); - - // Get the ORB + // Get the ORB CORBA::ORB_var orb = TAO_NS_PROPERTIES::instance()->orb (); this->reactor_ = orb->orb_core ()->reactor (); diff --git a/TAO/orbsvcs/orbsvcs/Notify/Timer_Reactor.h b/TAO/orbsvcs/orbsvcs/Notify/Timer_Reactor.h index eb0cb6e40d2..67953bb5576 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Timer_Reactor.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Timer_Reactor.h @@ -20,7 +20,6 @@ #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "Timer.h" -#include "Destroy_Callback.h" class ACE_Reactor; @@ -31,7 +30,6 @@ class ACE_Reactor; * */ class TAO_Notify_Export TAO_NS_Timer_Reactor : public TAO_NS_Timer - , public TAO_NS_Destroy_Callback { public: /// Constuctor @@ -40,7 +38,7 @@ public: /// Destructor virtual ~TAO_NS_Timer_Reactor (); - /// TAO_NS_Destroy_Callback methods + /// Release virtual void release (void); /// Schedule a timer diff --git a/TAO/orbsvcs/orbsvcs/Notify/Worker_Task.cpp b/TAO/orbsvcs/orbsvcs/Notify/Worker_Task.cpp index 6abd835bfe5..ae9f9efab55 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Worker_Task.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Worker_Task.cpp @@ -17,7 +17,6 @@ TAO_NS_Worker_Task::~TAO_NS_Worker_Task () } void -TAO_NS_Worker_Task::shutdown (void) +TAO_NS_Worker_Task::update_qos_properties (const TAO_NS_QoSProperties& /*qos_properties*/) { - return; } diff --git a/TAO/orbsvcs/orbsvcs/Notify/Worker_Task.h b/TAO/orbsvcs/orbsvcs/Notify/Worker_Task.h index c10c70d5581..2eef3710451 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Worker_Task.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Worker_Task.h @@ -20,27 +20,46 @@ #endif /* ACE_LACKS_PRAGMA_ONCE */ #include "Method_Request.h" +#include "Refcountable.h" + +class TAO_NS_AdminProperties; +class TAO_NS_QoSProperties; +class TAO_NS_Timer; +class TAO_NS_Buffering_Strategy; /** * @class TAO_NS_Worker_Task * * @brief Base Worker Task. * + * Memory Management : The Worker Task should be allocated on the heap and + * the method should be called to release memory. + * */ -class TAO_Notify_Export TAO_NS_Worker_Task +class TAO_Notify_Export TAO_NS_Worker_Task : public TAO_NS_Refcountable { public: /// Constuctor TAO_NS_Worker_Task (void); - /// Destructor - virtual ~TAO_NS_Worker_Task (); + /// Update QoS Properties. + virtual void update_qos_properties (const TAO_NS_QoSProperties& qos_properties); + ///= Public method to be implemented by subclasses. /// Exec the request. virtual void exec (TAO_NS_Method_Request& method_request) = 0; /// Shutdown task - virtual void shutdown (void); + virtual void shutdown (void) = 0; + + /// The object used by clients to register timers. + virtual TAO_NS_Timer* timer (void) = 0; + + virtual TAO_NS_Buffering_Strategy* buffering_strategy (void) = 0; + +protected: + /// Destructor + virtual ~TAO_NS_Worker_Task (); }; #if defined (__ACE_INLINE__) diff --git a/TAO/orbsvcs/orbsvcs/Notify/Worker_Task.inl b/TAO/orbsvcs/orbsvcs/Notify/Worker_Task.inl index 8033deae834..cfa1da318d3 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Worker_Task.inl +++ b/TAO/orbsvcs/orbsvcs/Notify/Worker_Task.inl @@ -1,3 +1 @@ // $Id$ - -#include "Worker_Task.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/notify_export.h b/TAO/orbsvcs/orbsvcs/Notify/notify_export.h index 35d26b85690..d17be740d41 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/notify_export.h +++ b/TAO/orbsvcs/orbsvcs/Notify/notify_export.h @@ -1,3 +1,4 @@ + // -*- C++ -*- // $Id$ // Definition for Win32 Export directives. -- cgit v1.2.1