diff options
author | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-05-11 18:55:22 +0000 |
---|---|---|
committer | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-05-11 18:55:22 +0000 |
commit | 038f69186b1611f47c744de6081291f42bc569d1 (patch) | |
tree | 355e7b4ca657890e68d38e685641b56e2f63d6ac | |
parent | edbc25c1da1104499a847cad50c8d3cd265ef51f (diff) | |
download | ATCD-038f69186b1611f47c744de6081291f42bc569d1.tar.gz |
ChangeLogTag:Tue May 11 13:51:55 1999 Carlos O'Ryan <coryan@cs.wustl.edu>
-rw-r--r-- | TAO/ChangeLog-99c | 24 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Event/EC_ConsumerAdmin.cpp | 26 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Event/EC_ConsumerAdmin.h | 4 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Event/EC_Event_Channel.cpp | 3 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Event/EC_ProxyConsumer.cpp | 85 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Event/EC_ProxyConsumer.h | 13 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Event/EC_ProxySupplier.cpp | 127 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Event/EC_ProxySupplier.h | 13 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Event/EC_SupplierAdmin.cpp | 30 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Event/EC_SupplierAdmin.h | 4 | ||||
-rw-r--r-- | TAO/orbsvcs/tests/Event/Basic/Makefile | 5 | ||||
-rw-r--r-- | TAO/orbsvcs/tests/Event/Basic/Reconnect.cpp | 2 | ||||
-rw-r--r-- | TAO/orbsvcs/tests/Event/Basic/Shutdown.cpp | 82 | ||||
-rw-r--r-- | TAO/orbsvcs/tests/Event/Basic/Shutdown.h | 60 | ||||
-rw-r--r-- | TAO/orbsvcs/tests/Event/lib/Consumer.cpp | 2 | ||||
-rw-r--r-- | TAO/orbsvcs/tests/Event/lib/Driver.cpp | 95 | ||||
-rw-r--r-- | TAO/orbsvcs/tests/Event/lib/Driver.h | 19 | ||||
-rw-r--r-- | TAO/orbsvcs/tests/Event/lib/Supplier.cpp | 5 |
18 files changed, 484 insertions, 115 deletions
diff --git a/TAO/ChangeLog-99c b/TAO/ChangeLog-99c index aeeea81bdcb..85d99112d39 100644 --- a/TAO/ChangeLog-99c +++ b/TAO/ChangeLog-99c @@ -1,3 +1,27 @@ +Tue May 11 13:51:55 1999 Carlos O'Ryan <coryan@cs.wustl.edu> + + * docs/releasenotes/TODO.html: + * orbsvcs/orbsvcs/Event/EC_ConsumerAdmin.cpp: + * orbsvcs/orbsvcs/Event/EC_ConsumerAdmin.h: + * orbsvcs/orbsvcs/Event/EC_Event_Channel.cpp: + * orbsvcs/orbsvcs/Event/EC_ProxyConsumer.cpp: + * orbsvcs/orbsvcs/Event/EC_ProxyConsumer.h: + * orbsvcs/orbsvcs/Event/EC_ProxySupplier.cpp: + * orbsvcs/orbsvcs/Event/EC_ProxySupplier.h: + * orbsvcs/orbsvcs/Event/EC_SupplierAdmin.cpp: + * orbsvcs/orbsvcs/Event/EC_SupplierAdmin.h: + * orbsvcs/tests/Event/Basic/Makefile: + * orbsvcs/tests/Event/Basic/Reconnect.cpp: + * orbsvcs/tests/Event/Basic/Shutdown.cpp: + * orbsvcs/tests/Event/Basic/Shutdown.h: + * orbsvcs/tests/Event/lib/Consumer.cpp: + * orbsvcs/tests/Event/lib/Driver.cpp: + * orbsvcs/tests/Event/lib/Driver.h: + * orbsvcs/tests/Event/lib/Supplier.cpp: + Completed the implementation of the destroy() method in the new + Event Channel. It was not invoking the disconnect_push_XXX() + operations on its list of suppliers and consumers. + Tue May 11 13:45:00 1999 Jeff Parsons <parsons@cs.wustl.edu> * tao/WrongTransactionC.{h,cpp}: diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_ConsumerAdmin.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_ConsumerAdmin.cpp index 09e8a3fa84b..b3e84db9e32 100644 --- a/TAO/orbsvcs/orbsvcs/Event/EC_ConsumerAdmin.cpp +++ b/TAO/orbsvcs/orbsvcs/Event/EC_ConsumerAdmin.cpp @@ -88,6 +88,32 @@ TAO_EC_ConsumerAdmin::disconnected (TAO_EC_ProxyPushSupplier *supplier, this->supplier_set_->disconnected (supplier, ACE_TRY_ENV); } +void +TAO_EC_ConsumerAdmin::shutdown (CORBA::Environment &ACE_TRY_ENV) +{ + ACE_GUARD_THROW_EX (TAO_EC_ConsumerAdmin::Busy_Lock, + ace_mon, this->busy_lock (), + RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR ()); + ACE_CHECK; + + SupplierSetIterator end = this->end (); + for (SupplierSetIterator i = this->begin (); + i != end; + ++i) + { + ACE_TRY + { + (*i)->shutdown (ACE_TRY_ENV); + ACE_TRY_CHECK; + } + ACE_CATCHANY + { + /* ignore all exceptions */ + } + ACE_ENDTRY; + } +} + RtecEventChannelAdmin::ProxyPushSupplier_ptr TAO_EC_ConsumerAdmin::obtain_push_supplier (CORBA::Environment &ACE_TRY_ENV) { diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_ConsumerAdmin.h b/TAO/orbsvcs/orbsvcs/Event/EC_ConsumerAdmin.h index 543ed30a456..52f070b9995 100644 --- a/TAO/orbsvcs/orbsvcs/Event/EC_ConsumerAdmin.h +++ b/TAO/orbsvcs/orbsvcs/Event/EC_ConsumerAdmin.h @@ -97,6 +97,10 @@ public: // Used to inform the EC that a Supplier has connected or // disconnected from it. + virtual void shutdown (CORBA::Environment&); + // The event channel is shutting down, inform all the consumers of + // this + // = The RtecEventChannelAdmin::ConsumerAdmin methods... virtual RtecEventChannelAdmin::ProxyPushSupplier_ptr obtain_push_supplier (CORBA::Environment &); diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Event_Channel.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_Event_Channel.cpp index bd221cfb3a7..db23a92dce5 100644 --- a/TAO/orbsvcs/orbsvcs/Event/EC_Event_Channel.cpp +++ b/TAO/orbsvcs/orbsvcs/Event/EC_Event_Channel.cpp @@ -107,6 +107,9 @@ TAO_EC_Event_Channel::shutdown (CORBA::Environment& ACE_TRY_ENV) ACE_CHECK; supplier_poa->deactivate_object (supplier_id.in (), ACE_TRY_ENV); ACE_CHECK; + + this->consumer_admin_->shutdown (ACE_TRY_ENV); + this->supplier_admin_->shutdown (ACE_TRY_ENV); } void diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_ProxyConsumer.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_ProxyConsumer.cpp index c5e37b2a796..6e942c64645 100644 --- a/TAO/orbsvcs/orbsvcs/Event/EC_ProxyConsumer.cpp +++ b/TAO/orbsvcs/orbsvcs/Event/EC_ProxyConsumer.cpp @@ -31,12 +31,6 @@ TAO_EC_ProxyPushConsumer::~TAO_EC_ProxyPushConsumer (void) this->event_channel_->destroy_consumer_lock (this->lock_); } -PortableServer::POA_ptr -TAO_EC_ProxyPushConsumer::_default_POA (CORBA::Environment&) -{ - return PortableServer::POA::_duplicate (this->default_POA_.in ()); -} - void TAO_EC_ProxyPushConsumer::connected (TAO_EC_ProxyPushSupplier* supplier, CORBA::Environment &ACE_TRY_ENV) @@ -65,6 +59,55 @@ TAO_EC_ProxyPushConsumer::disconnected (TAO_EC_ProxyPushConsumer*, { } +void +TAO_EC_ProxyPushConsumer::shutdown (CORBA::Environment &ACE_TRY_ENV) +{ + RtecEventComm::PushSupplier_var supplier; + + { + ACE_GUARD_THROW_EX ( + ACE_Lock, ace_mon, *this->lock_, + RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR ()); + ACE_CHECK; + + if (this->is_connected_i () == 0) + return; + + supplier = this->supplier_._retn (); + + this->cleanup_i (); + } + + this->deactivate (ACE_TRY_ENV); + ACE_CHECK; + + supplier->disconnect_push_supplier (ACE_TRY_ENV); +} + +void +TAO_EC_ProxyPushConsumer::cleanup_i (void) +{ + this->supplier_ = + RtecEventComm::PushSupplier::_nil (); + + this->filter_->unbind (this); + this->event_channel_->supplier_filter_builder ()->destroy (this->filter_); + this->filter_ = 0; +} + +void +TAO_EC_ProxyPushConsumer::deactivate (CORBA::Environment &ACE_TRY_ENV) +{ + PortableServer::POA_var poa = + this->_default_POA (ACE_TRY_ENV); + ACE_CHECK; + PortableServer::ObjectId_var id = + poa->servant_to_id (this, ACE_TRY_ENV); + ACE_CHECK; + poa->deactivate_object (id.in (), ACE_TRY_ENV); + ACE_CHECK; +} + CORBA::ULong TAO_EC_ProxyPushConsumer::_incr_refcnt (void) { @@ -106,12 +149,7 @@ TAO_EC_ProxyPushConsumer::connect_push_supplier ( // Re-connections are allowed, go ahead and disconnect the // consumer... - this->supplier_ = - RtecEventComm::PushSupplier::_nil (); - - this->filter_->unbind (this); - this->event_channel_->supplier_filter_builder ()->destroy (this->filter_); - this->filter_ = 0; + this->cleanup_i (); // @@ Please read the comments in EC_ProxySuppliers about // possible race conditions in this area... @@ -167,23 +205,12 @@ TAO_EC_ProxyPushConsumer::disconnect_push_consumer ( ACE_CHECK; if (this->is_connected_i () == 0) - ACE_THROW (CORBA::BAD_INV_ORDER ()); - - this->supplier_ = - RtecEventComm::PushSupplier::_nil (); + ACE_THROW (CORBA::BAD_INV_ORDER ()); // @@ add user exception? - this->filter_->unbind (this); - this->event_channel_->supplier_filter_builder ()->destroy (this->filter_); - this->filter_ = 0; + this->cleanup_i (); } - PortableServer::POA_var poa = - this->_default_POA (ACE_TRY_ENV); - ACE_CHECK; - PortableServer::ObjectId_var id = - poa->servant_to_id (this, ACE_TRY_ENV); - ACE_CHECK; - poa->deactivate_object (id.in (), ACE_TRY_ENV); + this->deactivate (ACE_TRY_ENV); ACE_CHECK; // Notify the event channel... @@ -192,6 +219,12 @@ TAO_EC_ProxyPushConsumer::disconnect_push_consumer ( this->_decr_refcnt (); } +PortableServer::POA_ptr +TAO_EC_ProxyPushConsumer::_default_POA (CORBA::Environment&) +{ + return PortableServer::POA::_duplicate (this->default_POA_.in ()); +} + void TAO_EC_ProxyPushConsumer::_add_ref (CORBA::Environment &) { diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_ProxyConsumer.h b/TAO/orbsvcs/orbsvcs/Event/EC_ProxyConsumer.h index 1659522d65a..528df12f129 100644 --- a/TAO/orbsvcs/orbsvcs/Event/EC_ProxyConsumer.h +++ b/TAO/orbsvcs/orbsvcs/Event/EC_ProxyConsumer.h @@ -90,8 +90,8 @@ public: // Usually implemented as no-ops, but some configurations may // require this methods. - virtual PortableServer::POA_ptr _default_POA (CORBA::Environment& env); - // Override the ServantBase method. + virtual void shutdown (CORBA::Environment&); + // The event channel is shutting down CORBA::ULong _incr_refcnt (void); CORBA::ULong _decr_refcnt (void); @@ -106,7 +106,8 @@ public: CORBA::Environment &); virtual void disconnect_push_consumer (CORBA::Environment &); - // = Servant reference counting methods. + // = The Servant methods + virtual PortableServer::POA_ptr _default_POA (CORBA::Environment& env); virtual void _add_ref (CORBA_Environment &ACE_TRY_ENV = CORBA::default_environment ()); virtual void _remove_ref (CORBA_Environment &ACE_TRY_ENV = @@ -116,6 +117,12 @@ private: CORBA::Boolean is_connected_i (void) const; // The private version (without locking) of is_connected(). + void cleanup_i (void); + // Release the filter and the supplier + + void deactivate (CORBA::Environment &ACE_TRY_ENV); + // Deactivate from the POA + private: TAO_EC_Event_Channel* event_channel_; // The supplier admin, used for activation and memory managment. diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_ProxySupplier.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_ProxySupplier.cpp index 9af16c805f7..cd8d9643f42 100644 --- a/TAO/orbsvcs/orbsvcs/Event/EC_ProxySupplier.cpp +++ b/TAO/orbsvcs/orbsvcs/Event/EC_ProxySupplier.cpp @@ -31,56 +31,100 @@ TAO_EC_ProxyPushSupplier::~TAO_EC_ProxyPushSupplier (void) this->event_channel_->destroy_supplier_lock (this->lock_); } -CORBA::ULong -TAO_EC_ProxyPushSupplier::_incr_refcnt (void) +void +TAO_EC_ProxyPushSupplier::connected (TAO_EC_ProxyPushConsumer*, + CORBA::Environment &) { - ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->lock_, 0); - return this->refcount_++; } -CORBA::ULong -TAO_EC_ProxyPushSupplier::_decr_refcnt (void) +void +TAO_EC_ProxyPushSupplier::disconnected (TAO_EC_ProxyPushConsumer*, + CORBA::Environment &) { - { - ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->lock_, 0); - this->refcount_--; - if (this->refcount_ != 0) - return this->refcount_; - } - - // Notify the event channel - this->event_channel_->destroy_proxy_push_supplier (this); - return 0; } -PortableServer::POA_ptr -TAO_EC_ProxyPushSupplier::_default_POA (CORBA::Environment&) +void +TAO_EC_ProxyPushSupplier::connected (TAO_EC_ProxyPushSupplier*, + CORBA::Environment &) { - return PortableServer::POA::_duplicate (this->default_POA_.in ()); } void -TAO_EC_ProxyPushSupplier::connected (TAO_EC_ProxyPushConsumer*, - CORBA::Environment &) +TAO_EC_ProxyPushSupplier::disconnected (TAO_EC_ProxyPushSupplier*, + CORBA::Environment &) { } void -TAO_EC_ProxyPushSupplier::disconnected (TAO_EC_ProxyPushConsumer*, - CORBA::Environment &) +TAO_EC_ProxyPushSupplier::shutdown (CORBA::Environment &ACE_TRY_ENV) { + RtecEventComm::PushConsumer_var consumer; + + { + ACE_GUARD_THROW_EX ( + ACE_Lock, ace_mon, *this->lock_, + RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR ()); + ACE_CHECK; + + if (this->is_connected_i () == 0) + return; + + consumer = this->consumer_._retn (); + + this->cleanup_i (); + } + + this->deactivate (ACE_TRY_ENV); + ACE_CHECK; + + consumer->disconnect_push_consumer (ACE_TRY_ENV); } void -TAO_EC_ProxyPushSupplier::connected (TAO_EC_ProxyPushSupplier*, - CORBA::Environment &) +TAO_EC_ProxyPushSupplier::cleanup_i (void) { + this->consumer_ = + RtecEventComm::PushConsumer::_nil (); + + // @@ Why don't we have a destroy() method in the + // filter_builder? + delete this->child_; + this->child_ = 0; } void -TAO_EC_ProxyPushSupplier::disconnected (TAO_EC_ProxyPushSupplier*, - CORBA::Environment &) +TAO_EC_ProxyPushSupplier::deactivate (CORBA::Environment &ACE_TRY_ENV) { + PortableServer::POA_var poa = + this->_default_POA (ACE_TRY_ENV); + ACE_CHECK; + PortableServer::ObjectId_var id = + poa->servant_to_id (this, ACE_TRY_ENV); + ACE_CHECK; + poa->deactivate_object (id.in (), ACE_TRY_ENV); + ACE_CHECK; +} + +CORBA::ULong +TAO_EC_ProxyPushSupplier::_incr_refcnt (void) +{ + ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->lock_, 0); + return this->refcount_++; +} + +CORBA::ULong +TAO_EC_ProxyPushSupplier::_decr_refcnt (void) +{ + { + ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->lock_, 0); + this->refcount_--; + if (this->refcount_ != 0) + return this->refcount_; + } + + // Notify the event channel + this->event_channel_->destroy_proxy_push_supplier (this); + return 0; } void @@ -102,13 +146,7 @@ TAO_EC_ProxyPushSupplier::connect_push_consumer ( // Re-connections are allowed, go ahead and disconnect the // consumer... - this->consumer_ = - RtecEventComm::PushConsumer::_nil (); - - // @@ Why don't we have a destroy() method in the - // filter_builder? - delete this->child_; - this->child_ = 0; + this->cleanup_i (); // @@ Are there any race conditions here: // + The lock is released, but the object is marked as @@ -168,21 +206,10 @@ TAO_EC_ProxyPushSupplier::disconnect_push_supplier ( if (this->is_connected_i () == 0) ACE_THROW (CORBA::BAD_INV_ORDER ()); - this->consumer_ = - RtecEventComm::PushConsumer::_nil (); - - // @@ Why don't we have a destroy() method in the filter_builder? - delete this->child_; - this->child_ = 0; + this->cleanup_i (); } - PortableServer::POA_var poa = - this->_default_POA (ACE_TRY_ENV); - ACE_CHECK; - PortableServer::ObjectId_var id = - poa->servant_to_id (this, ACE_TRY_ENV); - ACE_CHECK; - poa->deactivate_object (id.in (), ACE_TRY_ENV); + this->deactivate (ACE_TRY_ENV); ACE_CHECK; // Notify the event channel... @@ -404,6 +431,12 @@ TAO_EC_ProxyPushSupplier::can_match ( return this->child_->can_match (header); } +PortableServer::POA_ptr +TAO_EC_ProxyPushSupplier::_default_POA (CORBA::Environment&) +{ + return PortableServer::POA::_duplicate (this->default_POA_.in ()); +} + void TAO_EC_ProxyPushSupplier::_add_ref (CORBA::Environment &) { diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_ProxySupplier.h b/TAO/orbsvcs/orbsvcs/Event/EC_ProxySupplier.h index e6bed2d9206..e5edd9cf6a7 100644 --- a/TAO/orbsvcs/orbsvcs/Event/EC_ProxySupplier.h +++ b/TAO/orbsvcs/orbsvcs/Event/EC_ProxySupplier.h @@ -96,8 +96,8 @@ public: // Usually implemented as no-ops, but some configurations may // require this methods. - virtual PortableServer::POA_ptr _default_POA (CORBA::Environment& env); - // Override the ServantBase method. + virtual void shutdown (CORBA::Environment &env); + // The event channel is shutting down void push_to_consumer (const RtecEventComm::EventSet &event, CORBA::Environment &env); @@ -142,7 +142,8 @@ public: virtual CORBA::ULong max_event_size (void) const; virtual int can_match (const RtecEventComm::EventHeader &header) const; - // = Servant reference counting methods. + // = The Servant methods + virtual PortableServer::POA_ptr _default_POA (CORBA::Environment& env); virtual void _add_ref (CORBA_Environment &ACE_TRY_ENV = CORBA::default_environment ()); virtual void _remove_ref (CORBA_Environment &ACE_TRY_ENV = @@ -152,6 +153,12 @@ private: CORBA::Boolean is_connected_i (void) const; // The private version (without locking) of is_connected(). + void cleanup_i (void); + // Release the child and the consumer + + void deactivate (CORBA::Environment &ACE_TRY_ENV); + // Deactivate from the POA + private: TAO_EC_Event_Channel* event_channel_; // The Event Channel that owns this object. diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_SupplierAdmin.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_SupplierAdmin.cpp index 95a471dedc9..b1a0e9dd82a 100644 --- a/TAO/orbsvcs/orbsvcs/Event/EC_SupplierAdmin.cpp +++ b/TAO/orbsvcs/orbsvcs/Event/EC_SupplierAdmin.cpp @@ -18,8 +18,8 @@ TAO_EC_SupplierAdmin::TAO_EC_SupplierAdmin (TAO_EC_Event_Channel *ec) this->event_channel_->supplier_poa (); // @@ We must consider using the techniques in the ConsumerAdmin - // also, i.e. not using locks but delaying operations that modify - // the set. I don't see much use for them right now, since there + // also, i.e. not using locks but delaying operations that modify + // the set. I don't see much use for them right now, since there // is no potential for dead-lock when dispatching events and/or // adding multiple suppliers and consumers, but we could avoid // some priority inversions. @@ -106,6 +106,32 @@ TAO_EC_SupplierAdmin::disconnected (TAO_EC_ProxyPushConsumer *consumer, ACE_THROW (RtecEventChannelAdmin::EventChannel::SUBSCRIPTION_ERROR ()); } +void +TAO_EC_SupplierAdmin::shutdown (CORBA::Environment &ACE_TRY_ENV) +{ + ACE_GUARD_THROW_EX ( + ACE_Lock, ace_mon, *this->lock_, + RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR ()); + ACE_CHECK; + + ConsumerSetIterator end = this->end (); + for (ConsumerSetIterator i = this->begin (); + i != end; + ++i) + { + ACE_TRY + { + (*i)->shutdown (ACE_TRY_ENV); + ACE_TRY_CHECK; + } + ACE_CATCHANY + { + /* ignore all exceptions */ + } + ACE_ENDTRY; + } +} + RtecEventChannelAdmin::ProxyPushConsumer_ptr TAO_EC_SupplierAdmin::obtain_push_consumer (CORBA::Environment &ACE_TRY_ENV) { diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_SupplierAdmin.h b/TAO/orbsvcs/orbsvcs/Event/EC_SupplierAdmin.h index 3dc3032ebd9..d9beff66865 100644 --- a/TAO/orbsvcs/orbsvcs/Event/EC_SupplierAdmin.h +++ b/TAO/orbsvcs/orbsvcs/Event/EC_SupplierAdmin.h @@ -80,6 +80,10 @@ public: // Used to inform the EC that a Supplier has connected or // disconnected from it. + virtual void shutdown (CORBA::Environment&); + // The event channel is shutting down, inform all the consumers of + // this + // = The RtecEventChannelAdmin::SupplierAdmin methods... virtual RtecEventChannelAdmin::ProxyPushConsumer_ptr obtain_push_consumer (CORBA::Environment &); diff --git a/TAO/orbsvcs/tests/Event/Basic/Makefile b/TAO/orbsvcs/tests/Event/Basic/Makefile index fb1824a4493..3cac321584b 100644 --- a/TAO/orbsvcs/tests/Event/Basic/Makefile +++ b/TAO/orbsvcs/tests/Event/Basic/Makefile @@ -12,7 +12,8 @@ ifndef TAO_ROOT TAO_ROOT = $(ACE_ROOT)/TAO endif # ! TAO_ROOT -BIN2 = Reconnect +BIN2 = Reconnect \ + Shutdown #### If the orbsvcs library wasn't built with all components, don't #### try to build certain tests. @@ -21,7 +22,7 @@ ifeq (Event2,$(findstring Event2,$(TAO_ORBSVCS))) BIN = $(BIN2) endif # Event2 -SRC=$(addsuffix .cpp,$(BIN)) +PSRC=$(addsuffix .cpp,$(BIN)) LIBS += -lECTests -lorbsvcs -lTAO -lACE CPPFLAGS += -I../lib -I$(TAO_ROOT) -I$(TAO_ROOT)/orbsvcs \ $(foreach svc, $(TAO_ORBSVCS), -DTAO_ORBSVCS_HAS_$(svc)) diff --git a/TAO/orbsvcs/tests/Event/Basic/Reconnect.cpp b/TAO/orbsvcs/tests/Event/Basic/Reconnect.cpp index 14808260286..76be4e0a0cb 100644 --- a/TAO/orbsvcs/tests/Event/Basic/Reconnect.cpp +++ b/TAO/orbsvcs/tests/Event/Basic/Reconnect.cpp @@ -6,7 +6,7 @@ #include "orbsvcs/Event/EC_Event_Channel.h" #include "ace/Get_Opt.h" -ACE_RCSID(EC_Throughput, ECT_Throughput, "$Id$") +ACE_RCSID(EC_Tests_Basic, Reconnect, "$Id$") int main (int argc, char *argv []) diff --git a/TAO/orbsvcs/tests/Event/Basic/Shutdown.cpp b/TAO/orbsvcs/tests/Event/Basic/Shutdown.cpp new file mode 100644 index 00000000000..a48b369219d --- /dev/null +++ b/TAO/orbsvcs/tests/Event/Basic/Shutdown.cpp @@ -0,0 +1,82 @@ +// $Id$ + +#include "Shutdown.h" +#include "Consumer.h" +#include "Supplier.h" + +ACE_RCSID(EC_Tests_Basic, Shutdown, "$Id$") + +int +main (int argc, char *argv []) +{ + EC_Shutdown driver; + return driver.run (argc, argv); +} + +// **************************************************************** + +EC_Shutdown::EC_Shutdown (void) +{ +} + +void +EC_Shutdown::execute_test (CORBA::Environment& ACE_TRY_ENV) +{ + if (this->verbose ()) + ACE_DEBUG ((LM_DEBUG, "EC_Shutdown (%P|%t) destroying EC\n")); + + this->destroy_ec (ACE_TRY_ENV); + ACE_CHECK; + + if (this->verbose ()) + ACE_DEBUG ((LM_DEBUG, "EC_Shutdown (%P|%t) ec destroyed\n")); + + this->deactivate_ec (ACE_TRY_ENV); + ACE_CHECK; + + if (this->verbose ()) + ACE_DEBUG ((LM_DEBUG, "EC_Shutdown (%P|%t) ec deactivated\n")); + + this->cleanup_ec (); + + if (this->verbose ()) + ACE_DEBUG ((LM_DEBUG, "EC_Shutdown (%P|%t) ec cleanup\n")); + + this->initialize_ec_impl (ACE_TRY_ENV); + ACE_CHECK; + this->connect_consumers (ACE_TRY_ENV); + ACE_CHECK; + this->connect_suppliers (ACE_TRY_ENV); + ACE_CHECK; + if (this->verbose ()) + ACE_DEBUG ((LM_DEBUG, "EC_Shutdown (%P|%t) status reset\n")); + + // this->EC_Driver::execute_test (ACE_TRY_ENV); +} + +void +EC_Shutdown::dump_results (void) +{ +} + +void +EC_Shutdown::consumer_disconnect (void* cookie, + CORBA::Environment&) +{ + ACE_DEBUG ((LM_DEBUG, "Consumer %x has been disconnected\n", cookie)); +} + +void +EC_Shutdown::supplier_disconnect (void* cookie, + CORBA::Environment&) +{ + ACE_DEBUG ((LM_DEBUG, "Supplier %x has been disconnected\n", cookie)); +} + + + +#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) + +#elif defined(ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) + +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/orbsvcs/tests/Event/Basic/Shutdown.h b/TAO/orbsvcs/tests/Event/Basic/Shutdown.h new file mode 100644 index 00000000000..0da5b0b5a38 --- /dev/null +++ b/TAO/orbsvcs/tests/Event/Basic/Shutdown.h @@ -0,0 +1,60 @@ +/* -*- C++ -*- */ +// $Id$ +// +// ============================================================================ +// +// = LIBRARY +// ORBSVCS Real-time Event Channel testsuite +// +// = FILENAME +// Shutdown +// +// = AUTHOR +// Carlos O'Ryan (coryan@cs.wustl.edu) +// +// ============================================================================ + +#ifndef EC_SHUTDOWN_H +#define EC_SHUTDOWN_H + +#include "Driver.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +class EC_Shutdown : public EC_Driver +{ + // + // = TITLE + // Test the EC shutdown features + // + // = DESCRIPTION + // The EC must inform its suppliers and consumers on the event of + // its destruction. + // This test exercises that feature of the EC. + // +public: + EC_Shutdown (void); + // Constructor + + // = The EC_Driver methods + void execute_test (CORBA::Environment& ACE_TRY_ENV); + // Don't run the suppliers just create the EC and then destroy it. + + void dump_results (void); + // Don't dump the EC_Driver results, they are meaningless. + + virtual void consumer_disconnect (void* consumer_cookie, + CORBA::Environment& ACE_TRY_ENV); + // One of the consumers in the test has been disconnected from the EC + + virtual void supplier_disconnect (void* supplier_cookie, + CORBA::Environment& ACE_TRY_ENV); + // One of the suppliers in the test has been disconnected from the EC + + +private: +}; + +#endif /* EC_SHUTDOWN_H */ diff --git a/TAO/orbsvcs/tests/Event/lib/Consumer.cpp b/TAO/orbsvcs/tests/Event/lib/Consumer.cpp index 4f5cde9e7de..d58cc00a469 100644 --- a/TAO/orbsvcs/tests/Event/lib/Consumer.cpp +++ b/TAO/orbsvcs/tests/Event/lib/Consumer.cpp @@ -138,6 +138,8 @@ void EC_Consumer::disconnect_push_consumer (CORBA::Environment &ACE_TRY_ENV) { this->driver_->consumer_disconnect (this->cookie_, ACE_TRY_ENV); + this->supplier_proxy_ = + RtecEventChannelAdmin::ProxyPushSupplier::_nil (); } // **************************************************************** diff --git a/TAO/orbsvcs/tests/Event/lib/Driver.cpp b/TAO/orbsvcs/tests/Event/lib/Driver.cpp index 815d2527742..ca7a89b87c1 100644 --- a/TAO/orbsvcs/tests/Event/lib/Driver.cpp +++ b/TAO/orbsvcs/tests/Event/lib/Driver.cpp @@ -54,29 +54,6 @@ EC_Driver::EC_Driver (void) EC_Driver::~EC_Driver (void) { - delete this->ec_impl_; -#if !defined(EC_DISABLE_OLD_EC) - delete this->scheduler_impl_; - delete this->module_factory_; -#endif - if (this->tasks_ != 0) - { - for (int i = 0; i != this->n_suppliers_; ++i) - delete this->tasks_[i]; - delete[] this->tasks_; - } - if (this->suppliers_ != 0) - { - for (int i = 0; i != this->n_suppliers_; ++i) - delete this->suppliers_[i]; - delete[] this->suppliers_; - } - if (this->consumers_ != 0) - { - for (int i = 0; i != this->n_consumers_; ++i) - delete this->consumers_[i]; - delete[] this->consumers_; - } } int @@ -136,9 +113,6 @@ EC_Driver::run (int argc, char* argv[]) this->dump_results (); - this->deactivate_ec (ACE_TRY_ENV); - ACE_TRY_CHECK; - this->disconnect_consumers (ACE_TRY_ENV); ACE_TRY_CHECK; @@ -151,11 +125,22 @@ EC_Driver::run (int argc, char* argv[]) if (this->verbose ()) ACE_DEBUG ((LM_DEBUG, "EC_Driver (%P|%t) suppliers disconnected\n")); - this->event_channel_->destroy (ACE_TRY_ENV); + this->destroy_ec (ACE_TRY_ENV); ACE_TRY_CHECK; if (this->verbose ()) ACE_DEBUG ((LM_DEBUG, "EC_Driver (%P|%t) channel destroyed\n")); + + this->deactivate_ec (ACE_TRY_ENV); + ACE_TRY_CHECK; + + if (this->verbose ()) + ACE_DEBUG ((LM_DEBUG, "EC_Driver (%P|%t) channel deactivated\n")); + + this->cleanup_tasks (); + this->cleanup_suppliers (); + this->cleanup_consumers (); + this->cleanup_ec (); } ACE_CATCHANY { @@ -447,6 +432,13 @@ EC_Driver::deactivate_ec (CORBA::Environment& ACE_TRY_ENV) #endif } +void +EC_Driver::destroy_ec (CORBA::Environment& ACE_TRY_ENV) +{ + this->event_channel_->destroy (ACE_TRY_ENV); + ACE_CHECK; +} + int EC_Driver::allocate_consumers (void) { @@ -935,6 +927,49 @@ EC_Driver::modify_attributes (TAO_EC_Event_Channel_Attributes&) } void +EC_Driver::cleanup_tasks (void) +{ + if (this->tasks_ != 0) + { + for (int i = 0; i != this->n_suppliers_; ++i) + delete this->tasks_[i]; + delete[] this->tasks_; + } +} + +void +EC_Driver::cleanup_suppliers (void) +{ + if (this->suppliers_ != 0) + { + for (int i = 0; i != this->n_suppliers_; ++i) + delete this->suppliers_[i]; + delete[] this->suppliers_; + } +} + +void +EC_Driver::cleanup_consumers (void) +{ + if (this->consumers_ != 0) + { + for (int i = 0; i != this->n_consumers_; ++i) + delete this->consumers_[i]; + delete[] this->consumers_; + } +} + +void +EC_Driver::cleanup_ec (void) +{ + delete this->ec_impl_; +#if !defined(EC_DISABLE_OLD_EC) + delete this->scheduler_impl_; + delete this->module_factory_; +#endif +} + +void EC_Driver::consumer_push (void*, const RtecEventComm::EventSet&, CORBA::Environment&) @@ -953,6 +988,12 @@ EC_Driver::consumer_disconnect (void*, { } +void +EC_Driver::supplier_disconnect (void*, + CORBA::Environment&) +{ +} + // **************************************************************** void diff --git a/TAO/orbsvcs/tests/Event/lib/Driver.h b/TAO/orbsvcs/tests/Event/lib/Driver.h index 2a5a2bd24f0..cedd92aa122 100644 --- a/TAO/orbsvcs/tests/Event/lib/Driver.h +++ b/TAO/orbsvcs/tests/Event/lib/Driver.h @@ -119,15 +119,24 @@ public: // and consumers, collect the latency and throughput results for // each and print the totals too. - virtual void deactivate_ec (CORBA::Environment& env); - // De-activate the EC (and its helper classes). - virtual void disconnect_consumers (CORBA::Environment& env); // Disconnect all the consumers. virtual void disconnect_suppliers (CORBA::Environment& env); // Disconnect all the suppliers. + virtual void destroy_ec (CORBA::Environment& env); + // Call EC->destroy + + virtual void deactivate_ec (CORBA::Environment& env); + // De-activate the EC (and its helper classes). + + virtual void cleanup_ec (void); + virtual void cleanup_tasks (void); + virtual void cleanup_consumers (void); + virtual void cleanup_suppliers (void); + // Cleanup the resources + virtual void modify_attributes (TAO_EC_Event_Channel_Attributes& attr); // Allow modifications of the default EC attributes @@ -144,6 +153,10 @@ public: CORBA::Environment& ACE_TRY_ENV); // One of the consumers in the test has been disconnected from the EC + virtual void supplier_disconnect (void* supplier_cookie, + CORBA::Environment& ACE_TRY_ENV); + // One of the suppliers in the test has been disconnected from the EC + #if !defined(EC_DISABLE_REMOTE_EC) virtual void obtain_remote_ec (CORBA::Environment& ACE_TRY_ENV); // Obtain the EC from the Naming service diff --git a/TAO/orbsvcs/tests/Event/lib/Supplier.cpp b/TAO/orbsvcs/tests/Event/lib/Supplier.cpp index 58a58a2cd9e..827ded8acff 100644 --- a/TAO/orbsvcs/tests/Event/lib/Supplier.cpp +++ b/TAO/orbsvcs/tests/Event/lib/Supplier.cpp @@ -159,8 +159,11 @@ EC_Supplier::disconnect (CORBA::Environment &ACE_TRY_ENV) } void -EC_Supplier::disconnect_push_supplier (CORBA::Environment &) +EC_Supplier::disconnect_push_supplier (CORBA::Environment &ACE_TRY_ENV) { + this->driver_->supplier_disconnect (this->cookie_, ACE_TRY_ENV); + this->consumer_proxy_ = + RtecEventChannelAdmin::ProxyPushConsumer::_nil (); } void |