diff options
author | pradeep <pradeep@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2002-11-05 01:37:12 +0000 |
---|---|---|
committer | pradeep <pradeep@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2002-11-05 01:37:12 +0000 |
commit | 6eab01dc254868a9add4e8899c0b46010b59532a (patch) | |
tree | 1382e795c45f71e0f987095d7f4026d8d7c66334 | |
parent | e04ace9e73453ed47039eca3277c2a810abd978c (diff) | |
download | ATCD-6eab01dc254868a9add4e8899c0b46010b59532a.tar.gz |
ChangeLogTag:Mon Nov 4 19:03:12 CST 2002 Pradeep Gore <pradeep@oomworks.com>
31 files changed, 245 insertions, 1746 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index 3b4be40153e..e562d016104 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,7 +1,74 @@ Mon Nov 4 19:03:12 CST 2002 Pradeep Gore <pradeep@oomworks.com> - * orbsvcs/orbsvcs/Makefile.CosNotification: - Added missing "/" after $ACE_ROOT + * (Removed previous bogus ChangeLog entry). + + * orbsvcs/orbsvcs/CosNotification.bor: + Thanks to Christopher Kohlhoff <chris@kohlhoff.com>, Johnny + Willemsen <jwillemsen@remedy.nl>, Irfan, Nanbor and Bala for help in + correcting the .bor file. + + * tao/Messaging/Makefile.bor: + Applied change in INCLUDE provided by Christopher Kohlhoff + <chris@kohlhoff.com>. + + * orbsvcs/orbsvcs/Notify/Builder.cpp: + In method <build_filter_factory> create a filter factory if we + could not obtain one as a dynamic service. + + * orbsvcs/orbsvcs/Notify/Event_Map_Observer_T.cpp: + TAO_NS_Update_Added_Worker<PROXY>::work, moved call to + type_added inside the "if" statement. + + Following files were modified for backward compatibility as some + application might be calling their <init_svc> method. + * orbsvcs/orbsvcs/Notify/Notify_Default_CO_Factory.cpp: + * orbsvcs/orbsvcs/Notify/Notify_Default_CO_Factory.h: + * orbsvcs/orbsvcs/Notify/Notify_Default_Collection_Factory.cpp: + * orbsvcs/orbsvcs/Notify/Notify_Default_Collection_Factory.h: + * orbsvcs/orbsvcs/Notify/Notify_Default_EMO_Factory.cpp: + * orbsvcs/orbsvcs/Notify/Notify_Default_EMO_Factory.h: + * orbsvcs/orbsvcs/Notify/Notify_Default_POA_Factory.cpp: + * orbsvcs/orbsvcs/Notify/Notify_Default_POA_Factory.h: + + * orbsvcs/orbsvcs/Notify/Notify_EventChannelFactory_i.cpp: + * orbsvcs/orbsvcs/Notify/Notify_EventChannelFactory_i.h: + static <create> method maintained for backward compatibility. + + * orbsvcs/orbsvcs/Notify/Notify_Service.cpp: + * orbsvcs/orbsvcs/Notify/Notify_Service.h: + In method TAO_NS_Notify_Service::init - added old options for + backward compatibility. + Revived Service Object + Notify_Default_Event_Manager_Objects_Factory. + + * orbsvcs/orbsvcs/Notify/Properties.cpp: + * orbsvcs/orbsvcs/Notify/Properties.h: + Defined TAO_NS_DEFAULT_UPDATES_PERIOD instead of using a magic + number for the subscription/publication change update + notification interval. + + * orbsvcs/orbsvcs/Notify/Proxy.cpp: + Added missing initialization of updates_off_ data member. + + * orbsvcs/orbsvcs/Notify/Service.h: + Defined the string name for the Notify_Default_Event_Manager_Objects_Factory. + + * orbsvcs/orbsvcs/Notify/Any/PushConsumer.cpp: + * orbsvcs/orbsvcs/Notify/Any/PushSupplier.cpp: + Check if narrow fails because CosEventComm client was connecting + and does not support NotifySubscribe. + + * orbsvcs/orbsvcs/Notify/Sequence/SequencePushConsumer.cpp: + * orbsvcs/orbsvcs/Notify/Sequence/SequencePushSupplier.cpp: + * orbsvcs/orbsvcs/Notify/Structured/StructuredPushConsumer.cpp: + * orbsvcs/orbsvcs/Notify/Structured/StructuredPushSupplier.cpp: + Replaced unnecessary calls to _narrow with _duplicate. Thanks to + Irfan for pointing this out. + + * orbsvcs/Notify_Service/Notify_Service.cpp: + * orbsvcs/Logging_Service/Notify_Logging_Service/Notify_Logging_Service.cpp: + Remove explicit instantiation of Dynamic_Service<TAO_NS_Service> + as its now defined in Notify_EventChannelFactory_i.cpp. Mon Nov 4 14:21:18 2002 Balachandran Natarajan <bala@isis-server.isis.vanderbilt.edu> diff --git a/TAO/orbsvcs/Logging_Service/Notify_Logging_Service/Notify_Logging_Service.cpp b/TAO/orbsvcs/Logging_Service/Notify_Logging_Service/Notify_Logging_Service.cpp index 2483d2b98b3..a66fd7bd4e0 100644 --- a/TAO/orbsvcs/Logging_Service/Notify_Logging_Service/Notify_Logging_Service.cpp +++ b/TAO/orbsvcs/Logging_Service/Notify_Logging_Service/Notify_Logging_Service.cpp @@ -187,16 +187,3 @@ Notify_Logging_Service::shutdown (ACE_ENV_SINGLE_ARG_DECL) this->orb_->shutdown (); } - - -/*****************************************************************/ - -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) - -template class ACE_Dynamic_Service<TAO_NS_Service>; - -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) - -#pragma instantiate ACE_Dynamic_Service<TAO_NS_Service> - -#endif /*ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/orbsvcs/Notify_Service/Notify_Service.cpp b/TAO/orbsvcs/Notify_Service/Notify_Service.cpp index 156147ad563..33d5479eb48 100644 --- a/TAO/orbsvcs/Notify_Service/Notify_Service.cpp +++ b/TAO/orbsvcs/Notify_Service/Notify_Service.cpp @@ -43,7 +43,7 @@ TAO_Notify_Service::init_ORB (int& argc, ACE_TCHAR *argv [] ACE_ENV_ARG_PARAMETER); ACE_CHECK_RETURN (-1); - this->notify_service_ = ACE_Dynamic_Service<TAO_NS_Service>::instance (TAO_NS_COS_NOTIFICATION_SERVICE_NAME); //("TAO_NS_Service"); + this->notify_service_ = ACE_Dynamic_Service<TAO_NS_Service>::instance (TAO_NS_COS_NOTIFICATION_SERVICE_NAME); if (this->notify_service_ == 0) { @@ -451,13 +451,3 @@ Worker::svc (void) ACE_ENDTRY; return 0; } - -#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) - -template class ACE_Dynamic_Service<TAO_NS_Service>; - -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) - -#pragma instantiate ACE_Dynamic_Service<TAO_NS_Service> - -#endif /*ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/orbsvcs/orbsvcs/CosNotification.bor b/TAO/orbsvcs/orbsvcs/CosNotification.bor index 7346980e018..2ad6e8454dd 100644 --- a/TAO/orbsvcs/orbsvcs/CosNotification.bor +++ b/TAO/orbsvcs/orbsvcs/CosNotification.bor @@ -35,13 +35,13 @@ OBJFILES = \ $(OBJDIR)\Event_Manager.obj \ $(OBJDIR)\Admin.obj \ $(OBJDIR)\AdminProperties.obj \ - $(OBJDIR)\Any\AnyEvent.obj \ - $(OBJDIR)\Any\CosEC_ProxyPushConsumer.obj \ - $(OBJDIR)\Any\CosEC_ProxyPushSupplier.obj \ - $(OBJDIR)\Any\ProxyPushConsumer.obj \ - $(OBJDIR)\Any\ProxyPushSupplier.obj \ - $(OBJDIR)\Any\PushConsumer.obj \ - $(OBJDIR)\Any\PushSupplier.obj \ + $(OBJDIR)\AnyEvent.obj \ + $(OBJDIR)\CosEC_ProxyPushConsumer.obj \ + $(OBJDIR)\CosEC_ProxyPushSupplier.obj \ + $(OBJDIR)\ProxyPushConsumer.obj \ + $(OBJDIR)\ProxyPushSupplier.obj \ + $(OBJDIR)\PushConsumer.obj \ + $(OBJDIR)\PushSupplier.obj \ $(OBJDIR)\Buffering_Strategy.obj \ $(OBJDIR)\Builder.obj \ $(OBJDIR)\Consumer.obj \ @@ -73,17 +73,17 @@ OBJFILES = \ $(OBJDIR)\QoSProperties.obj \ $(OBJDIR)\Reactive_Task.obj \ $(OBJDIR)\Refcountable.obj \ - $(OBJDIR)\Sequence\EventBatch.obj \ - $(OBJDIR)\Sequence\Method_Request_Dispatch_EventBatch.obj \ - $(OBJDIR)\Sequence\SequenceProxyPushConsumer.obj \ - $(OBJDIR)\Sequence\SequenceProxyPushSupplier.obj \ - $(OBJDIR)\Sequence\SequencePushConsumer.obj \ - $(OBJDIR)\Sequence\SequencePushSupplier.obj \ - $(OBJDIR)\Structured\StructuredEvent.obj \ - $(OBJDIR)\Structured\StructuredProxyPushConsumer.obj \ - $(OBJDIR)\Structured\StructuredProxyPushSupplier.obj \ - $(OBJDIR)\Structured\StructuredPushConsumer.obj \ - $(OBJDIR)\Structured\StructuredPushSupplier.obj \ + $(OBJDIR)\EventBatch.obj \ + $(OBJDIR)\Method_Request_Dispatch_EventBatch.obj \ + $(OBJDIR)\SequenceProxyPushConsumer.obj \ + $(OBJDIR)\SequenceProxyPushSupplier.obj \ + $(OBJDIR)\SequencePushConsumer.obj \ + $(OBJDIR)\SequencePushSupplier.obj \ + $(OBJDIR)\StructuredEvent.obj \ + $(OBJDIR)\StructuredProxyPushConsumer.obj \ + $(OBJDIR)\StructuredProxyPushSupplier.obj \ + $(OBJDIR)\StructuredPushConsumer.obj \ + $(OBJDIR)\StructuredPushSupplier.obj \ $(OBJDIR)\Supplier.obj \ $(OBJDIR)\Subscription_Change_Worker.obj \ $(OBJDIR)\SupplierAdmin.obj \ @@ -93,7 +93,12 @@ OBJFILES = \ $(OBJDIR)\ETCL_Filter.obj \ $(OBJDIR)\ETCL_FilterFactory.obj \ $(OBJDIR)\Constraint_Interpreter.obj \ - $(OBJDIR)\Constraint_Visitors.obj + $(OBJDIR)\Constraint_Visitors.obj \ + $(OBJDIR)\Notify_Default_CO_Factory.obj \ + $(OBJDIR)\Notify_Default_Collection_Factory.obj \ + $(OBJDIR)\Notify_Default_EMO_Factory.obj \ + $(OBJDIR)\Notify_Default_POA_Factory.obj \ + $(OBJDIR)\Notify_EventChannelFactory_i.obj RESOURCE = $(OBJDIR)\CosNotification.res @@ -108,7 +113,7 @@ CFLAGS = \ $(TAO_NOTIFY_CFLAGS) \ -DTAO_NOTIFY_BUILD_DLL -CPPDIR = .;Notify;Notify\Any;Notify\Structured\;Notify\Sequence; +CPPDIR = .;Notify;Notify\Any;Notify\Structured\;Notify\Sequence IDLDIR = . diff --git a/TAO/orbsvcs/orbsvcs/Makefile.CosNotification b/TAO/orbsvcs/orbsvcs/Makefile.CosNotification index 5dcc60b5c96..51d46ac2309 100644 --- a/TAO/orbsvcs/orbsvcs/Makefile.CosNotification +++ b/TAO/orbsvcs/orbsvcs/Makefile.CosNotification @@ -149,7 +149,12 @@ CPP_SRCS += \ Notify/SupplierAdmin \ Notify/ThreadPool_Task \ Notify/Types \ - Notify/Worker_Task + Notify/Worker_Task \ + Notify/Notify_Default_CO_Factory \ + Notify/Notify_Default_Collection_Factory \ + Notify/Notify_Default_EMO_Factory \ + Notify/Notify_Default_POA_Factory \ + Notify/Notify_EventChannelFactory_i CPP_SRCS += \ Notify/ETCL_Filter \ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Any/PushConsumer.cpp b/TAO/orbsvcs/orbsvcs/Notify/Any/PushConsumer.cpp index d150a1c1c01..ec6b2298fac 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Any/PushConsumer.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Any/PushConsumer.cpp @@ -24,8 +24,7 @@ TAO_NS_PushConsumer::~TAO_NS_PushConsumer () void TAO_NS_PushConsumer::init (CosEventComm::PushConsumer_ptr push_consumer ACE_ENV_ARG_DECL) { - this->push_consumer_ = CosEventComm::PushConsumer::_narrow (push_consumer ACE_ENV_ARG_PARAMETER); - ACE_CHECK; + this->push_consumer_ = CosEventComm::PushConsumer::_duplicate (push_consumer); ACE_TRY { @@ -34,8 +33,7 @@ TAO_NS_PushConsumer::init (CosEventComm::PushConsumer_ptr push_consumer ACE_ENV_ } ACE_CATCHANY { - // Ignore - // if the client is not running an event loop and _narrow goes remote, we get a transient exception! + // _narrow failed which probably means the interface is CosEventComm type. } ACE_ENDTRY; } diff --git a/TAO/orbsvcs/orbsvcs/Notify/Any/PushSupplier.cpp b/TAO/orbsvcs/orbsvcs/Notify/Any/PushSupplier.cpp index 964f1e7976a..31f8345add7 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Any/PushSupplier.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Any/PushSupplier.cpp @@ -18,11 +18,20 @@ TAO_NS_PushSupplier::~TAO_NS_PushSupplier () } void -TAO_NS_PushSupplier::init (CosEventComm::PushSupplier_ptr push_supplier ACE_ENV_ARG_DECL) +TAO_NS_PushSupplier::init (CosEventComm::PushSupplier_ptr push_supplier ACE_ENV_ARG_DECL_NOT_USED) { this->push_supplier_ = CosEventComm::PushSupplier::_duplicate (push_supplier); - this->subscribe_ = CosNotifyComm::NotifySubscribe::_narrow (push_supplier ACE_ENV_ARG_PARAMETER); + ACE_TRY + { + this->subscribe_ = CosNotifyComm::NotifySubscribe::_narrow (push_supplier ACE_ENV_ARG_PARAMETER); + ACE_TRY_CHECK; + } + ACE_CATCHANY + { + // _narrow failed which probably means the interface is CosEventComm type. + } + ACE_ENDTRY; } void diff --git a/TAO/orbsvcs/orbsvcs/Notify/Builder.cpp b/TAO/orbsvcs/orbsvcs/Notify/Builder.cpp index e141d3ab337..54d3f2e4aab 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Builder.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Builder.cpp @@ -37,6 +37,7 @@ ACE_RCSID(RT_Notify, TAO_NS_Builder, "$Id$") #include "Sequence/SequenceProxyPushConsumer.h" #include "Sequence/SequenceProxyPushSupplier.h" #include "Dispatch_Observer_T.h" +#include "ETCL_FilterFactory.h" TAO_NS_Builder::TAO_NS_Builder (void) { @@ -54,9 +55,14 @@ TAO_NS_Builder::build_filter_factory (ACE_ENV_SINGLE_ARG_DECL) TAO_NS_FilterFactory* ff = ACE_Dynamic_Service<TAO_NS_FilterFactory>::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 ()); + } + + return ff->create (ACE_ENV_SINGLE_ARG_PARAMETER); } CosNotifyChannelAdmin::EventChannelFactory_ptr diff --git a/TAO/orbsvcs/orbsvcs/Notify/Event_Map_Observer_T.cpp b/TAO/orbsvcs/orbsvcs/Notify/Event_Map_Observer_T.cpp index a055fc7c666..03ad0d82c8c 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Event_Map_Observer_T.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Event_Map_Observer_T.cpp @@ -28,10 +28,10 @@ TAO_NS_Update_Added_Worker<PROXY>::TAO_NS_Update_Added_Worker (const TAO_NS_Even template <class PROXY> void TAO_NS_Update_Added_Worker<PROXY>::work (PROXY* proxy ACE_ENV_ARG_DECL) { - proxy->type_added (this->event_type_); - if (proxy->updates_off () == 0) { + proxy->type_added (this->event_type_); + this->dispatch_observer_->enqueue (proxy->peer () ACE_ENV_ARG_PARAMETER); // Tell the observer that this peer has a update pending. } } @@ -50,6 +50,7 @@ TAO_NS_Update_Removed_Worker<PROXY>::work (PROXY* proxy ACE_ENV_ARG_DECL) if (proxy->updates_off () == 0) { proxy->type_removed (this->event_type_); + this->dispatch_observer_->enqueue (proxy->peer () ACE_ENV_ARG_PARAMETER); // Tell the observer that this peer has a update pending. } } diff --git a/TAO/orbsvcs/orbsvcs/Notify/Event_Map_T.cpp b/TAO/orbsvcs/orbsvcs/Notify/Event_Map_T.cpp index bf88e776c36..546486af2c6 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Event_Map_T.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Event_Map_T.cpp @@ -112,7 +112,6 @@ TAO_NS_Event_Map_T<PROXY, ACE_LOCK>::remove (PROXY* proxy, const TAO_NS_EventTyp ACE_CHECK_RETURN (-1); ACE_WRITE_GUARD_RETURN (ACE_LOCK, ace_mon, this->lock_, -1); - return --event_type_count_; if (entry->count () == 0) { @@ -124,6 +123,8 @@ TAO_NS_Event_Map_T<PROXY, ACE_LOCK>::remove (PROXY* proxy, const TAO_NS_EventTyp /// Strategy 2: remove_bunch_after_threshold /// Strategy 3: use cached allocator and 1 } + + return --event_type_count_; } return -1; 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<TAO_SYNCH_MUTEX> (), - 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 <pradeep@cs.wustl.edu> */ @@ -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<TAO_Notify_EventListener>::Iterator TAO_Notify_EventListener_List_Iterator; -typedef TAO_ESF_Proxy_List<TAO_Notify_UpdateListener>::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, - TAO_ESF_Proxy_List<TAO_Notify_EventListener>, - TAO_Notify_EventListener_List_Iterator, - ACE_SYNCH> (); - return listener_list; - - /* - new TAO_ESF_Immediate_Changes<TAO_Notify_EventListener, - TAO_ESF_Proxy_List<TAO_Notify_EventListener>, - TAO_Notify_EventListener_List_Iterator, - TAO_SYNCH_MUTEX> (); - -ACE_NEW_THROW_EX (listener_list, - TAO_ESF_Immediate_Changes<TAO_Notify_EventListener, - TAO_ESF_Proxy_List<TAO_Notify_EventListener>, - 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, - TAO_ESF_Proxy_List<TAO_Notify_UpdateListener>, - 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, - TAO_ESF_Proxy_List<TAO_Notify_UpdateListener>, - 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<TAO_Notify_EventListener>; -template class TAO_ESF_Worker<TAO_Notify_UpdateListener>; - -template class TAO_ESF_Immediate_Changes<TAO_Notify_EventListener, TAO_ESF_Proxy_List<TAO_Notify_EventListener>, ACE_Unbounded_Set_Iterator<TAO_Notify_EventListener *>, TAO_SYNCH_MUTEX>; -template class TAO_ESF_Immediate_Changes<TAO_Notify_UpdateListener, TAO_ESF_Proxy_List<TAO_Notify_UpdateListener>, ACE_Unbounded_Set_Iterator<TAO_Notify_UpdateListener *>, TAO_SYNCH_MUTEX>; - -template class TAO_ESF_Copy_On_Write<TAO_Notify_EventListener, TAO_ESF_Proxy_List<TAO_Notify_EventListener>, ACE_Unbounded_Set_Iterator<TAO_Notify_EventListener *>, ACE_SYNCH>; -template class TAO_ESF_Copy_On_Write<TAO_Notify_UpdateListener, TAO_ESF_Proxy_List<TAO_Notify_UpdateListener>, ACE_Unbounded_Set_Iterator<TAO_Notify_UpdateListener *>, ACE_SYNCH>; - -template class TAO_ESF_Copy_On_Write_Write_Guard<TAO_ESF_Proxy_List<TAO_Notify_EventListener>, - TAO_Notify_EventListener_List_Iterator, - ACE_SYNCH>; - -template class TAO_ESF_Copy_On_Write_Write_Guard<TAO_ESF_Proxy_List<TAO_Notify_UpdateListener>, - TAO_Notify_UpdateListener_List_Iterator, - ACE_SYNCH>; - -template class TAO_ESF_Copy_On_Write_Collection<TAO_ESF_Proxy_List<TAO_Notify_EventListener>, ACE_Unbounded_Set_Iterator<TAO_Notify_EventListener *> >; - -template class TAO_ESF_Copy_On_Write_Collection<TAO_ESF_Proxy_List<TAO_Notify_UpdateListener>, ACE_Unbounded_Set_Iterator<TAO_Notify_UpdateListener *> >; - -template class TAO_ESF_Proxy_List<TAO_Notify_EventListener>; -template class TAO_ESF_Proxy_Collection<TAO_Notify_EventListener>; - -template class TAO_ESF_Proxy_List<TAO_Notify_UpdateListener>; -template class TAO_ESF_Proxy_Collection<TAO_Notify_UpdateListener>; - -template class TAO_ESF_Copy_On_Write_Read_Guard<TAO_ESF_Proxy_List<TAO_Notify_EventListener>, ACE_Unbounded_Set_Iterator<TAO_Notify_EventListener*>, TAO_SYNCH_MUTEX>; - -template class TAO_ESF_Copy_On_Write_Read_Guard<TAO_ESF_Proxy_List<TAO_Notify_UpdateListener>, ACE_Unbounded_Set_Iterator<TAO_Notify_UpdateListener*>, TAO_SYNCH_MUTEX>; - -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) - -#pragma instantiate TAO_ESF_Worker<TAO_Notify_EventListener> -#pragma instantiate TAO_ESF_Worker<TAO_Notify_UpdateListener> - -#pragma instantiate TAO_ESF_Immediate_Changes<TAO_Notify_EventListener, TAO_ESF_Proxy_List<TAO_Notify_EventListener>, ACE_Unbounded_Set_Iterator<TAO_Notify_EventListener *>, TAO_SYNCH_MUTEX> -#pragma instantiate TAO_ESF_Immediate_Changes<TAO_Notify_UpdateListener, TAO_ESF_Proxy_List<TAO_Notify_UpdateListener>, ACE_Unbounded_Set_Iterator<TAO_Notify_UpdateListener *>, TAO_SYNCH_MUTEX> -#pragma instantiate TAO_ESF_Immediate_Changes<TAO_Notify_UpdateListener, TAO_ESF_Proxy_List<TAO_Notify_UpdateListener>, ACE_Unbounded_Set_Iterator<TAO_Notify_UpdateListener *>, ACE_Null_Mutex> - -#pragma instantiate TAO_ESF_Copy_On_Write<TAO_Notify_EventListener, TAO_ESF_Proxy_List<TAO_Notify_EventListener>, ACE_Unbounded_Set_Iterator<TAO_Notify_EventListener *>, ACE_SYNCH> -#pragma instantiate TAO_ESF_Copy_On_Write<TAO_Notify_UpdateListener, TAO_ESF_Proxy_List<TAO_Notify_UpdateListener>, ACE_Unbounded_Set_Iterator<TAO_Notify_UpdateListener *>, ACE_SYNCH> - -#pragma instantiate TAO_ESF_Copy_On_Write_Write_Guard< -TAO_ESF_Proxy_List<TAO_Notify_EventListener>, - TAO_Notify_EventListener_List_Iterator, - ACE_SYNCH> -#pragma instantiate TAO_ESF_Copy_On_Write_Write_Guard< -TAO_ESF_Proxy_List<TAO_Notify_UpdateListener>, - TAO_Notify_UpdateListener_List_Iterator, - ACE_SYNCH> - -#pragma instantiate TAO_ESF_Copy_On_Write_Collection<TAO_ESF_Proxy_List<TAO_Notify_EventListener>, ACE_Unbounded_Set_Iterator<TAO_Notify_EventListener *> > - -#pragma instantiate TAO_ESF_Copy_On_Write_Collection<TAO_ESF_Proxy_List<TAO_Notify_UpdateListener>, ACE_Unbounded_Set_Iterator<TAO_Notify_UpdateListener *> > - -#pragma instantiate TAO_ESF_Proxy_List<TAO_Notify_EventListener> -#pragma instantiate TAO_ESF_Proxy_Collection<TAO_Notify_EventListener> - -#pragma instantiate TAO_ESF_Proxy_List<TAO_Notify_UpdateListener> -#pragma instantiate TAO_ESF_Proxy_Collection<TAO_Notify_UpdateListener> - -#pragma instantiate TAO_ESF_Copy_On_Write_Read_Guard<TAO_ESF_Proxy_List<TAO_Notify_EventListener>, ACE_Unbounded_Set_Iterator<TAO_Notify_EventListener*>, TAO_SYNCH_MUTEX> - -#pragma instantiate TAO_ESF_Copy_On_Write_Read_Guard<TAO_ESF_Proxy_List<TAO_Notify_UpdateListener>, ACE_Unbounded_Set_Iterator<TAO_Notify_UpdateListener*>, 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 <pradeep@cs.wustl.edu> */ //============================================================================= @@ -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<TAO_EMO_Options, ACE_Null_Mutex>; -#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate ACE_Singleton<TAO_EMO_Options, ACE_Null_Mutex> -#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 <pradeep@cs.wustl.edu> */ //============================================================================= @@ -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 <TAO_EMO_Options, ACE_Null_Mutex> 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 <wait_for_completion> 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 <pradeep@cs.wustl.edu> */ //============================================================================= @@ -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 <id> to an ObjectId and registers with the POA <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 <poa>. - CORBA::Object_ptr activate_object (PortableServer::POA_ptr poa,PortableServer::Servant servant ACE_ENV_ARG_DECL); - - /// Registers with the POA <poa>. - CORBA::Object_ptr servant_to_reference (PortableServer::POA_ptr poa,PortableServer::Servant servant ACE_ENV_ARG_DECL); - - /// Look for the Object with id <id> in <poa>. - CORBA::Object_ptr id_to_reference (CORBA::Long id, PortableServer::POA_ptr poa ACE_ENV_ARG_DECL); - - /// Destroy the <poa> - 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..817c22d2f5f 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Notify_EventChannelFactory_i.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Notify_EventChannelFactory_i.cpp @@ -1,224 +1,35 @@ // $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" 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); + CosNotifyChannelAdmin::EventChannelFactory_var notify_factory; - if (TAO_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, "event_channel_destroyed %d\n", channel_id)); -} - -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<TAO_NS_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 ()); + notify_factory = notify_service->create (default_POA ACE_ENV_ARG_PARAMETER); + ACE_CHECK_RETURN (notify_factory._retn ()); - 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); - - return this->ec_ids_.get_sequence (ACE_ENV_SINGLE_ARG_PARAMETER); -} - -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 ()); - - PortableServer::ServantBase_var filterfactory_var (filterfactory); - - // Init goes here. - // ACE_CHECK_RETURN (CosNotifyFilter::FilterFactory::_nil ()); - - 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<CosNotifyChannelAdmin::ChannelID, CosNotifyChannelAdmin::ChannelIDSeq>; + +template class ACE_Dynamic_Service<TAO_NS_Service>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) -#pragma instantiate TAO_Notify_ID_Pool_Ex<CosNotifyChannelAdmin::ChannelID, CosNotifyChannelAdmin::ChannelIDSeq> + +#pragma instantiate ACE_Dynamic_Service<TAO_NS_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..e5bef05033d 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 <pradeep@cs.wustl.edu> */ @@ -23,133 +22,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 <destroy_children> 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<CosNotifyChannelAdmin::ChannelID, - CosNotifyChannelAdmin::ChannelIDSeq> 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/Notify_Service.cpp b/TAO/orbsvcs/orbsvcs/Notify/Notify_Service.cpp index f67acdbc4f2..d45a1b30d87 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Notify_Service.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Notify_Service.cpp @@ -7,6 +7,7 @@ #include "ace/Sched_Params.h" #include "ace/Arg_Shifter.h" +#include "ace/Dynamic_Service.h" #include "tao/ORB_Core.h" #include "tao/debug.h" @@ -71,6 +72,56 @@ TAO_NS_Notify_Service::init (int argc, char *argv[]) TAO_NS_PROPERTIES::instance()->default_event_channel_qos_properties (ec_qos); } } + else 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 (arg_shifter.cur_arg_strncasecmp (ACE_LIB_TEXT("-MTSourceEval")) == 0) + { + // Users interested in this arcane feature should look to the upcomming RT-Notification for a better solution. + arg_shifter.consume_arg (); + } + else if ((current_arg = arg_shifter.get_the_parameter (ACE_LIB_TEXT("-SourceThreads")))) + { + // Users interested in this arcane feature should look to the upcomming RT-Notification for a better solution. + arg_shifter.consume_arg (); + } + else if (arg_shifter.cur_arg_strncasecmp (ACE_LIB_TEXT("-MTLookup")) == 0) + { + // Users interested in this arcane feature should look to the upcomming RT-Notification for a better solution. + arg_shifter.consume_arg (); + } + else if ((current_arg = arg_shifter.get_the_parameter (ACE_LIB_TEXT("-LookupThreads")))) + { + // Users interested in this arcane feature should look to the upcomming RT-Notification for a better solution. + arg_shifter.consume_arg (); + } + else if (arg_shifter.cur_arg_strncasecmp (ACE_LIB_TEXT("-MTListenerEval")) == 0) + { + // Users interested in this arcane feature should look to the upcomming RT-Notification for a better solution. + arg_shifter.consume_arg (); + } + else if ((current_arg = arg_shifter.get_the_parameter (ACE_LIB_TEXT("-ListenerThreads")))) + { + // Users interested in this arcane feature should look to the upcomming RT-Notification for a better solution. + arg_shifter.consume_arg (); + } + else if (arg_shifter.cur_arg_strncasecmp (ACE_LIB_TEXT("-AsynchUpdates")) == 0) + { + arg_shifter.consume_arg (); + + TAO_NS_PROPERTIES::instance()->updates (1); + + ACE_Time_Value update_period (0, TAO_NS_DEFAULT_UPDATES_PERIOD); + + TAO_NS_PROPERTIES::instance()->update_period (update_period); + } + else if (ACE_OS::strcasecmp (current_arg, ACE_LIB_TEXT("-AllocateTaskperProxy")) == 0) + { + // Not supported any more. + arg_shifter.consume_arg (); + } } return 0; @@ -225,15 +276,26 @@ TAO_NS_Notify_Service::remove (TAO_NS_EventChannelFactory* /*ecf*/ ACE_ENV_ARG_D // NOP. } + /*********************************************************************************************************************/ TAO_NS_Cos_Notification_Service_Initializer::TAO_NS_Cos_Notification_Service_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_Notify_Default_EMO_Factory_OLD); } /*********************************************************************************************************************/ +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_Notify_Service), + ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ, + 0) + +/*********************************************************************************************************************/ + ACE_STATIC_SVC_DEFINE (TAO_NS_Notify_Service, ACE_TEXT (TAO_NS_COS_NOTIFICATION_SERVICE_NAME), ACE_SVC_OBJ_T, @@ -241,3 +303,5 @@ ACE_STATIC_SVC_DEFINE (TAO_NS_Notify_Service, ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ, 0) ACE_FACTORY_DEFINE (TAO_Notify, TAO_NS_Notify_Service) + +/*********************************************************************************************************************/ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Notify_Service.h b/TAO/orbsvcs/orbsvcs/Notify/Notify_Service.h index 9bf2de4678b..37dcc41547a 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Notify_Service.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Notify_Service.h @@ -94,6 +94,8 @@ static TAO_NS_Cos_Notification_Service_Initializer TAO_NS_Cos_Notification_Servi ACE_STATIC_SVC_DECLARE (TAO_NS_Notify_Service) ACE_FACTORY_DECLARE (TAO_Notify, TAO_NS_Notify_Service) +ACE_STATIC_SVC_DECLARE (TAO_Notify_Default_EMO_Factory_OLD) + #if defined (__ACE_INLINE__) #include "Notify_Service.inl" #endif /* __ACE_INLINE__ */ diff --git a/TAO/orbsvcs/orbsvcs/Notify/Properties.cpp b/TAO/orbsvcs/orbsvcs/Notify/Properties.cpp index 3779ea8e2a3..0fd58a95f53 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Properties.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Properties.cpp @@ -10,9 +10,9 @@ ACE_RCSID(RT_Notify, TAO_NS_Properties, "$Id$") TAO_NS_Properties::TAO_NS_Properties (void) - :updates_ (1), update_period_ (0, 10000) + :updates_ (1), update_period_ (0, TAO_NS_DEFAULT_UPDATES_PERIOD) { - if (TAO_debug_level > 0) + if (TAO_debug_level > 1) ACE_DEBUG ((LM_DEBUG, "in TAO_Properties ctos %x\n", this)); } diff --git a/TAO/orbsvcs/orbsvcs/Notify/Properties.h b/TAO/orbsvcs/orbsvcs/Notify/Properties.h index 06090bc0291..da1765770d6 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Properties.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Properties.h @@ -30,7 +30,7 @@ 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 @@ -104,6 +104,8 @@ protected: CosNotification::QoSProperties ec_qos_; }; +#define TAO_NS_DEFAULT_UPDATES_PERIOD 10000 // 10mS + typedef ACE_Singleton<TAO_NS_Properties, TAO_SYNCH_MUTEX> TAO_NS_PROPERTIES; TAO_NOTIFY_SINGLETON_DECLARE (ACE_Singleton, TAO_NS_Properties, TAO_SYNCH_MUTEX); diff --git a/TAO/orbsvcs/orbsvcs/Notify/Proxy.cpp b/TAO/orbsvcs/orbsvcs/Notify/Proxy.cpp index 48549ecac07..66cd7650ccc 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Proxy.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Proxy.cpp @@ -16,6 +16,7 @@ ACE_RCSID(RT_Notify, TAO_NS_Proxy, "$Id$") #include "Notify_Service.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 ()); diff --git a/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequencePushConsumer.cpp b/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequencePushConsumer.cpp index 7ed0768766f..161905dbfa9 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequencePushConsumer.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequencePushConsumer.cpp @@ -29,21 +29,11 @@ TAO_NS_SequencePushConsumer::~TAO_NS_SequencePushConsumer () } void -TAO_NS_SequencePushConsumer::init (CosNotifyComm::SequencePushConsumer_ptr push_consumer ACE_ENV_ARG_DECL) +TAO_NS_SequencePushConsumer::init (CosNotifyComm::SequencePushConsumer_ptr push_consumer ACE_ENV_ARG_DECL_NOT_USED) { this->push_consumer_ = CosNotifyComm::SequencePushConsumer::_duplicate (push_consumer); - ACE_TRY - { - this->publish_ = CosNotifyComm::NotifyPublish::_narrow (push_consumer ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - // Ignore - // if the client is not running an event loop and _narrow goes remote, we get a transient exception! - } - ACE_ENDTRY; + this->publish_ = CosNotifyComm::NotifyPublish::_duplicate (push_consumer); } void diff --git a/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequencePushSupplier.cpp b/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequencePushSupplier.cpp index 04e35ce779b..94447663e55 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequencePushSupplier.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Sequence/SequencePushSupplier.cpp @@ -18,11 +18,11 @@ TAO_NS_SequencePushSupplier::~TAO_NS_SequencePushSupplier () } void -TAO_NS_SequencePushSupplier::init (CosNotifyComm::SequencePushSupplier_ptr push_supplier ACE_ENV_ARG_DECL) +TAO_NS_SequencePushSupplier::init (CosNotifyComm::SequencePushSupplier_ptr push_supplier ACE_ENV_ARG_DECL_NOT_USED) { this->push_supplier_ = CosNotifyComm::SequencePushSupplier::_duplicate (push_supplier); - this->subscribe_ = CosNotifyComm::NotifySubscribe::_narrow (push_supplier ACE_ENV_ARG_PARAMETER); + this->subscribe_ = CosNotifyComm::NotifySubscribe::_duplicate (push_supplier); } void diff --git a/TAO/orbsvcs/orbsvcs/Notify/Service.h b/TAO/orbsvcs/orbsvcs/Notify/Service.h index d7afb2b9145..39df48e4a3d 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Service.h +++ b/TAO/orbsvcs/orbsvcs/Notify/Service.h @@ -46,6 +46,7 @@ public: ) = 0; }; +#define TAO_NOTIFY_DEF_EMO_FACTORY_NAME "Notify_Default_Event_Manager_Objects_Factory" #define TAO_NS_COS_NOTIFICATION_SERVICE_NAME "TAO_NS_CosNotification_Service" #include "ace/post.h" diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushConsumer.cpp b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushConsumer.cpp index 660e1c3e3ab..e868de67b00 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushConsumer.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushConsumer.cpp @@ -19,21 +19,12 @@ TAO_NS_StructuredPushConsumer::~TAO_NS_StructuredPushConsumer () } void -TAO_NS_StructuredPushConsumer::init (CosNotifyComm::StructuredPushConsumer_ptr push_consumer ACE_ENV_ARG_DECL) +TAO_NS_StructuredPushConsumer::init (CosNotifyComm::StructuredPushConsumer_ptr push_consumer ACE_ENV_ARG_DECL_NOT_USED) { this->push_consumer_ = CosNotifyComm::StructuredPushConsumer::_duplicate (push_consumer); - ACE_TRY - { - this->publish_ = CosNotifyComm::NotifyPublish::_narrow (push_consumer ACE_ENV_ARG_PARAMETER); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - // Ignore - // if the client is not running an event loop and _narrow goes remote, we get a transient exception! - } - ACE_ENDTRY; + this->publish_ = CosNotifyComm::NotifyPublish::_duplicate (push_consumer); + } void diff --git a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushSupplier.cpp b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushSupplier.cpp index 60050651b1e..14bd28f93b1 100644 --- a/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushSupplier.cpp +++ b/TAO/orbsvcs/orbsvcs/Notify/Structured/StructuredPushSupplier.cpp @@ -18,11 +18,11 @@ TAO_NS_StructuredPushSupplier::~TAO_NS_StructuredPushSupplier () } void -TAO_NS_StructuredPushSupplier::init (CosNotifyComm::StructuredPushSupplier_ptr push_supplier ACE_ENV_ARG_DECL) +TAO_NS_StructuredPushSupplier::init (CosNotifyComm::StructuredPushSupplier_ptr push_supplier ACE_ENV_ARG_DECL_NOT_USED) { this->push_supplier_ = CosNotifyComm::StructuredPushSupplier::_duplicate (push_supplier); - this->subscribe_ = CosNotifyComm::NotifySubscribe::_narrow (push_supplier ACE_ENV_ARG_PARAMETER); + this->subscribe_ = CosNotifyComm::NotifySubscribe::_duplicate (push_supplier); } void diff --git a/TAO/tao/Messaging/Makefile.bor b/TAO/tao/Messaging/Makefile.bor index 22ac2c5cd1d..9783a55db86 100644 --- a/TAO/tao/Messaging/Makefile.bor +++ b/TAO/tao/Messaging/Makefile.bor @@ -34,7 +34,7 @@ CPPDIR = . INCDIR_NAME = tao\Messaging INCLUDES = \ - *.h *.i \ + *.h *.i *_T.cpp\ Messaging.pidl LIBFILES = \ |