00001 // This may look like C, but it's really -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file default_server.h 00006 * 00007 * $Id: default_server.h 69849 2005-12-08 20:19:29Z ossama $ 00008 * 00009 * @author Chris Cleeland 00010 */ 00011 //============================================================================= 00012 00013 00014 #ifndef TAO_DEFAULT_SERVER_FACTORY_H 00015 #define TAO_DEFAULT_SERVER_FACTORY_H 00016 00017 #include /**/ "ace/pre.h" 00018 00019 #include "tao/Server_Strategy_Factory.h" 00020 00021 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00022 # pragma once 00023 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00024 00025 #include "ace/Service_Config.h" 00026 #include "ace/Time_Value.h" 00027 00028 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00029 00030 /** 00031 * @class TAO_Default_Server_Strategy_Factory 00032 * 00033 * @brief This is the default strategy factory for CORBA servers. It 00034 * allows developers to choose strategies via argument flags. 00035 * This design gives substantial freedom for experimentation. 00036 * 00037 */ 00038 class TAO_Export TAO_Default_Server_Strategy_Factory 00039 : public TAO_Server_Strategy_Factory 00040 { 00041 public: 00042 // = Initialization and termination methods. 00043 TAO_Default_Server_Strategy_Factory (void); 00044 virtual ~TAO_Default_Server_Strategy_Factory (void); 00045 00046 // = Service Configurator hooks. 00047 virtual int init (int argc, ACE_TCHAR* argv[]); 00048 00049 // = The TAO_Server_Strategy_Factory methods, please read the 00050 // documentation in "tao/Server_Strategy_Factory.h" 00051 virtual int open (TAO_ORB_Core*); 00052 virtual int enable_poa_locking (void); 00053 virtual int activate_server_connections (void); 00054 virtual int thread_per_connection_timeout (ACE_Time_Value &timeout); 00055 virtual int server_connection_thread_flags (void); 00056 virtual int server_connection_thread_count (void); 00057 00058 /// Parse the arguments, check the documentation in 00059 /// $TAO_ROOT/docs/Options.html for details 00060 int parse_args (int argc, ACE_TCHAR* argv[]); 00061 00062 protected: 00063 void tokenize (ACE_TCHAR* flag_string); 00064 00065 void report_option_value_error (const ACE_TCHAR* option_name, 00066 const ACE_TCHAR* option_value); 00067 00068 protected: 00069 /// Should the server connection handlers run in their own thread? 00070 int activate_server_connections_; 00071 00072 /// Default thread flags passed to thr_create(). 00073 int thread_flags_; 00074 00075 enum Lock_Type 00076 { 00077 TAO_NULL_LOCK, 00078 TAO_THREAD_LOCK 00079 }; 00080 00081 /// The type of lock to be returned by <create_poa_lock()>. 00082 Lock_Type poa_lock_type_; 00083 00084 /// The timeout flag and value for the thread-per-connection model 00085 int thread_per_connection_use_timeout_; 00086 ACE_Time_Value thread_per_connection_timeout_; 00087 }; 00088 00089 TAO_END_VERSIONED_NAMESPACE_DECL 00090 00091 ACE_STATIC_SVC_DECLARE_EXPORT (TAO, TAO_Default_Server_Strategy_Factory) 00092 ACE_FACTORY_DECLARE (TAO, TAO_Default_Server_Strategy_Factory) 00093 00094 #include /**/ "ace/post.h" 00095 #endif /* TAO_DEFAULT_SERVER_FACTORY_H */