summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs
diff options
context:
space:
mode:
authorcoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-06-22 17:37:42 +0000
committercoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-06-22 17:37:42 +0000
commit590db8ee5a9d6af9daac56e013b69a91b302bcad (patch)
treef1e279d06c2757d180a9f95e4f38b094e4b6b2ad /TAO/orbsvcs
parent8dec666aa952d00fbbf65d364200f9fe2a4ab6d2 (diff)
downloadATCD-590db8ee5a9d6af9daac56e013b69a91b302bcad.tar.gz
ChangeLogTag:Tue Jun 22 11:39:43 1999 Carlos O'Ryan <coryan@cs.wustl.edu>
Diffstat (limited to 'TAO/orbsvcs')
-rw-r--r--TAO/orbsvcs/orbsvcs/Event/EC_ProxyPushSupplier_Set.cpp2
-rw-r--r--TAO/orbsvcs/tests/Event/lib/Consumer.cpp12
-rw-r--r--TAO/orbsvcs/tests/Event/lib/Consumer.h6
-rw-r--r--TAO/orbsvcs/tests/Event/lib/Driver.cpp37
-rw-r--r--TAO/orbsvcs/tests/Event/lib/Driver.h10
-rw-r--r--TAO/orbsvcs/tests/Event/lib/Supplier.cpp15
-rw-r--r--TAO/orbsvcs/tests/Event/lib/Supplier.h6
7 files changed, 83 insertions, 5 deletions
diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_ProxyPushSupplier_Set.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_ProxyPushSupplier_Set.cpp
index 3d8d53be5ca..e2a90faecda 100644
--- a/TAO/orbsvcs/orbsvcs/Event/EC_ProxyPushSupplier_Set.cpp
+++ b/TAO/orbsvcs/orbsvcs/Event/EC_ProxyPushSupplier_Set.cpp
@@ -27,7 +27,7 @@ TAO_EC_ProxyPushSupplier_Set::connected_i (
TAO_EC_ProxyPushSupplier *supplier,
CORBA::Environment &ACE_TRY_ENV)
{
- if (this->all_suppliers_.insert (supplier) != 0)
+ if (this->all_suppliers_.insert (supplier) == -1)
ACE_THROW (CORBA::NO_MEMORY ());
}
diff --git a/TAO/orbsvcs/tests/Event/lib/Consumer.cpp b/TAO/orbsvcs/tests/Event/lib/Consumer.cpp
index 7d25fe17bfb..0622ed6eb4e 100644
--- a/TAO/orbsvcs/tests/Event/lib/Consumer.cpp
+++ b/TAO/orbsvcs/tests/Event/lib/Consumer.cpp
@@ -11,7 +11,8 @@ EC_Consumer::EC_Consumer (EC_Driver *driver,
: driver_ (driver),
cookie_ (cookie),
push_count_ (0),
- shutdown_event_type_ (ACE_ES_EVENT_SHUTDOWN)
+ shutdown_event_type_ (ACE_ES_EVENT_SHUTDOWN),
+ is_active_ (0)
{
}
@@ -42,6 +43,7 @@ EC_Consumer::connect (
RtecEventComm::PushConsumer_var objref = this->_this (ACE_TRY_ENV);
ACE_CHECK;
+ this->is_active_ = 1;
this->supplier_proxy_->connect_push_consumer (objref.in (),
qos,
@@ -66,6 +68,13 @@ EC_Consumer::disconnect (CORBA::Environment &ACE_TRY_ENV)
this->supplier_proxy_ =
RtecEventChannelAdmin::ProxyPushSupplier::_nil ();
+}
+
+void
+EC_Consumer::shutdown (CORBA::Environment &ACE_TRY_ENV)
+{
+ if (!this->is_active_)
+ return;
// Deactivate the servant
PortableServer::POA_var poa =
@@ -76,6 +85,7 @@ EC_Consumer::disconnect (CORBA::Environment &ACE_TRY_ENV)
ACE_CHECK;
poa->deactivate_object (id.in (), ACE_TRY_ENV);
ACE_CHECK;
+ this->is_active_ = 0;
}
void
diff --git a/TAO/orbsvcs/tests/Event/lib/Consumer.h b/TAO/orbsvcs/tests/Event/lib/Consumer.h
index e764d31666d..68231280d09 100644
--- a/TAO/orbsvcs/tests/Event/lib/Consumer.h
+++ b/TAO/orbsvcs/tests/Event/lib/Consumer.h
@@ -67,6 +67,9 @@ public:
// The application can invoke this method to disconnect from the EC
// and deactivate this class.
+ void shutdown (CORBA::Environment &ACE_TRY_ENV);
+ // The application is shutting down, deactivate the consumer.
+
void accumulate (EC_Driver::Throughput_Stats& throughput,
EC_Driver::Latency_Stats& latency) const;
// Accumulate our statistics to the totals.
@@ -108,6 +111,9 @@ private:
int shutdown_event_type_;
// The type used to indicate shutdown
+
+ int is_active_;
+ // Is the consumer active in the POA?
};
#endif /* ECT_CONSUMER_H */
diff --git a/TAO/orbsvcs/tests/Event/lib/Driver.cpp b/TAO/orbsvcs/tests/Event/lib/Driver.cpp
index 68d14eb5687..324d59ed016 100644
--- a/TAO/orbsvcs/tests/Event/lib/Driver.cpp
+++ b/TAO/orbsvcs/tests/Event/lib/Driver.cpp
@@ -139,6 +139,9 @@ EC_Driver::run_cleanup (CORBA::Environment &ACE_TRY_ENV)
this->disconnect_clients (ACE_TRY_ENV);
ACE_CHECK;
+ this->shutdown_clients (ACE_TRY_ENV);
+ ACE_CHECK;
+
this->destroy_ec (ACE_TRY_ENV);
ACE_CHECK;
@@ -501,6 +504,16 @@ EC_Driver::disconnect_clients (CORBA::Environment &ACE_TRY_ENV)
}
void
+EC_Driver::shutdown_clients (CORBA::Environment &ACE_TRY_ENV)
+{
+ this->shutdown_suppliers (ACE_TRY_ENV);
+ ACE_CHECK;
+
+ this->shutdown_consumers (ACE_TRY_ENV);
+ ACE_CHECK;
+}
+
+void
EC_Driver::connect_consumers (CORBA::Environment &ACE_TRY_ENV)
{
RtecEventChannelAdmin::ConsumerAdmin_var consumer_admin =
@@ -720,6 +733,30 @@ EC_Driver::disconnect_consumers (CORBA::Environment &ACE_TRY_ENV)
}
void
+EC_Driver::shutdown_suppliers (CORBA::Environment &ACE_TRY_ENV)
+{
+ for (int i = 0; i < this->n_suppliers_; ++i)
+ {
+ this->suppliers_[i]->shutdown (ACE_TRY_ENV);
+ ACE_CHECK;
+ }
+ if (this->verbose ())
+ ACE_DEBUG ((LM_DEBUG, "EC_Driver (%P|%t) suppliers deactivated\n"));
+}
+
+void
+EC_Driver::shutdown_consumers (CORBA::Environment &ACE_TRY_ENV)
+{
+ for (int i = 0; i < this->n_consumers_; ++i)
+ {
+ this->consumers_[i]->shutdown (ACE_TRY_ENV);
+ ACE_CHECK;
+ }
+ if (this->verbose ())
+ ACE_DEBUG ((LM_DEBUG, "EC_Driver (%P|%t) consumers deactivated\n"));
+}
+
+void
EC_Driver::dump_results (void)
{
EC_Driver::Throughput_Stats throughput;
diff --git a/TAO/orbsvcs/tests/Event/lib/Driver.h b/TAO/orbsvcs/tests/Event/lib/Driver.h
index f64ea4d7398..40f4b51833d 100644
--- a/TAO/orbsvcs/tests/Event/lib/Driver.h
+++ b/TAO/orbsvcs/tests/Event/lib/Driver.h
@@ -96,6 +96,10 @@ public:
// By default disconnect the suppliers and then the consumers, other
// orders should work too.
+ virtual void shutdown_clients (CORBA::Environment &env);
+ // By default deactivate the suppliers and then the consumers, other
+ // orders should work too.
+
virtual void connect_consumers (CORBA::Environment& env);
// Connect all the consumers, by default it lets each consumer
// connect itself.
@@ -144,6 +148,12 @@ public:
virtual void disconnect_suppliers (CORBA::Environment& env);
// Disconnect all the suppliers.
+ virtual void shutdown_consumers (CORBA::Environment& env);
+ // Deactivate all the consumers.
+
+ virtual void shutdown_suppliers (CORBA::Environment& env);
+ // Deactivate all the suppliers.
+
virtual void destroy_ec (CORBA::Environment& env);
// Call EC->destroy
diff --git a/TAO/orbsvcs/tests/Event/lib/Supplier.cpp b/TAO/orbsvcs/tests/Event/lib/Supplier.cpp
index 405db46dd04..33d9d45af56 100644
--- a/TAO/orbsvcs/tests/Event/lib/Supplier.cpp
+++ b/TAO/orbsvcs/tests/Event/lib/Supplier.cpp
@@ -15,7 +15,8 @@ EC_Supplier::EC_Supplier (EC_Driver *driver,
burst_size_ (0),
payload_size_ (0),
burst_pause_ (0),
- shutdown_event_type_ (0)
+ shutdown_event_type_ (0),
+ is_active_ (0)
{
}
@@ -125,9 +126,9 @@ EC_Supplier::connect (const RtecEventChannelAdmin::SupplierQOS& qos,
this->qos_ = qos;
this->shutdown_event_type_ = shutdown_event_type;
- RtecEventComm::PushSupplier_var objref =
- this->_this (ACE_TRY_ENV);
+ RtecEventComm::PushSupplier_var objref = this->_this (ACE_TRY_ENV);
ACE_CHECK;
+ this->is_active_ = 1;
this->consumer_proxy_->connect_push_supplier (objref.in (),
qos,
@@ -146,6 +147,13 @@ EC_Supplier::disconnect (CORBA::Environment &ACE_TRY_ENV)
this->consumer_proxy_ =
RtecEventChannelAdmin::ProxyPushConsumer::_nil ();
+}
+
+void
+EC_Supplier::shutdown (CORBA::Environment &ACE_TRY_ENV)
+{
+ if (!this->is_active_)
+ return;
// Deactivate the servant
PortableServer::POA_var poa =
@@ -156,6 +164,7 @@ EC_Supplier::disconnect (CORBA::Environment &ACE_TRY_ENV)
ACE_CHECK;
poa->deactivate_object (id.in (), ACE_TRY_ENV);
ACE_CHECK;
+ this->is_active_ = 0;
}
void
diff --git a/TAO/orbsvcs/tests/Event/lib/Supplier.h b/TAO/orbsvcs/tests/Event/lib/Supplier.h
index 09e0e423134..b2d5dcc1bfa 100644
--- a/TAO/orbsvcs/tests/Event/lib/Supplier.h
+++ b/TAO/orbsvcs/tests/Event/lib/Supplier.h
@@ -86,6 +86,9 @@ public:
void disconnect (CORBA::Environment &ACE_TRY_ENV);
// Disconnect from the EC, also deactivates the object
+ void shutdown (CORBA::Environment &ACE_TRY_ENV);
+ // Disconnect from the EC, also deactivates the object
+
virtual void dump_results (const char* name);
// Dump the results...
@@ -129,6 +132,9 @@ private:
RtecEventChannelAdmin::SupplierQOS qos_;
// The publications, used to select the events.
+
+ int is_active_;
+ // Is the supplier active in the POA?
};
// ****************************************************************