summaryrefslogtreecommitdiff
path: root/TAO
diff options
context:
space:
mode:
authorcoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-05-04 15:05:14 +0000
committercoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-05-04 15:05:14 +0000
commitda5a1c3c58a1b4213aa9eec695143ed71a374aa1 (patch)
tree5a368850cf2c4ac0db9b2dc3b2b76cf4bc96707f /TAO
parent5e8694ef5b7b245f453b8350f9fb49dc57c02591 (diff)
downloadATCD-da5a1c3c58a1b4213aa9eec695143ed71a374aa1.tar.gz
ChangeLogTag:Tue May 4 09:47:04 1999 Carlos O'Ryan <coryan@cs.wustl.edu>
Diffstat (limited to 'TAO')
-rw-r--r--TAO/ChangeLog-99c37
-rw-r--r--TAO/orbsvcs/Event_Service/svc.conf2
-rw-r--r--TAO/orbsvcs/orbsvcs/Event/EC_Event_Channel.h7
-rw-r--r--TAO/orbsvcs/orbsvcs/Event/EC_Event_Channel.i24
-rw-r--r--TAO/orbsvcs/orbsvcs/Event/EC_Gateway.cpp2
-rw-r--r--TAO/orbsvcs/orbsvcs/Event/EC_ObserverStrategy.cpp58
-rw-r--r--TAO/orbsvcs/orbsvcs/Event/EC_ProxyConsumer.cpp1
-rw-r--r--TAO/orbsvcs/orbsvcs/Event/EC_SupplierAdmin.cpp30
-rw-r--r--TAO/orbsvcs/orbsvcs/Event/EC_SupplierAdmin.h3
-rw-r--r--TAO/orbsvcs/tests/EC_Mcast/EC_Mcast.cpp13
-rw-r--r--TAO/orbsvcs/tests/EC_Mcast/svc.conf2
-rw-r--r--TAO/orbsvcs/tests/EC_Throughput/ECT_Throughput.cpp12
-rw-r--r--TAO/orbsvcs/tests/EC_Throughput/ec.conf2
13 files changed, 178 insertions, 15 deletions
diff --git a/TAO/ChangeLog-99c b/TAO/ChangeLog-99c
index 2a43d2d9a67..0fa52d157a9 100644
--- a/TAO/ChangeLog-99c
+++ b/TAO/ChangeLog-99c
@@ -1,3 +1,40 @@
+Tue May 4 09:47:04 1999 Carlos O'Ryan <coryan@cs.wustl.edu>
+
+ * orbsvcs/orbsvcs/Event/EC_ObserverStrategy.cpp:
+ Completed implementation of the EC_Basic_ObserverStrategy.
+ Fixed computation of the consumers subscription list.
+ Thanks to J. Russell Noseworthy <rnosewor@objectsciences.com>
+ for helping out with this.
+
+ * orbsvcs/orbsvcs/Event/EC_Event_Channel.h:
+ * orbsvcs/orbsvcs/Event/EC_Event_Channel.i:
+ * orbsvcs/orbsvcs/Event/EC_SupplierAdmin.h:
+ * orbsvcs/orbsvcs/Event/EC_SupplierAdmin.cpp:
+ Added locking on the SupplierAdmin object, the ConsumerAdmin
+ does not need it since the locking is handled by its
+ SupplierSet.
+
+ * orbsvcs/orbsvcs/Event/EC_Gateway.cpp:
+ Cleaned up publication list computation, thanks to J. Russell
+ Noseworthy <rnosewor@objectsciences.com> for helping out with
+ this.
+
+ * orbsvcs/Event_Service/svc.conf:
+ Added locks for the ConsumerAdmin and SupplierAdmin modules.
+
+ * orbsvcs/orbsvcs/Event/EC_ProxyConsumer.cpp:
+ * orbsvcs/tests/EC_Throughput/ECT_Throughput.cpp:
+ Minor cosmetic fixes.
+
+ * orbsvcs/tests/EC_Mcast/svc.conf:
+ Added the right configuration options for the new EC.
+
+ * orbsvcs/tests/EC_Mcast/EC_Mcast.cpp:
+ Added initialization of the EC_Default_Factory.
+ Workaround what appears to be a bug in glibc2 implementation of
+ rand_r(), it returns negative values but it should only return
+ numbers in the range [0,RAND_MAX)
+
Mon May 3 23:46:31 1999 Jeff Parsons <parsons@cs.wustl.edu>
* TAO_IDL/driver/drv_preproc.cpp:
diff --git a/TAO/orbsvcs/Event_Service/svc.conf b/TAO/orbsvcs/Event_Service/svc.conf
index f14cddbd175..fa9576a1919 100644
--- a/TAO/orbsvcs/Event_Service/svc.conf
+++ b/TAO/orbsvcs/Event_Service/svc.conf
@@ -1,2 +1,2 @@
# $Id$
-static EC_Factory "-ECfiltering basic -ECpushsupplierset delayed -ECproxyconsumerlock thread -ECproxysupplierlock thread -ECsupplierfiltering per-supplier"
+static EC_Factory "-ECfiltering basic -ECpushsupplierset delayed -ECproxyconsumerlock thread -ECproxysupplierlock thread -ECconsumeradminlock thread -ECsupplieradminlock thread -ECsupplierfiltering per-supplier"
diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Event_Channel.h b/TAO/orbsvcs/orbsvcs/Event/EC_Event_Channel.h
index 6aecda000d8..5e92925203b 100644
--- a/TAO/orbsvcs/orbsvcs/Event/EC_Event_Channel.h
+++ b/TAO/orbsvcs/orbsvcs/Event/EC_Event_Channel.h
@@ -113,6 +113,13 @@ public:
// Locking strategies for the ProxyPushConsumer and
// ProxyPushSupplier objects
+ ACE_Lock* create_consumer_admin_lock (void);
+ void destroy_consumer_admin_lock (ACE_Lock*);
+ ACE_Lock* create_supplier_admin_lock (void);
+ void destroy_supplier_admin_lock (ACE_Lock*);
+ // Locking strategies for the ConsumerAdmin and SupplierAdmin
+ // objects
+
virtual void connected (TAO_EC_ProxyPushConsumer*,
CORBA::Environment&);
virtual void disconnected (TAO_EC_ProxyPushConsumer*,
diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Event_Channel.i b/TAO/orbsvcs/orbsvcs/Event/EC_Event_Channel.i
index 5572e235c9e..471be7cfd9b 100644
--- a/TAO/orbsvcs/orbsvcs/Event/EC_Event_Channel.i
+++ b/TAO/orbsvcs/orbsvcs/Event/EC_Event_Channel.i
@@ -107,3 +107,27 @@ TAO_EC_Event_Channel::destroy_supplier_lock (ACE_Lock* x)
{
this->factory_->destroy_supplier_lock (x);
}
+
+ACE_INLINE ACE_Lock*
+TAO_EC_Event_Channel::create_consumer_admin_lock (void)
+{
+ return this->factory_->create_consumer_admin_lock ();
+}
+
+ACE_INLINE void
+TAO_EC_Event_Channel::destroy_consumer_admin_lock (ACE_Lock* x)
+{
+ this->factory_->destroy_consumer_admin_lock (x);
+}
+
+ACE_INLINE ACE_Lock*
+TAO_EC_Event_Channel::create_supplier_admin_lock (void)
+{
+ return this->factory_->create_supplier_admin_lock ();
+}
+
+ACE_INLINE void
+TAO_EC_Event_Channel::destroy_supplier_admin_lock (ACE_Lock* x)
+{
+ this->factory_->destroy_supplier_admin_lock (x);
+}
diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Gateway.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_Gateway.cpp
index 1f68c500a66..4737ba276c8 100644
--- a/TAO/orbsvcs/orbsvcs/Event/EC_Gateway.cpp
+++ b/TAO/orbsvcs/orbsvcs/Event/EC_Gateway.cpp
@@ -182,7 +182,7 @@ TAO_EC_Gateway_IIOP::update_consumer (const RtecEventChannelAdmin::ConsumerQOS&
++j)
{
RtecEventChannelAdmin::SupplierQOS pub;
- pub.publications.length (sub.dependencies.length () - 1);
+ pub.publications.length (sub.dependencies.length ());
pub.is_gateway = 1;
int c = 0;
diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_ObserverStrategy.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_ObserverStrategy.cpp
index d7694da596f..0c23ab6c4d6 100644
--- a/TAO/orbsvcs/orbsvcs/Event/EC_ObserverStrategy.cpp
+++ b/TAO/orbsvcs/orbsvcs/Event/EC_ObserverStrategy.cpp
@@ -133,26 +133,74 @@ TAO_EC_Basic_ObserverStrategy::remove_observer (
void
TAO_EC_Basic_ObserverStrategy::connected (TAO_EC_ProxyPushConsumer*,
- CORBA::Environment &)
+ CORBA::Environment &ACE_TRY_ENV)
{
+ RtecEventChannelAdmin::ConsumerQOS c_qos;
+ this->fill_qos (c_qos, ACE_TRY_ENV);
+ ACE_CHECK;
+
+ for (Observer_Map_Iterator i = this->observers_.begin ();
+ i != this->observers_.end ();
+ ++i)
+ {
+ Observer_Entry& entry = (*i).int_id_;
+ entry.observer->update_consumer (c_qos, ACE_TRY_ENV);
+ ACE_CHECK;
+ }
}
void
TAO_EC_Basic_ObserverStrategy::disconnected (TAO_EC_ProxyPushConsumer*,
- CORBA::Environment &)
+ CORBA::Environment &ACE_TRY_ENV)
{
+ RtecEventChannelAdmin::ConsumerQOS c_qos;
+ this->fill_qos (c_qos, ACE_TRY_ENV);
+ ACE_CHECK;
+
+ for (Observer_Map_Iterator i = this->observers_.begin ();
+ i != this->observers_.end ();
+ ++i)
+ {
+ Observer_Entry& entry = (*i).int_id_;
+ entry.observer->update_consumer (c_qos, ACE_TRY_ENV);
+ ACE_CHECK;
+ }
}
void
TAO_EC_Basic_ObserverStrategy::connected (TAO_EC_ProxyPushSupplier*,
- CORBA::Environment &)
+ CORBA::Environment &ACE_TRY_ENV)
{
+ RtecEventChannelAdmin::SupplierQOS s_qos;
+ this->fill_qos (s_qos, ACE_TRY_ENV);
+ ACE_CHECK;
+
+ for (Observer_Map_Iterator i = this->observers_.begin ();
+ i != this->observers_.end ();
+ ++i)
+ {
+ Observer_Entry& entry = (*i).int_id_;
+ entry.observer->update_supplier (s_qos, ACE_TRY_ENV);
+ ACE_CHECK;
+ }
}
void
TAO_EC_Basic_ObserverStrategy::disconnected (TAO_EC_ProxyPushSupplier*,
- CORBA::Environment &)
+ CORBA::Environment &ACE_TRY_ENV)
{
+ RtecEventChannelAdmin::SupplierQOS s_qos;
+ this->fill_qos (s_qos, ACE_TRY_ENV);
+ ACE_CHECK_RETURN (0);
+
+ for (Observer_Map_Iterator i = this->observers_.begin ();
+ i != this->observers_.end ();
+ ++i)
+ {
+ Observer_Entry& entry = (*i).int_id_;
+ entry.observer->update_supplier (s_qos, ACE_TRY_ENV);
+ ACE_CHECK;
+ }
}
void
@@ -202,7 +250,7 @@ TAO_EC_Basic_ObserverStrategy::fill_qos (
RtecEventChannelAdmin::DependencySet& dep = qos.dependencies;
- dep.length (count + 1);
+ dep.length (count);
dep[0].event.header.type = ACE_ES_DISJUNCTION_DESIGNATOR;
dep[0].event.header.source = 0;
diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_ProxyConsumer.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_ProxyConsumer.cpp
index 2f6bc8b9a56..a428a612d5d 100644
--- a/TAO/orbsvcs/orbsvcs/Event/EC_ProxyConsumer.cpp
+++ b/TAO/orbsvcs/orbsvcs/Event/EC_ProxyConsumer.cpp
@@ -172,4 +172,3 @@ TAO_EC_ProxyPushConsumer::_remove_ref (CORBA::Environment &)
{
this->_decr_refcnt ();
}
-
diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_SupplierAdmin.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_SupplierAdmin.cpp
index 6f7ed8f6069..95a471dedc9 100644
--- a/TAO/orbsvcs/orbsvcs/Event/EC_SupplierAdmin.cpp
+++ b/TAO/orbsvcs/orbsvcs/Event/EC_SupplierAdmin.cpp
@@ -16,10 +16,20 @@ TAO_EC_SupplierAdmin::TAO_EC_SupplierAdmin (TAO_EC_Event_Channel *ec)
{
this->default_POA_ =
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
+ // is no potential for dead-lock when dispatching events and/or
+ // adding multiple suppliers and consumers, but we could avoid
+ // some priority inversions.
+ this->lock_ =
+ this->event_channel_->create_supplier_admin_lock ();
}
TAO_EC_SupplierAdmin::~TAO_EC_SupplierAdmin (void)
{
+ this->event_channel_->destroy_supplier_admin_lock (this->lock_);
}
PortableServer::POA_ptr
@@ -32,6 +42,11 @@ void
TAO_EC_SupplierAdmin::connected (TAO_EC_ProxyPushSupplier *supplier,
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;
@@ -48,6 +63,11 @@ void
TAO_EC_SupplierAdmin::disconnected (TAO_EC_ProxyPushSupplier *supplier,
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;
@@ -64,6 +84,11 @@ void
TAO_EC_SupplierAdmin::connected (TAO_EC_ProxyPushConsumer *consumer,
CORBA::Environment &ACE_TRY_ENV)
{
+ ACE_GUARD_THROW_EX (
+ ACE_Lock, ace_mon, *this->lock_,
+ RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR ());
+ ACE_CHECK;
+
if (this->all_consumers_.insert (consumer) != 0)
ACE_THROW (CORBA::NO_MEMORY ());
}
@@ -72,6 +97,11 @@ void
TAO_EC_SupplierAdmin::disconnected (TAO_EC_ProxyPushConsumer *consumer,
CORBA::Environment &ACE_TRY_ENV)
{
+ ACE_GUARD_THROW_EX (
+ ACE_Lock, ace_mon, *this->lock_,
+ RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR ());
+ ACE_CHECK;
+
if (this->all_consumers_.remove (consumer) != 0)
ACE_THROW (RtecEventChannelAdmin::EventChannel::SUBSCRIPTION_ERROR ());
}
diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_SupplierAdmin.h b/TAO/orbsvcs/orbsvcs/Event/EC_SupplierAdmin.h
index 26499991a76..3dc3032ebd9 100644
--- a/TAO/orbsvcs/orbsvcs/Event/EC_SupplierAdmin.h
+++ b/TAO/orbsvcs/orbsvcs/Event/EC_SupplierAdmin.h
@@ -98,6 +98,9 @@ private:
PortableServer::POA_var default_POA_;
// Store the default POA.
+ ACE_Lock* lock_;
+ // The locking strategy
+
ConsumerSet all_consumers_;
// The set of consumers...
};
diff --git a/TAO/orbsvcs/tests/EC_Mcast/EC_Mcast.cpp b/TAO/orbsvcs/tests/EC_Mcast/EC_Mcast.cpp
index 5e73e42cb0b..0149c27795f 100644
--- a/TAO/orbsvcs/tests/EC_Mcast/EC_Mcast.cpp
+++ b/TAO/orbsvcs/tests/EC_Mcast/EC_Mcast.cpp
@@ -10,6 +10,7 @@
#include "orbsvcs/Time_Utilities.h"
#include "orbsvcs/Event/EC_Event_Channel.h"
+#include "orbsvcs/Event/EC_Default_Factory.h"
#include "EC_Mcast.h"
@@ -787,7 +788,8 @@ ECM_Consumer::connect (ACE_RANDR_TYPE &seed,
const ECM_Federation* federation = this->federation_->federation ();
for (int i = 0; i < federation->consumer_types (); ++i)
{
- if (ACE_OS::rand_r (seed) < RAND_MAX / 2)
+ unsigned int x = ACE_OS::rand_r (seed);
+ if (x < RAND_MAX / 2)
{
ACE_DEBUG ((LM_DEBUG,
"Federation %s leaves group %s\n",
@@ -957,14 +959,15 @@ ECM_Local_Federation::supplier_timeout (RtecEventComm::PushConsumer_ptr consumer
ACE_Time_Value delta = ACE_OS::gettimeofday () -
this->last_subscription_change_;
- double p = double (ACE_OS::rand_r (this->seed_)) / RAND_MAX;
+ unsigned int x = ACE_OS::rand_r (this->seed_);
+ double p = double (x) / RAND_MAX;
double maxp = double (delta.msec ()) / this->subscription_change_period_;
if (4 * p < maxp)
{
ACE_DEBUG ((LM_DEBUG,
- "Reconfiguring federation %s: %f %f\n",
- this->name (), p, maxp));
+ "Reconfiguring federation %s: %f %f [%d]\n",
+ this->name (), p, maxp, x));
this->consumer_.disconnect (TAO_IN_ENV);
TAO_CHECK_ENV_RETURN_VOID (TAO_IN_ENV);
this->consumer_.connect (this->seed_, TAO_IN_ENV);
@@ -1118,6 +1121,8 @@ ECM_Local_Federation::subscribed_bit (int i) const
int
main (int argc, char *argv [])
{
+ TAO_EC_Default_Factory::init_svcs ();
+
ECM_Driver driver;
return driver.run (argc, argv);
}
diff --git a/TAO/orbsvcs/tests/EC_Mcast/svc.conf b/TAO/orbsvcs/tests/EC_Mcast/svc.conf
index 449b02caf51..925d535e41b 100644
--- a/TAO/orbsvcs/tests/EC_Mcast/svc.conf
+++ b/TAO/orbsvcs/tests/EC_Mcast/svc.conf
@@ -1,2 +1,2 @@
# $Id$
-static EC_Factory "-ECfiltering basic -ECpushsupplierset delayed -ECproxyconsumerlock thread -ECproxysupplierlock recursive"
+static EC_Factory "-ECfiltering basic -ECpushsupplierset delayed -ECproxyconsumerlock thread -ECproxysupplierlock thread -ECconsumeradminlock null -ECsupplieradminlock thread -ECsupplierfiltering per-supplier -ECobserver basic"
diff --git a/TAO/orbsvcs/tests/EC_Throughput/ECT_Throughput.cpp b/TAO/orbsvcs/tests/EC_Throughput/ECT_Throughput.cpp
index e19f6998bf3..a56f9797ffb 100644
--- a/TAO/orbsvcs/tests/EC_Throughput/ECT_Throughput.cpp
+++ b/TAO/orbsvcs/tests/EC_Throughput/ECT_Throughput.cpp
@@ -291,6 +291,8 @@ ECT_Throughput::run (int argc, char* argv[])
TAO_CHECK_ENV;
}
+ ACE_DEBUG ((LM_DEBUG, "EC deactivated\n"));
+
{
// Deactivate the Scheduler
PortableServer::POA_var poa =
@@ -303,14 +305,22 @@ ECT_Throughput::run (int argc, char* argv[])
TAO_CHECK_ENV;
}
+ ACE_DEBUG ((LM_DEBUG, "scheduler deactivated\n"));
+
this->disconnect_consumers (TAO_TRY_ENV);
TAO_CHECK_ENV;
+ ACE_DEBUG ((LM_DEBUG, "consumers disconnected\n"));
+
this->disconnect_suppliers (TAO_TRY_ENV);
TAO_CHECK_ENV;
+ ACE_DEBUG ((LM_DEBUG, "suppliers disconnected\n"));
+
channel->destroy (TAO_TRY_ENV);
TAO_CHECK_ENV;
+
+ ACE_DEBUG ((LM_DEBUG, "channel destroyed\n"));
}
TAO_CATCHANY
{
@@ -477,7 +487,7 @@ ECT_Throughput::parse_args (int argc, char *argv [])
{
ACE_Get_Opt get_opt (argc, argv, "rdc:s:u:n:t:b:h:l:p:m:w:");
int opt;
-
+
while ((opt = get_opt ()) != EOF)
{
switch (opt)
diff --git a/TAO/orbsvcs/tests/EC_Throughput/ec.conf b/TAO/orbsvcs/tests/EC_Throughput/ec.conf
index f14cddbd175..f47239bdfc3 100644
--- a/TAO/orbsvcs/tests/EC_Throughput/ec.conf
+++ b/TAO/orbsvcs/tests/EC_Throughput/ec.conf
@@ -1,2 +1,2 @@
# $Id$
-static EC_Factory "-ECfiltering basic -ECpushsupplierset delayed -ECproxyconsumerlock thread -ECproxysupplierlock thread -ECsupplierfiltering per-supplier"
+static EC_Factory "-ECfiltering basic -ECpushsupplierset delayed -ECproxyconsumerlock thread -ECproxysupplierlock thread -ECconsumeradminlock null -ECsupplieradminlock thread -ECsupplierfiltering per-supplier"