#include <PortableGroup_Acceptor_Registry.h>
Collaboration diagram for TAO_PortableGroup_Acceptor_Registry:
Public Types | |
typedef ACE_Unbounded_Queue< Entry > | Acceptor_Registry |
typedef ACE_Unbounded_Queue_Iterator< Entry > | Acceptor_Registry_Iterator |
Public Member Functions | |
TAO_PortableGroup_Acceptor_Registry (void) | |
Default constructor. | |
~TAO_PortableGroup_Acceptor_Registry (void) | |
Default destructor. | |
void | open (const TAO_Profile *profile, TAO_ORB_Core &orb_core) |
Open an acceptor based on a tagged profile. | |
int | close_all (void) |
Close all open acceptors. | |
Protected Member Functions | |
void | open_i (const TAO_Profile *profile, TAO_ORB_Core &orb_core, TAO_ProtocolFactorySetItor &factory) |
Helper function to open a group acceptor. | |
int | find (const TAO_Profile *profile, Entry *&entry) |
Find an acceptor by using a profile. | |
Private Member Functions | |
TAO_PortableGroup_Acceptor_Registry (const TAO_PortableGroup_Acceptor_Registry &) | |
void | operator= (const TAO_PortableGroup_Acceptor_Registry &) |
Private Attributes | |
Acceptor_Registry | registry_ |
List of acceptors that are currently open. |
There is one TAO_PortableGroup_Acceptor_Registry per ORB_Core.
Definition at line 49 of file PortableGroup_Acceptor_Registry.h.
|
Definition at line 84 of file PortableGroup_Acceptor_Registry.h. |
|
Definition at line 85 of file PortableGroup_Acceptor_Registry.h. Referenced by find(), and ~TAO_PortableGroup_Acceptor_Registry(). |
|
Default constructor.
Definition at line 20 of file PortableGroup_Acceptor_Registry.cpp.
00021 { 00022 } |
|
Default destructor.
Definition at line 24 of file PortableGroup_Acceptor_Registry.cpp. References TAO_PortableGroup_Acceptor_Registry::Entry::acceptor, Acceptor_Registry_Iterator, ACE_Unbounded_Queue_Iterator< Entry >::advance(), TAO_PortableGroup_Acceptor_Registry::Entry::endpoint, and ACE_Unbounded_Queue_Iterator< Entry >::next().
00025 { 00026 // Free the memory for the endpoints. 00027 Entry *entry; 00028 Acceptor_Registry_Iterator iter (this->registry_); 00029 00030 while (iter.next (entry)) 00031 { 00032 delete entry->endpoint; 00033 delete entry->acceptor; 00034 iter.advance (); 00035 } 00036 } |
|
|
|
Close all open acceptors.
|
|
Find an acceptor by using a profile.
Definition at line 168 of file PortableGroup_Acceptor_Registry.cpp. References Acceptor_Registry_Iterator, ACE_Unbounded_Queue_Iterator< Entry >::advance(), TAO_Profile::endpoint(), TAO_PortableGroup_Acceptor_Registry::Entry::endpoint, TAO_Endpoint::is_equivalent(), and ACE_Unbounded_Queue_Iterator< Entry >::next(). Referenced by open().
00170 { 00171 Acceptor_Registry_Iterator iter (this->registry_); 00172 00173 while (iter.next (entry)) 00174 { 00175 // Since the endpoint routine is nonconst, need to 00176 // cast away the constness even though we're not 00177 // changing anything. 00178 TAO_Profile *nc_profile = const_cast<TAO_Profile *> (profile); 00179 if (entry->endpoint->is_equivalent (nc_profile->endpoint ())) 00180 return 1; 00181 00182 iter.advance (); 00183 } 00184 00185 return 0; 00186 } |
|
Open an acceptor based on a tagged profile.
Definition at line 40 of file PortableGroup_Acceptor_Registry.cpp. References TAO_PortableGroup_Acceptor_Registry::Entry::cnt, find(), open_i(), TAO_ORB_Core::protocol_factories(), TAO_Profile::tag(), and TAO_ProtocolFactorySetItor. Referenced by TAO_GOA::create_group_acceptors().
00042 { 00043 Entry *entry; 00044 00045 if (this->find (profile, entry) == 1) 00046 { 00047 // Found it. Increment the reference count. 00048 ++entry->cnt; 00049 } 00050 else 00051 { 00052 // Not found. Open a new acceptor. 00053 00054 // Now get the list of available protocol factories. 00055 TAO_ProtocolFactorySetItor end = 00056 orb_core.protocol_factories ()->end (); 00057 00058 // int found = 0; 00059 // If usable protocol (factory) is found then this will be 00060 // set equal to 1. 00061 00062 for (TAO_ProtocolFactorySetItor factory = 00063 orb_core.protocol_factories ()->begin (); 00064 factory != end; 00065 ++factory) 00066 { 00067 if ((*factory)->factory ()->tag () == profile->tag ()) 00068 { 00069 this->open_i (profile, 00070 orb_core, 00071 factory); 00072 00073 // found = 1; // A usable protocol was found. 00074 } 00075 else 00076 continue; 00077 } 00078 } 00079 } |
|
Helper function to open a group acceptor.
Definition at line 84 of file PortableGroup_Acceptor_Registry.cpp. References TAO_PortableGroup_Acceptor_Registry::Entry::acceptor, ACE_ERROR, ACE_TEXT(), TAO_Endpoint::addr_to_string(), TAO_PortableGroup_Acceptor_Registry::Entry::cnt, TAO_Endpoint::duplicate(), TAO_PortableGroup_Acceptor_Registry::Entry::endpoint, TAO_Profile::endpoint(), ACE_Unbounded_Queue< T >::enqueue_tail(), TAO_ORB_Core::lane_resources(), TAO_Thread_Lane_Resources::leader_follower(), LM_ERROR, TAO_GIOP_Message_Version::major, MAX_ADDR_LENGTH, TAO_GIOP_Message_Version::minor, TAO_Acceptor::open(), TAO_Leader_Follower::reactor(), TAO_ACCEPTOR_REGISTRY_OPEN_LOCATION_CODE, TAO_debug_level, and TAO_Profile::version(). Referenced by open().
00087 { 00088 TAO_Acceptor *acceptor = (*factory)->factory ()->make_acceptor (); 00089 00090 if (acceptor != 0) 00091 { 00092 // Extract the desired endpoint/protocol version if one 00093 // exists. 00094 const TAO_GIOP_Message_Version &version = profile->version (); 00095 char buffer [MAX_ADDR_LENGTH]; 00096 00097 // Removed the constness of profile. We're not changing 00098 // anything, but need to call a nonconst function. 00099 TAO_Profile* nc_profile = const_cast<TAO_Profile *> (profile); 00100 nc_profile->endpoint ()->addr_to_string (buffer, MAX_ADDR_LENGTH); 00101 00102 if (acceptor->open (&orb_core, 00103 orb_core.lane_resources ().leader_follower ().reactor(), 00104 version.major, 00105 version.minor, 00106 buffer, 00107 0) == -1) 00108 { 00109 delete acceptor; 00110 00111 if (TAO_debug_level > 0) 00112 ACE_ERROR ((LM_ERROR, 00113 ACE_TEXT ("TAO (%P|%t) ") 00114 ACE_TEXT ("unable to open acceptor ") 00115 ACE_TEXT ("for <%s>%p\n"), 00116 buffer, 00117 "")); 00118 00119 throw CORBA::BAD_PARAM ( 00120 CORBA::SystemException::_tao_minor_code ( 00121 TAO_ACCEPTOR_REGISTRY_OPEN_LOCATION_CODE, 00122 EINVAL), 00123 CORBA::COMPLETED_NO); 00124 } 00125 00126 // Add acceptor to list. 00127 Entry tmp_entry; 00128 tmp_entry.acceptor = acceptor; 00129 tmp_entry.endpoint = nc_profile->endpoint ()->duplicate (); 00130 tmp_entry.cnt = 1; 00131 00132 if (this->registry_.enqueue_tail (tmp_entry) == -1) 00133 { 00134 delete acceptor; 00135 00136 if (TAO_debug_level > 0) 00137 ACE_ERROR ((LM_ERROR, 00138 ACE_TEXT ("TAO (%P|%t) ") 00139 ACE_TEXT ("unable to add acceptor to registry") 00140 ACE_TEXT ("for <%s>%p\n"), 00141 buffer, 00142 "")); 00143 00144 throw CORBA::BAD_PARAM ( 00145 CORBA::SystemException::_tao_minor_code ( 00146 TAO_ACCEPTOR_REGISTRY_OPEN_LOCATION_CODE, 00147 EINVAL), 00148 CORBA::COMPLETED_NO); 00149 } 00150 } 00151 else 00152 { 00153 if (TAO_debug_level > 0) 00154 ACE_ERROR ((LM_ERROR, 00155 ACE_TEXT ("TAO (%P|%t) ") 00156 ACE_TEXT ("unable to create acceptor ") 00157 )); 00158 00159 throw CORBA::BAD_PARAM ( 00160 CORBA::SystemException::_tao_minor_code ( 00161 TAO_ACCEPTOR_REGISTRY_OPEN_LOCATION_CODE, 00162 EINVAL), 00163 CORBA::COMPLETED_NO); 00164 } 00165 } |
|
|
|
List of acceptors that are currently open.
Definition at line 107 of file PortableGroup_Acceptor_Registry.h. |