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