Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

Acceptor_Impl.cpp

Go to the documentation of this file.
00001 // This may look like C, but it's really -*- C++ -*-
00002 // $Id: Acceptor_Impl.cpp,v 1.1.1.3 2001/12/04 14:34:41 chad Exp $
00003 
00004 
00005 // ============================================================================
00006 //
00007 // = LIBRARY
00008 //     TAO
00009 //
00010 // = FILENAME
00011 //     Acceptor_Impl.cpp
00012 //
00013 // = AUTHOR
00014 //     Carlos O'Ryan <coryan@uci.edu>
00015 //     Ossama Othman <othman@uci.edu>
00016 //
00017 // ============================================================================
00018 
00019 #ifndef TAO_ACCEPTOR_IMPL_CPP
00020 #define TAO_ACCEPTOR_IMPL_CPP
00021 
00022 #include "tao/Acceptor_Impl.h"
00023 
00024 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00025 # pragma once
00026 #endif /* ACE_LACKS_PRAGMA_ONCE */
00027 
00028 #include "tao/ORB_Core.h"
00029 #include "tao/ORB_Table.h"
00030 #include "tao/Server_Strategy_Factory.h"
00031 #include "tao/Connector_Registry.h"
00032 #include "tao/Transport_Cache_Manager.h"
00033 #include "tao/Thread_Lane_Resources.h"
00034 
00035 #include "ace/Object_Manager.h"
00036 
00037 #if !defined(__ACE_INLINE__)
00038 #include "tao/Acceptor_Impl.i"
00039 #endif /* __ACE_INLINE__ */
00040 
00041 ACE_RCSID(tao, Acceptor_Impl, "$Id: Acceptor_Impl.cpp,v 1.1.1.3 2001/12/04 14:34:41 chad Exp $")
00042 
00043 
00044 ////////////////////////////////////////////////////////////////////////////////
00045 
00046 template <class SVC_HANDLER>
00047 TAO_Creation_Strategy<SVC_HANDLER>::TAO_Creation_Strategy (TAO_ORB_Core *orb_core,
00048                                                            void *arg,
00049                                                            CORBA::Boolean flag)
00050   : orb_core_ (orb_core),
00051     arg_ (arg),
00052     lite_flag_ (flag)
00053 {
00054 }
00055 
00056 template <class SVC_HANDLER> int
00057 TAO_Creation_Strategy<SVC_HANDLER>::make_svc_handler (SVC_HANDLER *&sh)
00058 {
00059   if (sh == 0)
00060     {
00061       // Purge connections (if necessary)
00062       this->orb_core_->lane_resources ().transport_cache ().purge ();
00063 
00064       ACE_NEW_RETURN (sh,
00065                       SVC_HANDLER (this->orb_core_,
00066                                    this->lite_flag_,
00067                                    this->arg_),
00068                       -1);
00069     }
00070 
00071   return 0;
00072 }
00073 
00074 ////////////////////////////////////////////////////////////////////////////////
00075 
00076 template <class SVC_HANDLER>
00077 TAO_Concurrency_Strategy<SVC_HANDLER>::TAO_Concurrency_Strategy (TAO_ORB_Core *orb_core)
00078   : orb_core_ (orb_core)
00079 {
00080 }
00081 
00082 template <class SVC_HANDLER> int
00083 TAO_Concurrency_Strategy<SVC_HANDLER>::activate_svc_handler (SVC_HANDLER *sh,
00084                                                              void *arg)
00085 {
00086   if (this->ACE_Concurrency_Strategy<SVC_HANDLER>::activate_svc_handler (sh,
00087                                                                          arg) == -1)
00088     return -1;
00089 
00090   // The service handler has been activated. Now cache the handler.
00091   if (sh->add_transport_to_cache () == -1)
00092     {
00093       ACE_ERROR ((LM_ERROR,
00094                   ACE_TEXT ("(%P|%t) Could not add the handler to Cache \n")));
00095     }
00096 
00097   TAO_Server_Strategy_Factory *f =
00098     this->orb_core_->server_factory ();
00099 
00100   // thread-per-connection concurrency model
00101 
00102   if (f->activate_server_connections ())
00103     return sh->activate (f->server_connection_thread_flags (),
00104                          f->server_connection_thread_count ());
00105 
00106   // reactive concurrency model. We may want to register ourselves
00107   // with the reactor. Call the register handler on the transport.
00108   return sh->transport ()->register_handler ();
00109 }
00110 
00111 ////////////////////////////////////////////////////////////////////////////////
00112 
00113 template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1>
00114 TAO_Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::TAO_Accept_Strategy (TAO_ORB_Core *orb_core)
00115   : orb_core_ (orb_core)
00116 {
00117 }
00118 
00119 template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1> int
00120 TAO_Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::open (const ACE_PEER_ACCEPTOR_ADDR &local_addr,
00121                                                              int restart)
00122 {
00123 
00124   return ACCEPT_STRATEGY_BASE::open (local_addr,
00125                                      restart);
00126 }
00127 
00128 template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1> int
00129 TAO_Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2>::accept_svc_handler (SVC_HANDLER *svc_handler)
00130 {
00131   return ACCEPT_STRATEGY_BASE::accept_svc_handler (svc_handler);
00132 }
00133 
00134 
00135 /////////////////////////////////////////////////////////////////////
00136 
00137 #endif /* TAO_ACCEPTOR_IMPL_CPP */

Generated on Mon Jun 16 13:47:56 2003 for TAO by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002