summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs
diff options
context:
space:
mode:
authorcoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-04-30 17:45:43 +0000
committercoryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-04-30 17:45:43 +0000
commitdc87f821e1852ae3445f4decd8045e7200633e3b (patch)
tree33827585a026f56d6ffc3e9668aab9e35db37f48 /TAO/orbsvcs
parent1e8ee5e4cc862cf571231de72c097d63beaae123 (diff)
downloadATCD-dc87f821e1852ae3445f4decd8045e7200633e3b.tar.gz
ChangeLogTag:Fri Apr 30 12:42:06 1999 Carlos O'Ryan <coryan@cs.wustl.edu>
Diffstat (limited to 'TAO/orbsvcs')
-rw-r--r--TAO/orbsvcs/orbsvcs/Event/EC_ConsumerAdmin.cpp13
-rw-r--r--TAO/orbsvcs/orbsvcs/Event/EC_ConsumerAdmin.h9
-rw-r--r--TAO/orbsvcs/orbsvcs/Event/EC_Event_Channel.cpp12
-rw-r--r--TAO/orbsvcs/orbsvcs/Event/EC_Event_Channel.h4
-rw-r--r--TAO/orbsvcs/orbsvcs/Event/EC_Event_Channel.i4
-rw-r--r--TAO/orbsvcs/orbsvcs/Event/EC_ProxyConsumer.cpp98
-rw-r--r--TAO/orbsvcs/orbsvcs/Event/EC_ProxyConsumer.h27
-rw-r--r--TAO/orbsvcs/orbsvcs/Event/EC_ProxyConsumer.i15
-rw-r--r--TAO/orbsvcs/orbsvcs/Event/EC_ProxySupplier.cpp59
-rw-r--r--TAO/orbsvcs/orbsvcs/Event/EC_ProxySupplier.h20
-rw-r--r--TAO/orbsvcs/orbsvcs/Event/EC_SupplierAdmin.cpp13
-rw-r--r--TAO/orbsvcs/orbsvcs/Event/EC_SupplierAdmin.h3
-rw-r--r--TAO/orbsvcs/orbsvcs/Event/Event_Channel.cpp50
-rw-r--r--TAO/orbsvcs/orbsvcs/Event/Event_Channel.h12
-rw-r--r--TAO/orbsvcs/orbsvcs/Event/Event_Channel.i12
15 files changed, 203 insertions, 148 deletions
diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_ConsumerAdmin.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_ConsumerAdmin.cpp
index 6e614ef54ba..09e8a3fa84b 100644
--- a/TAO/orbsvcs/orbsvcs/Event/EC_ConsumerAdmin.cpp
+++ b/TAO/orbsvcs/orbsvcs/Event/EC_ConsumerAdmin.cpp
@@ -22,6 +22,8 @@ TAO_EC_ConsumerAdmin::TAO_EC_ConsumerAdmin (TAO_EC_Event_Channel *ec,
this->supplier_set_ =
this->event_channel_->create_proxy_push_supplier_set ();
}
+ this->default_POA_ =
+ this->event_channel_->consumer_poa ();
}
TAO_EC_ConsumerAdmin::~TAO_EC_ConsumerAdmin (void)
@@ -31,13 +33,6 @@ TAO_EC_ConsumerAdmin::~TAO_EC_ConsumerAdmin (void)
}
void
-TAO_EC_ConsumerAdmin::set_default_POA (PortableServer::POA_ptr poa)
-{
- this->default_POA_ =
- PortableServer::POA::_duplicate (poa);
-}
-
-void
TAO_EC_ConsumerAdmin::connected (TAO_EC_ProxyPushConsumer *consumer,
CORBA::Environment &ACE_TRY_ENV)
{
@@ -99,10 +94,6 @@ TAO_EC_ConsumerAdmin::obtain_push_supplier (CORBA::Environment &ACE_TRY_ENV)
TAO_EC_ProxyPushSupplier* supplier =
this->event_channel_->create_proxy_push_supplier ();
- PortableServer::POA_var poa =
- this->event_channel_->supplier_poa (ACE_TRY_ENV);
- supplier->set_default_POA (poa.in ());
-
return supplier->_this (ACE_TRY_ENV);
}
diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_ConsumerAdmin.h b/TAO/orbsvcs/orbsvcs/Event/EC_ConsumerAdmin.h
index 7fdf340e443..543ed30a456 100644
--- a/TAO/orbsvcs/orbsvcs/Event/EC_ConsumerAdmin.h
+++ b/TAO/orbsvcs/orbsvcs/Event/EC_ConsumerAdmin.h
@@ -83,12 +83,6 @@ public:
CORBA::ULong max_write_delay (void) const;
// Delegate on the EC_ProxyPushSupplier....
- void set_default_POA (PortableServer::POA_ptr poa);
- // Set this servant's default POA
-
- virtual PortableServer::POA_ptr _default_POA (CORBA::Environment& env);
- // Override the ServantBase method.
-
virtual void connected (TAO_EC_ProxyPushConsumer*,
CORBA::Environment&);
virtual void disconnected (TAO_EC_ProxyPushConsumer*,
@@ -107,6 +101,9 @@ public:
virtual RtecEventChannelAdmin::ProxyPushSupplier_ptr
obtain_push_supplier (CORBA::Environment &);
+ // = The PortableServer::ServantBase methods
+ virtual PortableServer::POA_ptr _default_POA (CORBA::Environment& env);
+
private:
TAO_EC_Event_Channel *event_channel_;
// The Event Channel we belong to
diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Event_Channel.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_Event_Channel.cpp
index 64cc17aba2b..be3f712ea3c 100644
--- a/TAO/orbsvcs/orbsvcs/Event/EC_Event_Channel.cpp
+++ b/TAO/orbsvcs/orbsvcs/Event/EC_Event_Channel.cpp
@@ -77,20 +77,10 @@ TAO_EC_Event_Channel::~TAO_EC_Event_Channel (void)
}
void
-TAO_EC_Event_Channel::activate (CORBA::Environment& ACE_TRY_ENV)
+TAO_EC_Event_Channel::activate (CORBA::Environment&)
{
this->dispatching_->activate ();
this->timeout_generator_->activate ();
-
- PortableServer::POA_var supplier_poa =
- this->supplier_poa (ACE_TRY_ENV);
- ACE_CHECK;
- this->supplier_admin_->set_default_POA (supplier_poa.in ());
-
- PortableServer::POA_var consumer_poa =
- this->consumer_poa (ACE_TRY_ENV);
- ACE_CHECK;
- this->consumer_admin_->set_default_POA (consumer_poa.in ());
}
void
diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Event_Channel.h b/TAO/orbsvcs/orbsvcs/Event/EC_Event_Channel.h
index 4480b052dea..6aecda000d8 100644
--- a/TAO/orbsvcs/orbsvcs/Event/EC_Event_Channel.h
+++ b/TAO/orbsvcs/orbsvcs/Event/EC_Event_Channel.h
@@ -102,8 +102,8 @@ public:
void destroy_proxy_push_supplier_set (TAO_EC_ProxyPushSupplier_Set*);
// Create and destroy a ProxyPushSupplier_Set
- PortableServer::POA_ptr supplier_poa (CORBA::Environment&);
- PortableServer::POA_ptr consumer_poa (CORBA::Environment&);
+ PortableServer::POA_ptr supplier_poa (void);
+ PortableServer::POA_ptr consumer_poa (void);
// Access the supplier and consumer POAs from the factory.
ACE_Lock* create_consumer_lock (void);
diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_Event_Channel.i b/TAO/orbsvcs/orbsvcs/Event/EC_Event_Channel.i
index 8c245cca820..5572e235c9e 100644
--- a/TAO/orbsvcs/orbsvcs/Event/EC_Event_Channel.i
+++ b/TAO/orbsvcs/orbsvcs/Event/EC_Event_Channel.i
@@ -73,13 +73,13 @@ TAO_EC_Event_Channel::destroy_proxy_push_consumer (TAO_EC_ProxyPushConsumer* con
}
ACE_INLINE PortableServer::POA_ptr
-TAO_EC_Event_Channel::supplier_poa (CORBA::Environment&)
+TAO_EC_Event_Channel::supplier_poa (void)
{
return PortableServer::POA::_duplicate (this->supplier_poa_.in ());
}
ACE_INLINE PortableServer::POA_ptr
-TAO_EC_Event_Channel::consumer_poa (CORBA::Environment &)
+TAO_EC_Event_Channel::consumer_poa (void)
{
return PortableServer::POA::_duplicate (this->consumer_poa_.in ());
}
diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_ProxyConsumer.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_ProxyConsumer.cpp
index ab408795abb..2f6bc8b9a56 100644
--- a/TAO/orbsvcs/orbsvcs/Event/EC_ProxyConsumer.cpp
+++ b/TAO/orbsvcs/orbsvcs/Event/EC_ProxyConsumer.cpp
@@ -14,19 +14,19 @@ ACE_RCSID(Event, EC_ProxyConsumer, "$Id$")
TAO_EC_ProxyPushConsumer::
TAO_EC_ProxyPushConsumer (TAO_EC_Event_Channel* ec)
: event_channel_ (ec),
+ refcount_ (1),
filter_ (0)
{
-}
+ this->lock_ =
+ this->event_channel_->create_consumer_lock ();
-TAO_EC_ProxyPushConsumer::~TAO_EC_ProxyPushConsumer (void)
-{
+ this->default_POA_ =
+ this->event_channel_->consumer_poa ();
}
-void
-TAO_EC_ProxyPushConsumer::set_default_POA (PortableServer::POA_ptr poa)
+TAO_EC_ProxyPushConsumer::~TAO_EC_ProxyPushConsumer (void)
{
- this->default_POA_ =
- PortableServer::POA::_duplicate (poa);
+ this->event_channel_->destroy_consumer_lock (this->lock_);
}
PortableServer::POA_ptr
@@ -63,22 +63,51 @@ TAO_EC_ProxyPushConsumer::disconnected (TAO_EC_ProxyPushConsumer*,
{
}
+CORBA::ULong
+TAO_EC_ProxyPushConsumer::_incr_refcnt (void)
+{
+ ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->lock_, 0);
+ return this->refcount_++;
+}
+
+CORBA::ULong
+TAO_EC_ProxyPushConsumer::_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_consumer (this);
+ return 0;
+}
+
void
TAO_EC_ProxyPushConsumer::connect_push_supplier (
RtecEventComm::PushSupplier_ptr push_supplier,
const RtecEventChannelAdmin::SupplierQOS& qos,
CORBA::Environment &ACE_TRY_ENV)
{
- if (this->is_connected ())
- ACE_THROW (RtecEventChannelAdmin::AlreadyConnected ());
+ {
+ ACE_GUARD_THROW_EX (
+ ACE_Lock, ace_mon, *this->lock_,
+ RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR ());
+ ACE_CHECK;
- this->supplier_ =
- RtecEventComm::PushSupplier::_duplicate (push_supplier);
- this->qos_ = qos;
+ if (this->is_connected_i ())
+ ACE_THROW (RtecEventChannelAdmin::AlreadyConnected ());
- this->filter_ =
- this->event_channel_->supplier_filter_builder ()->create (this->qos_);
- this->filter_->bind (this);
+ this->supplier_ =
+ RtecEventComm::PushSupplier::_duplicate (push_supplier);
+ this->qos_ = qos;
+
+ this->filter_ =
+ this->event_channel_->supplier_filter_builder ()->create (this->qos_);
+ this->filter_->bind (this);
+ }
// Notify the event channel...
this->event_channel_->connected (this, ACE_TRY_ENV);
@@ -91,6 +120,8 @@ TAO_EC_ProxyPushConsumer::push (const RtecEventComm::EventSet& event,
if (this->is_connected () == 0)
return; // @@ THROW something???
+ // No need to keep the lock, the filter_ class is supposed to be
+ // thread safe....
this->filter_->push (event, ACE_TRY_ENV);
}
@@ -98,8 +129,22 @@ void
TAO_EC_ProxyPushConsumer::disconnect_push_consumer (
CORBA::Environment &ACE_TRY_ENV)
{
- this->supplier_ =
- RtecEventComm::PushSupplier::_nil ();
+ {
+ ACE_GUARD_THROW_EX (
+ ACE_Lock, ace_mon, *this->lock_,
+ RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR ());
+ ACE_CHECK;
+
+ if (this->is_connected_i () == 0)
+ ACE_THROW (CORBA::BAD_INV_ORDER ());
+
+ this->supplier_ =
+ RtecEventComm::PushSupplier::_nil ();
+
+ this->filter_->unbind (this);
+ this->event_channel_->supplier_filter_builder ()->destroy (this->filter_);
+ this->filter_ = 0;
+ }
PortableServer::POA_var poa =
this->_default_POA (ACE_TRY_ENV);
@@ -110,12 +155,21 @@ TAO_EC_ProxyPushConsumer::disconnect_push_consumer (
poa->deactivate_object (id.in (), ACE_TRY_ENV);
ACE_CHECK;
- this->filter_->unbind (this);
- this->event_channel_->supplier_filter_builder ()->destroy (this->filter_);
- this->filter_ = 0;
-
// Notify the event channel...
this->event_channel_->disconnected (this, ACE_TRY_ENV);
- this->event_channel_->destroy_proxy_push_consumer (this);
+ this->_decr_refcnt ();
}
+
+void
+TAO_EC_ProxyPushConsumer::_add_ref (CORBA::Environment &)
+{
+ this->_incr_refcnt ();
+}
+
+void
+TAO_EC_ProxyPushConsumer::_remove_ref (CORBA::Environment &)
+{
+ this->_decr_refcnt ();
+}
+
diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_ProxyConsumer.h b/TAO/orbsvcs/orbsvcs/Event/EC_ProxyConsumer.h
index 890abbfd242..1659522d65a 100644
--- a/TAO/orbsvcs/orbsvcs/Event/EC_ProxyConsumer.h
+++ b/TAO/orbsvcs/orbsvcs/Event/EC_ProxyConsumer.h
@@ -90,12 +90,13 @@ public:
// Usually implemented as no-ops, but some configurations may
// require this methods.
- void set_default_POA (PortableServer::POA_ptr poa);
- // Set this servant's default POA
-
virtual PortableServer::POA_ptr _default_POA (CORBA::Environment& env);
// Override the ServantBase method.
+ CORBA::ULong _incr_refcnt (void);
+ CORBA::ULong _decr_refcnt (void);
+ // Increment and decrement the reference count.
+
// = The RtecEventChannelAdmin::ProxyPushConsumer methods...
virtual void connect_push_supplier (
RtecEventComm::PushSupplier_ptr push_supplier,
@@ -105,12 +106,25 @@ public:
CORBA::Environment &);
virtual void disconnect_push_consumer (CORBA::Environment &);
+ // = Servant reference counting methods.
+ virtual void _add_ref (CORBA_Environment &ACE_TRY_ENV =
+ CORBA::default_environment ());
+ virtual void _remove_ref (CORBA_Environment &ACE_TRY_ENV =
+ CORBA::default_environment ());
+
+private:
+ CORBA::Boolean is_connected_i (void) const;
+ // The private version (without locking) of is_connected().
+
private:
TAO_EC_Event_Channel* event_channel_;
// The supplier admin, used for activation and memory managment.
- TAO_EC_SupplierFiltering* filter_;
- // The strategy to do filtering close to the supplier
+ ACE_Lock* lock_;
+ // The locking strategy.
+
+ CORBA::ULong refcount_;
+ // The reference count.
RtecEventComm::PushSupplier_var supplier_;
// The supplier....
@@ -120,6 +134,9 @@ private:
PortableServer::POA_var default_POA_;
// Store the default POA.
+
+ TAO_EC_SupplierFiltering* filter_;
+ // The strategy to do filtering close to the supplier
};
#if defined (__ACE_INLINE__)
diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_ProxyConsumer.i b/TAO/orbsvcs/orbsvcs/Event/EC_ProxyConsumer.i
index c692963193e..0ca9186a78d 100644
--- a/TAO/orbsvcs/orbsvcs/Event/EC_ProxyConsumer.i
+++ b/TAO/orbsvcs/orbsvcs/Event/EC_ProxyConsumer.i
@@ -1,19 +1,32 @@
// $Id$
ACE_INLINE CORBA::Boolean
-TAO_EC_ProxyPushConsumer::is_connected (void) const
+TAO_EC_ProxyPushConsumer::is_connected_i (void) const
{
return !CORBA::is_nil (this->supplier_.in ());
}
+ACE_INLINE CORBA::Boolean
+TAO_EC_ProxyPushConsumer::is_connected (void) const
+{
+ ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->lock_, 0);
+
+ return this->is_connected_i ();
+}
+
ACE_INLINE RtecEventComm::PushSupplier_ptr
TAO_EC_ProxyPushConsumer::supplier (void) const
{
+ ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->lock_, 0);
return RtecEventComm::PushSupplier::_duplicate (this->supplier_.in ());
}
ACE_INLINE const RtecEventChannelAdmin::SupplierQOS&
TAO_EC_ProxyPushConsumer::publications (void) const
{
+ // @@ TODO There should be a better way to signal errors here.
+ static RtecEventChannelAdmin::SupplierQOS empty_qos;
+ ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->lock_, empty_qos);
+
return this->qos_;
}
diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_ProxySupplier.cpp b/TAO/orbsvcs/orbsvcs/Event/EC_ProxySupplier.cpp
index e45d6b291c0..49d98e4d517 100644
--- a/TAO/orbsvcs/orbsvcs/Event/EC_ProxySupplier.cpp
+++ b/TAO/orbsvcs/orbsvcs/Event/EC_ProxySupplier.cpp
@@ -21,12 +21,13 @@ TAO_EC_ProxyPushSupplier::TAO_EC_ProxyPushSupplier (TAO_EC_Event_Channel* ec)
{
this->lock_ =
this->event_channel_->create_supplier_lock ();
+
+ this->default_POA_ =
+ this->event_channel_->supplier_poa ();
}
TAO_EC_ProxyPushSupplier::~TAO_EC_ProxyPushSupplier (void)
{
- delete this->child_;
- this->child_ = 0;
this->event_channel_->destroy_supplier_lock (this->lock_);
}
@@ -52,25 +53,10 @@ TAO_EC_ProxyPushSupplier::_decr_refcnt (void)
return 0;
}
-void
-TAO_EC_ProxyPushSupplier::set_default_POA (PortableServer::POA_ptr poa)
-{
- ACE_GUARD (ACE_Lock, ace_mon, *this->lock_);
- this->default_POA_ = PortableServer::POA::_duplicate (poa);
-}
-
-PortableServer::POA_ptr
-TAO_EC_ProxyPushSupplier::_default_POA_i ()
-{
- return PortableServer::POA::_duplicate (this->default_POA_.in ());
-}
-
PortableServer::POA_ptr
TAO_EC_ProxyPushSupplier::_default_POA (CORBA::Environment&)
{
- ACE_GUARD_RETURN (ACE_Lock, ace_mon, *this->lock_,
- PortableServer::POA::_nil ());
- return this->_default_POA_i ();
+ return PortableServer::POA::_duplicate (this->default_POA_.in ());
}
void
@@ -136,19 +122,26 @@ TAO_EC_ProxyPushSupplier::disconnect_push_supplier (
RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR ());
ACE_CHECK;
+ if (this->is_connected_i () == 0)
+ ACE_THROW (CORBA::BAD_INV_ORDER ());
+
this->consumer_ =
RtecEventComm::PushConsumer::_nil ();
- PortableServer::POA_var poa =
- this->_default_POA_i ();
-
- PortableServer::ObjectId_var id =
- poa->servant_to_id (this, ACE_TRY_ENV);
- ACE_CHECK;
- poa->deactivate_object (id.in (), ACE_TRY_ENV);
- ACE_CHECK;
+ // @@ Why don't we have a destroy() method in the filter_builder?
+ delete this->child_;
+ this->child_ = 0;
}
+ 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;
+
// Notify the event channel...
this->event_channel_->disconnected (this, ACE_TRY_ENV);
@@ -239,7 +232,7 @@ TAO_EC_ProxyPushSupplier::push_to_consumer (const RtecEventComm::EventSet& event
ACE_CHECK;
if (this->is_connected_i () == 0)
- return; // TAO_THROW (RtecEventComm::Disconnected ());????
+ return; // ACE_THROW (RtecEventComm::Disconnected ());????
if (this->suspended_ != 0)
return;
@@ -314,6 +307,18 @@ TAO_EC_ProxyPushSupplier::can_match (
return this->child_->can_match (header);
}
+void
+TAO_EC_ProxyPushSupplier::_add_ref (CORBA::Environment &)
+{
+ this->_incr_refcnt ();
+}
+
+void
+TAO_EC_ProxyPushSupplier::_remove_ref (CORBA::Environment &)
+{
+ this->_decr_refcnt ();
+}
+
#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
template class ACE_Reverse_Lock<ACE_Lock>;
diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_ProxySupplier.h b/TAO/orbsvcs/orbsvcs/Event/EC_ProxySupplier.h
index 94ae013ac54..0cbae27494f 100644
--- a/TAO/orbsvcs/orbsvcs/Event/EC_ProxySupplier.h
+++ b/TAO/orbsvcs/orbsvcs/Event/EC_ProxySupplier.h
@@ -96,9 +96,6 @@ public:
// Usually implemented as no-ops, but some configurations may
// require this methods.
- void set_default_POA (PortableServer::POA_ptr poa);
- // Set this servant's default POA
-
virtual PortableServer::POA_ptr _default_POA (CORBA::Environment& env);
// Override the ServantBase method.
@@ -124,13 +121,9 @@ public:
virtual void suspend_connection (CORBA::Environment &);
virtual void resume_connection (CORBA::Environment &);
- virtual CORBA::ULong _incr_refcnt (void);
- virtual CORBA::ULong _decr_refcnt (void);
+ CORBA::ULong _incr_refcnt (void);
+ CORBA::ULong _decr_refcnt (void);
// Increment and decrement the reference count.
- // @@ TODO We use the canonical tao form, but in the future we may
- // want to add methods that follow the upcoming CORBA2.3
- // specification, which will include reference counting for
- // servants.
// = The TAO_EC_Filter methods, only push() is implemented...
virtual int filter (const RtecEventComm::EventSet& event,
@@ -149,13 +142,16 @@ public:
virtual CORBA::ULong max_event_size (void) const;
virtual int can_match (const RtecEventComm::EventHeader &header) const;
+ // = Servant reference counting methods.
+ virtual void _add_ref (CORBA_Environment &ACE_TRY_ENV =
+ CORBA::default_environment ());
+ virtual void _remove_ref (CORBA_Environment &ACE_TRY_ENV =
+ CORBA::default_environment ());
+
private:
CORBA::Boolean is_connected_i (void) const;
// The private version (without locking) of is_connected().
- PortableServer::POA_ptr _default_POA_i ();
- // The private version (without locking) of _default_POA_i ().
-
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 1325a900c63..6f7ed8f6069 100644
--- a/TAO/orbsvcs/orbsvcs/Event/EC_SupplierAdmin.cpp
+++ b/TAO/orbsvcs/orbsvcs/Event/EC_SupplierAdmin.cpp
@@ -14,19 +14,14 @@ ACE_RCSID(Event, EC_SupplierAdmin, "$Id$")
TAO_EC_SupplierAdmin::TAO_EC_SupplierAdmin (TAO_EC_Event_Channel *ec)
: event_channel_ (ec)
{
+ this->default_POA_ =
+ this->event_channel_->supplier_poa ();
}
TAO_EC_SupplierAdmin::~TAO_EC_SupplierAdmin (void)
{
}
-void
-TAO_EC_SupplierAdmin::set_default_POA (PortableServer::POA_ptr poa)
-{
- this->default_POA_ =
- PortableServer::POA::_duplicate (poa);
-}
-
PortableServer::POA_ptr
TAO_EC_SupplierAdmin::_default_POA (CORBA::Environment&)
{
@@ -87,10 +82,6 @@ TAO_EC_SupplierAdmin::obtain_push_consumer (CORBA::Environment &ACE_TRY_ENV)
TAO_EC_ProxyPushConsumer* consumer =
this->event_channel_->create_proxy_push_consumer ();
- PortableServer::POA_var poa =
- this->event_channel_->consumer_poa (ACE_TRY_ENV);
- consumer->set_default_POA (poa.in ());
-
return consumer->_this (ACE_TRY_ENV);
}
diff --git a/TAO/orbsvcs/orbsvcs/Event/EC_SupplierAdmin.h b/TAO/orbsvcs/orbsvcs/Event/EC_SupplierAdmin.h
index 7394c2326e6..26499991a76 100644
--- a/TAO/orbsvcs/orbsvcs/Event/EC_SupplierAdmin.h
+++ b/TAO/orbsvcs/orbsvcs/Event/EC_SupplierAdmin.h
@@ -63,9 +63,6 @@ public:
virtual ~TAO_EC_SupplierAdmin (void);
// destructor...
- void set_default_POA (PortableServer::POA_ptr poa);
- // Set this servant's default POA
-
virtual PortableServer::POA_ptr _default_POA (CORBA::Environment& env);
// Override the ServantBase method.
diff --git a/TAO/orbsvcs/orbsvcs/Event/Event_Channel.cpp b/TAO/orbsvcs/orbsvcs/Event/Event_Channel.cpp
index a48d66aa66a..c32a9280a30 100644
--- a/TAO/orbsvcs/orbsvcs/Event/Event_Channel.cpp
+++ b/TAO/orbsvcs/orbsvcs/Event/Event_Channel.cpp
@@ -1150,8 +1150,9 @@ ACE_ES_Consumer_Module::shutdown_request (ACE_ES_Dispatch_Request *request)
poa->deactivate_object (id.in (), TAO_TRY_ENV);
TAO_CHECK_ENV;
- // Delete the consumer proxy.
- delete sc->consumer ();
+ // Delete the consumer proxy, no need to delete it, is is owned
+ // by the POA
+ // delete sc->consumer ();
if (!dont_update)
this->channel_->update_consumer_gwys (TAO_TRY_ENV);
@@ -1229,7 +1230,8 @@ ACE_ES_Consumer_Module::shutdown (void)
ACE_ERROR ((LM_ERROR, "%p Failed to remove consumer.\n", "ACE_ES_Consumer_Module::shutdown"));
}
- delete *proxy;
+ // No need to delete it, owned by the POA
+ // delete *proxy;
}
}
@@ -1323,8 +1325,11 @@ ACE_ES_Consumer_Module::push (const ACE_ES_Dispatch_Request *request,
}
RtecEventChannelAdmin::ProxyPushSupplier_ptr
-ACE_ES_Consumer_Module::obtain_push_supplier (CORBA::Environment &TAO_IN_ENV)
+ACE_ES_Consumer_Module::obtain_push_supplier (CORBA::Environment &ACE_TRY_ENV)
{
+ RtecEventChannelAdmin::ProxyPushSupplier_ptr proxy =
+ RtecEventChannelAdmin::ProxyPushSupplier::_nil ();
+
auto_ptr<ACE_Push_Consumer_Proxy> new_consumer (new ACE_Push_Consumer_Proxy (this));
// Get a new supplier proxy object.
@@ -1332,20 +1337,25 @@ ACE_ES_Consumer_Module::obtain_push_supplier (CORBA::Environment &TAO_IN_ENV)
{
ACE_ERROR ((LM_ERROR, "ACE_EventChannel"
"::obtain_push_supplier failed.\n"));
- TAO_THROW_RETURN (CORBA::NO_MEMORY (), 0);
+ TAO_THROW_RETURN (CORBA::NO_MEMORY (), proxy);
}
{
- TAO_GUARD_THROW_RETURN (ACE_ES_MUTEX, ace_mon, this->lock_, 0, TAO_IN_ENV,
- RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR());
+ ACE_GUARD_THROW_EX (ACE_ES_MUTEX, ace_mon, this->lock_,
+ RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR());
+ ACE_CHECK_RETURN (proxy);
if (all_consumers_.insert (new_consumer.get ()) == -1)
ACE_ERROR ((LM_ERROR, "ACE_ES_Consumer_Module insert failed.\n"));
}
- // Return the CORBA object reference to the new supplier proxy,
- // there is no need to hold a pointer, it is now help in the map...
- return new_consumer.release ()->get_ref (TAO_IN_ENV);
+ proxy = new_consumer->_this (ACE_TRY_ENV);
+ TAO_CHECK_RETURN (proxy);
+
+ // Give away ownership to the POA....
+ new_consumer.release ()->_remove_ref ();
+
+ return proxy;
}
void
@@ -3194,22 +3204,32 @@ ACE_ES_Supplier_Module::shutdown (void)
}
RtecEventChannelAdmin::ProxyPushConsumer_ptr
-ACE_ES_Supplier_Module::obtain_push_consumer (CORBA::Environment &TAO_IN_ENV)
+ACE_ES_Supplier_Module::obtain_push_consumer (CORBA::Environment &ACE_TRY_ENV)
{
+ RtecEventChannelAdmin::ProxyPushConsumer_ptr proxy =
+ RtecEventChannelAdmin::ProxyPushConsumer::_nil ();
+
auto_ptr<ACE_Push_Supplier_Proxy> new_supplier (new ACE_Push_Supplier_Proxy (this));
if (new_supplier.get () == 0)
- TAO_THROW_RETURN (CORBA::NO_MEMORY (), 0);
+ ACE_THROW_RETURN (CORBA::NO_MEMORY (), proxy);
{
- TAO_GUARD_THROW_RETURN (ACE_ES_MUTEX, ace_mon, this->lock_, 0, TAO_IN_ENV,
- RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR());
+ ACE_GUARD_THROW_EX (ACE_ES_MUTEX, ace_mon, this->lock_,
+ RtecEventChannelAdmin::EventChannel::SYNCHRONIZATION_ERROR());
+ ACE_CHECK_RETURN (proxy);
if (all_suppliers_.insert (new_supplier.get ()) == -1)
ACE_ERROR ((LM_ERROR, "ACE_ES_Supplier_Module insert failed.\n"));
}
- return new_supplier.release ()->get_ref (TAO_IN_ENV);
+ proxy = new_supplier->_this (ACE_TRY_ENV);
+ ACE_CHECK_RETURN (proxy);
+
+ // Give ownership to the POA
+ new_supplier.release ()->_remove_ref ();
+
+ return proxy;
}
void
diff --git a/TAO/orbsvcs/orbsvcs/Event/Event_Channel.h b/TAO/orbsvcs/orbsvcs/Event/Event_Channel.h
index 7859e667756..7a45d3c4d33 100644
--- a/TAO/orbsvcs/orbsvcs/Event/Event_Channel.h
+++ b/TAO/orbsvcs/orbsvcs/Event/Event_Channel.h
@@ -1244,7 +1244,8 @@ class ACE_EventChannel;
// = Event Channel interfaces.
-class TAO_ORBSVCS_Export ACE_Push_Supplier_Proxy : public POA_RtecEventChannelAdmin::ProxyPushConsumer
+class TAO_ORBSVCS_Export ACE_Push_Supplier_Proxy : public POA_RtecEventChannelAdmin::ProxyPushConsumer, public PortableServer::RefCountServantBase
+//
// = TITLE
// Push Supplier Proxy.
//
@@ -1278,9 +1279,6 @@ public:
// = Operations for the Event Channel.
- RtecEventChannelAdmin::ProxyPushConsumer_ptr get_ref (CORBA::Environment &);
- // Allow transformations to RtecEventChannelAdmin::ProxyPushConsumer.
-
int connected (void);
// Returns 1 if the proxy has been connected to a "remote" client.
@@ -1323,7 +1321,8 @@ private:
// ************************************************************
-class TAO_ORBSVCS_Export ACE_Push_Consumer_Proxy : public POA_RtecEventChannelAdmin::ProxyPushSupplier
+class TAO_ORBSVCS_Export ACE_Push_Consumer_Proxy : public POA_RtecEventChannelAdmin::ProxyPushSupplier, public PortableServer::RefCountServantBase
+//
// = TITLE
// Push Consumer Proxy.
//
@@ -1369,9 +1368,6 @@ public:
void shutdown (void);
// Actively disconnect from the consumer.
- RtecEventChannelAdmin::ProxyPushSupplier_ptr get_ref (CORBA::Environment &);
- // Allow transformations to RtecEventChannelAdmin::ProxyPushSupplier.
-
ACE_ES_Consumer_Correlation &correlation (void);
// Access the consumer-specific Consumer_Correlation.
diff --git a/TAO/orbsvcs/orbsvcs/Event/Event_Channel.i b/TAO/orbsvcs/orbsvcs/Event/Event_Channel.i
index 2a597943068..95618c081de 100644
--- a/TAO/orbsvcs/orbsvcs/Event/Event_Channel.i
+++ b/TAO/orbsvcs/orbsvcs/Event/Event_Channel.i
@@ -11,12 +11,6 @@ const unsigned int ACE_INT2BIT[32] =
// **************************************************
-ACE_INLINE RtecEventChannelAdmin::ProxyPushConsumer_ptr
-ACE_Push_Supplier_Proxy::get_ref (CORBA::Environment &env)
-{
- return this->_this (env);
-}
-
ACE_INLINE int
ACE_Push_Supplier_Proxy::connected (void)
{
@@ -56,12 +50,6 @@ ACE_Push_Supplier_Proxy::qos (void) const
// **************************************************
-ACE_INLINE RtecEventChannelAdmin::ProxyPushSupplier_ptr
-ACE_Push_Consumer_Proxy::get_ref (CORBA::Environment &env)
-{
- return this->_this (env);
-}
-
ACE_INLINE RtecEventChannelAdmin::ConsumerQOS &
ACE_Push_Consumer_Proxy::qos (void)
{