00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file Acceptor_Impl.h 00006 * 00007 * $Id: Acceptor_Impl.h 78931 2007-07-18 09:59:36Z johnnyw $ 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 00046 /// Create a SVC_HANDLER and set the ORB_Core pointer on it. 00047 int make_svc_handler (SVC_HANDLER *&sh); 00048 00049 protected: 00050 /// Pointer to the ORB Core. 00051 TAO_ORB_Core *orb_core_; 00052 }; 00053 00054 /** 00055 * @class TAO_Concurrency_Strategy 00056 * 00057 * @brief Activates the Svc_Handler, and then if specified by the 00058 * TAO_Server_Strategy_Factory, it activates the Svc_Handler to 00059 * run in its own thread. 00060 */ 00061 template <class SVC_HANDLER> 00062 class TAO_Concurrency_Strategy : public ACE_Concurrency_Strategy<SVC_HANDLER> 00063 { 00064 public: 00065 /// Constructor. 00066 TAO_Concurrency_Strategy (TAO_ORB_Core *orb_core); 00067 00068 /** 00069 * Activates the Svc_Handler, and then if specified by the 00070 * TAO_Server_Strategy_Factory, it activates the Svc_Handler to run 00071 * in its own thread. 00072 */ 00073 int activate_svc_handler (SVC_HANDLER *svc_handler, 00074 void *arg); 00075 00076 protected: 00077 /// Pointer to the ORB Core. 00078 TAO_ORB_Core *orb_core_; 00079 }; 00080 00081 template <class SVC_HANDLER, ACE_PEER_ACCEPTOR_1> 00082 class TAO_Accept_Strategy : public ACE_Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2> 00083 { 00084 public: 00085 00086 /// Constructor. 00087 TAO_Accept_Strategy (TAO_ORB_Core *orb_core); 00088 00089 /// Initialize the <peer_acceptor_> with <local_addr>. If the 00090 /// process runs out of handles, purge some "old" connections. 00091 int open (const ACE_PEER_ACCEPTOR_ADDR &local_addr, 00092 int restart = 0); 00093 00094 /// Delegates to the <accept> method of the PEER_ACCEPTOR. If the 00095 /// process runs out of handles, purge some "old" connections. 00096 int accept_svc_handler (SVC_HANDLER *svc_handler); 00097 00098 protected: 00099 /// Base class. 00100 typedef ACE_Accept_Strategy<SVC_HANDLER, ACE_PEER_ACCEPTOR_2> ACCEPT_STRATEGY_BASE; 00101 00102 /// Pointer to the ORB Core. 00103 TAO_ORB_Core *orb_core_; 00104 }; 00105 00106 TAO_END_VERSIONED_NAMESPACE_DECL 00107 00108 #if defined (ACE_TEMPLATES_REQUIRE_SOURCE) 00109 #include "tao/Acceptor_Impl.cpp" 00110 #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ 00111 00112 #if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) 00113 #pragma implementation ("Acceptor_Impl.cpp") 00114 #endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ 00115 00116 #include /**/ "ace/post.h" 00117 #endif /* TAO_ACCEPTOR_IMPL_H */