00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file Acceptor_Impl.h 00006 * 00007 * Acceptor_Impl.h,v 1.21 2006/06/01 13:17:11 jwillemsen Exp 00008 * 00009 * @author Carlos O'Ryan <coryan@cs.wustl.edu> 00010 * @author Ossama Othman <othman@cs.wustl.edu> 00011 */ 00012 //============================================================================= 00013 00014 #ifndef TAO_ACCEPTOR_IMPL_H 00015 #define TAO_ACCEPTOR_IMPL_H 00016 00017 #include /**/ "ace/pre.h" 00018 00019 #include "ace/Strategies_T.h" 00020 00021 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00022 # pragma once 00023 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00024 00025 #include "tao/Basic_Types.h" 00026 00027 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00028 00029 // Forward declarations. 00030 class TAO_ORB_Core; 00031 00032 /** 00033 * @class TAO_Creation_Strategy 00034 * 00035 * @brief Creates a Svc_Handler and set the ORB_Core pointer on it. 00036 */ 00037 template <class SVC_HANDLER> 00038 class TAO_Creation_Strategy : public ACE_Creation_Strategy<SVC_HANDLER> 00039 { 00040 public: 00041 /** 00042 * Constructor. 00043 */ 00044 TAO_Creation_Strategy (TAO_ORB_Core *orb_core, 00045 CORBA::Boolean flag = false); 00046 00047 /// Create a SVC_HANDLER and set the ORB_Core pointer on it. 00048 int make_svc_handler (SVC_HANDLER *&sh); 00049 00050 protected: 00051 /// Pointer to the ORB Core. 00052 TAO_ORB_Core *orb_core_; 00053 00054 /// Should we use the Lite version for any protocol? 00055 CORBA::Boolean lite_flag_; 00056 }; 00057 00058 /** 00059 * @class TAO_Concurrency_Strategy 00060 * 00061 * @brief Activates the Svc_Handler, and then if specified by the 00062 * TAO_Server_Strategy_Factory, it activates the Svc_Handler to 00063 * run in its own thread. 00064 */ 00065 template <class SVC_HANDLER> 00066 class TAO_Concurrency_Strategy : public ACE_Concurrency_Strategy<SVC_HANDLER> 00067 { 00068 public: 00069 /// Constructor. 00070 TAO_Concurrency_Strategy (TAO_ORB_Core *orb_core); 00071 00072 /** 00073 * Activates the Svc_Handler, and then if specified by the 00074 * TAO_Server_Strategy_Factory, it activates the Svc_Handler to run 00075 * in its own thread. 00076 */ 00077 int activate_svc_handler (SVC_HANDLER *svc_handler, 00078 void *arg); 00079 00080 protected: 00081 /// Pointer to the ORB Core. 00082 TAO_ORB_Core *orb_core_; 00083 }; 00084 00085 template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1> 00086 class TAO_Accept_Strategy : public ACE_Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2> 00087 { 00088 public: 00089 00090 /// Constructor. 00091 TAO_Accept_Strategy (TAO_ORB_Core *orb_core); 00092 00093 /// Initialize the <peer_acceptor_> with <local_addr>. If the 00094 /// process runs out of handles, purge some "old" connections. 00095 int open (const ACE_PEER_ACCEPTOR_ADDR &local_addr, 00096 int restart = 0); 00097 00098 /// Delegates to the <accept> method of the PEER_ACCEPTOR. If the 00099 /// process runs out of handles, purge some "old" connections. 00100 int accept_svc_handler (SVC_HANDLER *svc_handler); 00101 00102 protected: 00103 /// Base class. 00104 typedef ACE_Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2> ACCEPT_STRATEGY_BASE; 00105 00106 /// Pointer to the ORB Core. 00107 TAO_ORB_Core *orb_core_; 00108 }; 00109 00110 TAO_END_VERSIONED_NAMESPACE_DECL 00111 00112 #if defined (ACE_TEMPLATES_REQUIRE_SOURCE) 00113 #include "tao/Acceptor_Impl.cpp" 00114 #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ 00115 00116 #if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) 00117 #pragma implementation ("Acceptor_Impl.cpp") 00118 #endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ 00119 00120 #include /**/ "ace/post.h" 00121 #endif /* TAO_ACCEPTOR_IMPL_H */