diff options
author | irfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2001-03-12 17:34:12 +0000 |
---|---|---|
committer | irfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2001-03-12 17:34:12 +0000 |
commit | c983195b6859d3fa3e8e6add30d3f7633f3fa2f6 (patch) | |
tree | 4da22608966793b7ca2a401d9b1c702b97e9b03e | |
parent | 17a7661ffce4e1b354b2b41b074d48fa67fbd940 (diff) | |
download | ATCD-c983195b6859d3fa3e8e6add30d3f7633f3fa2f6.tar.gz |
ChangeLogTag: Mon Mar 12 01:01:57 2001 Irfan Pyarali <irfan@cs.wustl.edu>
-rw-r--r-- | TAO/orbsvcs/orbsvcs/AV/AVStreams_i.cpp | 59 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/AV/AVStreams_i.h | 3 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/AV/AV_Core.cpp | 48 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/AV/AV_Core.h | 5 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/AV/Flows_T.cpp | 8 |
5 files changed, 62 insertions, 61 deletions
diff --git a/TAO/orbsvcs/orbsvcs/AV/AVStreams_i.cpp b/TAO/orbsvcs/orbsvcs/AV/AVStreams_i.cpp index 2836455f5c7..15a477bae50 100644 --- a/TAO/orbsvcs/orbsvcs/AV/AVStreams_i.cpp +++ b/TAO/orbsvcs/orbsvcs/AV/AVStreams_i.cpp @@ -21,51 +21,6 @@ ACE_RCSID(AV, AVStreams_i, "$Id$") -int -deactivate_servant (PortableServer::Servant servant) -{ - - // Because of reference counting, the POA will automatically delete - // the servant when all pending requests on this servant are - // complete. - - ACE_DECLARE_NEW_CORBA_ENV; - ACE_TRY - { - PortableServer::POA_var poa = servant->_default_POA (ACE_TRY_ENV); - ACE_TRY_CHECK; - - PortableServer::ObjectId_var id = poa->servant_to_id (servant, - ACE_TRY_ENV); - ACE_TRY_CHECK; - - poa->deactivate_object (id.in (), - ACE_TRY_ENV); - ACE_TRY_CHECK; - } - ACE_CATCHANY - { - ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "deactivate_servant"); - return -1; - } - ACE_ENDTRY; - ACE_CHECK_RETURN (-1); - return 0; -} - -char * -get_flowname (const char *flow_spec_entry_str) -{ - ACE_CString flow_spec_entry (flow_spec_entry_str); - int slash_pos = flow_spec_entry.find ('\\'); - ACE_CString flow_name; - if (slash_pos != flow_spec_entry.npos) - flow_name = flow_spec_entry.substring (0, slash_pos); - else - flow_name = flow_spec_entry_str; - return CORBA::string_dup (flow_name.c_str ()); -} - #if !defined (__ACE_INLINE__) #include "AVStreams_i.i" #endif /* __ACE_INLINE__ */ @@ -173,7 +128,7 @@ TAO_Basic_StreamCtrl::stop (const AVStreams::flowSpec &flow_spec, if (flow_spec.length () > 0) for (u_int i=0;i<flow_spec.length ();i++) { - char *flowname = get_flowname (flow_spec[i]); + char *flowname = TAO_AV_Core::get_flowname (flow_spec[i]); TAO_String_Hash_Key flow_name_key (flowname); FlowConnection_Map::ENTRY *flow_connection_entry = 0; if (this->flow_connection_map_.find (flow_name_key, @@ -223,7 +178,7 @@ TAO_Basic_StreamCtrl::start (const AVStreams::flowSpec &flow_spec, if (flow_spec.length () > 0) for (u_int i = 0; i < flow_spec.length (); i++) { - char *flowname = get_flowname (flow_spec[i]); + char *flowname = TAO_AV_Core::get_flowname (flow_spec[i]); TAO_String_Hash_Key flow_name_key (flowname); FlowConnection_Map::ENTRY *flow_connection_entry = 0; if (this->flow_connection_map_.find (flow_name_key, @@ -273,7 +228,7 @@ TAO_Basic_StreamCtrl::destroy (const AVStreams::flowSpec &flow_spec, if (flow_spec.length () > 0) for (u_int i=0;i<flow_spec.length ();i++) { - char *flowname = get_flowname (flow_spec[i]); + char *flowname = TAO_AV_Core::get_flowname (flow_spec[i]); TAO_String_Hash_Key flow_name_key (flowname); FlowConnection_Map::ENTRY *flow_connection_entry = 0; if (this->flow_connection_map_.find (flow_name_key, flow_connection_entry) == 0) @@ -1943,7 +1898,7 @@ TAO_StreamEndPoint::destroy (const AVStreams::flowSpec &flow_spec, ACE_THROW_SPEC ((CORBA::SystemException, AVStreams::noSuchFlow)) { - int result = deactivate_servant (this); + int result = TAO_AV_Core::deactivate_servant (this); if (result < 0) if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "TAO_StreamEndPoint::destroy failed\n")); @@ -3298,7 +3253,7 @@ TAO_MMDevice::destroy (AVStreams::StreamEndPoint_ptr /* the_ep */, // Remove self from POA. Because of reference counting, the POA // will automatically delete the servant when all pending requests // on this servant are complete. - int result = deactivate_servant (this); + int result = TAO_AV_Core::deactivate_servant (this); if (result < 0) if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "TAO_MMDevice::destroy failed\n")); } @@ -3607,7 +3562,7 @@ TAO_FlowConnection::destroy (CORBA::Environment &ACE_TRY_ENV) } ACE_ENDTRY; ACE_CHECK; - int result = deactivate_servant (this); + int result = TAO_AV_Core::deactivate_servant (this); if (result < 0) if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "TAO_FlowConnection::destroy failed\n")); } @@ -4121,7 +4076,7 @@ void TAO_FlowEndPoint::destroy (CORBA::Environment &/*ACE_TRY_ENV*/) ACE_THROW_SPEC ((CORBA::SystemException)) { - int result = deactivate_servant (this); + int result = TAO_AV_Core::deactivate_servant (this); if (result < 0) if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG, "TAO_StreamEndPoint::destroy failed\n")); TAO_AV_FlowSpecSetItor end = this->flow_spec_set_.end (); diff --git a/TAO/orbsvcs/orbsvcs/AV/AVStreams_i.h b/TAO/orbsvcs/orbsvcs/AV/AVStreams_i.h index 05b61228495..891872b37b5 100644 --- a/TAO/orbsvcs/orbsvcs/AV/AVStreams_i.h +++ b/TAO/orbsvcs/orbsvcs/AV/AVStreams_i.h @@ -109,9 +109,6 @@ typedef ACE_Hash_Map_Iterator <TAO_String_Hash_Key,AVStreams::FlowEndPoint_ptr,A #include "AV_Core.h" -int deactivate_servant (PortableServer::Servant servant); -char *get_flowname (const char *flow_spec_entry_str); - class TAO_AV_Export AV_Null_MediaCtrl : public virtual POA_Null_MediaCtrl, public virtual PortableServer::RefCountServantBase diff --git a/TAO/orbsvcs/orbsvcs/AV/AV_Core.cpp b/TAO/orbsvcs/orbsvcs/AV/AV_Core.cpp index e736a6d3b93..d47be246a79 100644 --- a/TAO/orbsvcs/orbsvcs/AV/AV_Core.cpp +++ b/TAO/orbsvcs/orbsvcs/AV/AV_Core.cpp @@ -414,7 +414,7 @@ TAO_AV_Core::init_reverse_flows (TAO_Base_StreamEndPoint *endpoint, } default: break; } - + if (address != 0) { if (this->get_acceptor (entry->flowname ())!= 0) @@ -706,6 +706,52 @@ TAO_AV_Core::init_flow_protocol_factories (void) return 0; } +/* static */ +int +TAO_AV_Core::deactivate_servant (PortableServer::Servant servant) +{ + // Because of reference counting, the POA will automatically delete + // the servant when all pending requests on this servant are + // complete. + + ACE_DECLARE_NEW_CORBA_ENV; + ACE_TRY + { + PortableServer::POA_var poa = servant->_default_POA (ACE_TRY_ENV); + ACE_TRY_CHECK; + + PortableServer::ObjectId_var id = poa->servant_to_id (servant, + ACE_TRY_ENV); + ACE_TRY_CHECK; + + poa->deactivate_object (id.in (), + ACE_TRY_ENV); + ACE_TRY_CHECK; + } + ACE_CATCHANY + { + ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "deactivate_servant"); + return -1; + } + ACE_ENDTRY; + ACE_CHECK_RETURN (-1); + return 0; +} + +/* static */ +char * +TAO_AV_Core::get_flowname (const char *flow_spec_entry_str) +{ + ACE_CString flow_spec_entry (flow_spec_entry_str); + int slash_pos = flow_spec_entry.find ('\\'); + ACE_CString flow_name; + if (slash_pos != flow_spec_entry.npos) + flow_name = flow_spec_entry.substring (0, slash_pos); + else + flow_name = flow_spec_entry_str; + return CORBA::string_dup (flow_name.c_str ()); +} + #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) template class ACE_Singleton<TAO_AV_Core,ACE_Null_Mutex>; #elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA) diff --git a/TAO/orbsvcs/orbsvcs/AV/AV_Core.h b/TAO/orbsvcs/orbsvcs/AV/AV_Core.h index 4a16e6a2dcf..f9adf02c790 100644 --- a/TAO/orbsvcs/orbsvcs/AV/AV_Core.h +++ b/TAO/orbsvcs/orbsvcs/AV/AV_Core.h @@ -106,7 +106,10 @@ public: void orb (CORBA::ORB_ptr orb_); PortableServer::POA_ptr poa (void); void poa (PortableServer::POA_ptr poa_); - + + static int deactivate_servant (PortableServer::Servant servant); + static char *get_flowname (const char *flow_spec_entry_str); + protected: TAO_AV_Connector_Registry *connector_registry_; // The connector registry which all active connecters must register diff --git a/TAO/orbsvcs/orbsvcs/AV/Flows_T.cpp b/TAO/orbsvcs/orbsvcs/AV/Flows_T.cpp index 74575e33cc8..b4d9166e2b4 100644 --- a/TAO/orbsvcs/orbsvcs/AV/Flows_T.cpp +++ b/TAO/orbsvcs/orbsvcs/AV/Flows_T.cpp @@ -223,14 +223,14 @@ TAO_FDev<T_Producer, T_Consumer>::destroy (AVStreams::FlowEndPoint_ptr /* the_ep { // @@ Shouldn't the parameters be made use of! // Destroy/delete all the producers and consumers. - + TAO_FlowProducer *producer_i; for (PRODUCER_LIST_ITERATOR producer_list_iterator (this->producer_list_); (producer_i = producer_list_iterator.next ()) != 0; producer_list_iterator.advance ()) { - deactivate_servant (producer_i); + TAO_AV_Core::deactivate_servant (producer_i); delete producer_i; } @@ -240,10 +240,10 @@ TAO_FDev<T_Producer, T_Consumer>::destroy (AVStreams::FlowEndPoint_ptr /* the_ep (consumer_i = consumer_list_iterator.next ()) != 0; consumer_list_iterator.advance ()) { - deactivate_servant (consumer_i); + TAO_AV_Core::deactivate_servant (consumer_i); delete consumer_i; } - int result = deactivate_servant (this); + int result = TAO_AV_Core::deactivate_servant (this); if (result < 0) if (TAO_debug_level > 0) ACE_DEBUG ((LM_DEBUG,"TAO_StreamEndPoint::destroy failed\n")); } |