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. More...
#include <Acceptor_Impl.h>


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. | |
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.
Definition at line 62 of file Acceptor_Impl.h.
| TAO_Concurrency_Strategy< SVC_HANDLER >::TAO_Concurrency_Strategy | ( | TAO_ORB_Core * | orb_core | ) | [inline] |
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 | |||
| ) | [inline, 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.
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 { 00084 // Activation fails, decrease reference. 00085 sh->transport ()->remove_reference (); 00086 00087 // #REFCOUNT# is zero at this point. 00088 00089 return -1; 00090 } 00091 00092 // The service handler has been activated. Now cache the handler. 00093 if (sh->add_transport_to_cache () == -1) 00094 { 00095 // Adding to the cache fails, close the handler. 00096 sh->close (); 00097 00098 // close() doesn't really decrease reference. 00099 sh->transport ()->remove_reference (); 00100 00101 // #REFCOUNT# is zero at this point. 00102 00103 if (TAO_debug_level > 0) 00104 { 00105 ACE_ERROR ((LM_ERROR, 00106 ACE_TEXT ("TAO (%P|%t) - Concurrency_Strategy::activate_svc_handler, ") 00107 ACE_TEXT ("could not add the handler to cache\n"))); 00108 } 00109 00110 return -1; 00111 } 00112 00113 // Registration with cache is successful, #REFCOUNT# is two at this 00114 // point. 00115 00116 TAO_Server_Strategy_Factory *f = 00117 this->orb_core_->server_factory (); 00118 00119 int result = 0; 00120 00121 // Do we need to create threads? 00122 if (f->activate_server_connections ()) 00123 { 00124 // Thread-per-connection concurrency model 00125 TAO_Thread_Per_Connection_Handler *tpch = 0; 00126 00127 ACE_NEW_RETURN (tpch, 00128 TAO_Thread_Per_Connection_Handler (sh, 00129 this->orb_core_), 00130 -1); 00131 00132 result = 00133 tpch->activate (f->server_connection_thread_flags (), 00134 f->server_connection_thread_count ()); 00135 } 00136 else 00137 { 00138 // Otherwise, it is the reactive concurrency model. We may want 00139 // to register ourselves with the reactor. Call the register 00140 // handler on the transport. 00141 result = sh->transport ()->register_handler (); 00142 } 00143 00144 if (result != -1) 00145 { 00146 // Activation/registration successful: the handler has been 00147 // registered with either the Reactor or the 00148 // Thread-per-Connection_Handler, and the Transport Cache. 00149 // #REFCOUNT# is three at this point. 00150 00151 // We can let go of our reference. 00152 sh->transport ()->remove_reference (); 00153 } 00154 else 00155 { 00156 // Activation/registration failure. #REFCOUNT# is two at this 00157 // point. 00158 00159 // Remove from cache. 00160 sh->transport ()->purge_entry (); 00161 00162 // #REFCOUNT# is one at this point. 00163 00164 // Close handler. 00165 sh->close (); 00166 00167 // close() doesn't really decrease reference. 00168 sh->transport ()->remove_reference (); 00169 00170 // #REFCOUNT# is zero at this point. 00171 00172 if (TAO_debug_level > 0) 00173 { 00174 const ACE_TCHAR *error = 0; 00175 if (f->activate_server_connections ()) 00176 error = ACE_TEXT("could not activate new connection"); 00177 else 00178 error = ACE_TEXT("could not register new connection in the reactor"); 00179 00180 ACE_ERROR ((LM_ERROR, 00181 ACE_TEXT("TAO (%P|%t) - Concurrency_Strategy::activate_svc_handler, ") 00182 ACE_TEXT("%s\n"), error)); 00183 } 00184 00185 return -1; 00186 } 00187 00188 // Success: #REFCOUNT# is two at this point. 00189 return result; 00190 }
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.
1.6.1