#include <Acceptor_Impl.h>
Inheritance diagram for TAO_Concurrency_Strategy< SVC_HANDLER >:
Public Member Functions | |
TAO_Concurrency_Strategy (TAO_ORB_Core *orb_core) | |
Constructor. | |
int | activate_svc_handler (SVC_HANDLER *svc_handler, void *arg) |
Protected Attributes | |
TAO_ORB_Core * | orb_core_ |
Pointer to the ORB Core. |
Definition at line 66 of file Acceptor_Impl.h.
|
Constructor.
Definition at line 69 of file Acceptor_Impl.cpp.
00070 : orb_core_ (orb_core) 00071 { 00072 } |
|
Activates the Svc_Handler, and then if specified by the TAO_Server_Strategy_Factory, it activates the Svc_Handler to run in its own thread. Reimplemented from ACE_Concurrency_Strategy< SVC_HANDLER >. Definition at line 75 of file Acceptor_Impl.cpp. References ACE_DEBUG, ACE_ERROR, ACE_NEW_RETURN, ACE_TCHAR, ACE_TEXT, TAO_Thread_Per_Connection_Handler::activate(), TAO_Server_Strategy_Factory::activate_server_connections(), ACE_Concurrency_Strategy< SVC_HANDLER >::activate_svc_handler(), LM_DEBUG, LM_ERROR, TAO_Server_Strategy_Factory::server_connection_thread_count(), TAO_Server_Strategy_Factory::server_connection_thread_flags(), TAO_ORB_Core::server_factory(), and TAO_debug_level.
00077 { 00078 sh->transport ()->opened_as (TAO::TAO_SERVER_ROLE); 00079 00080 // Indicate that this transport was opened in the server role 00081 if (TAO_debug_level > 6) 00082 ACE_DEBUG ((LM_DEBUG, 00083 "TAO (%P|%t) - Concurrency_Strategy::activate_svc_handler, " 00084 "opened as TAO_SERVER_ROLE\n")); 00085 00086 // Here the service handler has been created and the new connection 00087 // has been accepted. #REFCOUNT# is one at this point. 00088 00089 if (this->ACE_Concurrency_Strategy<SVC_HANDLER>::activate_svc_handler (sh, 00090 arg) == -1) 00091 return -1; 00092 00093 // The service handler has been activated. Now cache the handler. 00094 if (sh->add_transport_to_cache () == -1) 00095 { 00096 // Adding to the cache fails, close the handler. 00097 sh->close (); 00098 00099 // #REFCOUNT# is zero at this point. 00100 00101 if (TAO_debug_level > 0) 00102 { 00103 ACE_ERROR ((LM_ERROR, 00104 ACE_TEXT ("TAO (%P|%t) - Concurrency_Strategy::activate_svc_handler, ") 00105 ACE_TEXT ("could not add the handler to cache \n"))); 00106 } 00107 00108 return -1; 00109 } 00110 00111 // Registration with cache is successful, #REFCOUNT# is two at this 00112 // point. 00113 00114 TAO_Server_Strategy_Factory *f = 00115 this->orb_core_->server_factory (); 00116 00117 int result = 0; 00118 00119 // Do we need to create threads? 00120 if (f->activate_server_connections ()) 00121 { 00122 // Thread-per-connection concurrency model 00123 TAO_Thread_Per_Connection_Handler *tpch = 0; 00124 00125 ACE_NEW_RETURN (tpch, 00126 TAO_Thread_Per_Connection_Handler (sh, 00127 this->orb_core_), 00128 -1); 00129 00130 result = 00131 tpch->activate (f->server_connection_thread_flags (), 00132 f->server_connection_thread_count ()); 00133 } 00134 else 00135 { 00136 // Otherwise, it is the reactive concurrency model. We may want 00137 // to register ourselves with the reactor. Call the register 00138 // handler on the transport. 00139 result = 00140 sh->transport ()->register_handler (); 00141 } 00142 00143 if (result != -1) 00144 { 00145 // Activation/registration successful: the handler has been 00146 // registered with either the Reactor or the 00147 // Thread-per-Connection_Handler, and the Transport Cache. 00148 // #REFCOUNT# is three at this point. 00149 00150 // We can let go of our reference. 00151 sh->transport ()->remove_reference (); 00152 } 00153 else 00154 { 00155 // Activation/registration failure. #REFCOUNT# is two at this 00156 // point. 00157 00158 // Remove from cache. 00159 sh->transport ()->purge_entry (); 00160 00161 // #REFCOUNT# is one at this point. 00162 00163 // Close handler. 00164 sh->close (); 00165 00166 // #REFCOUNT# is zero at this point. 00167 00168 if (TAO_debug_level > 0) 00169 { 00170 const ACE_TCHAR *error = 0; 00171 if (f->activate_server_connections ()) 00172 error = ACE_TEXT("could not activate new connection"); 00173 else 00174 error = ACE_TEXT("could not register new connection in the reactor"); 00175 00176 ACE_ERROR ((LM_ERROR, 00177 "TAO (%P|%t) - Concurrency_Strategy::activate_svc_handler, " 00178 "%s\n", error)); 00179 } 00180 00181 return -1; 00182 } 00183 00184 // Success: #REFCOUNT# is two at this point. 00185 return result; 00186 } |
|
Pointer to the ORB Core.
Definition at line 82 of file Acceptor_Impl.h. |