summaryrefslogtreecommitdiff
path: root/TAO/tao/default_server.h
blob: 80f82534edfef7dca012c2a5741c11e7a14054d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
//=============================================================================
/**
 *  @file     default_server.h
 *
 *  @author  Chris Cleeland
 */
//=============================================================================

#ifndef TAO_DEFAULT_SERVER_FACTORY_H
#define TAO_DEFAULT_SERVER_FACTORY_H

#include /**/ "ace/pre.h"

#include "tao/Server_Strategy_Factory.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

#include "ace/Service_Config.h"
#include "ace/Time_Value.h"

TAO_BEGIN_VERSIONED_NAMESPACE_DECL

/**
 * @class TAO_Default_Server_Strategy_Factory
 *
 * @brief This is the default strategy factory for CORBA servers.  It
 * allows developers to choose strategies via argument flags.
 * This design gives substantial freedom for experimentation.
 */
class TAO_Export TAO_Default_Server_Strategy_Factory
  : public TAO_Server_Strategy_Factory
{
public:
  TAO_Default_Server_Strategy_Factory (void);
  virtual ~TAO_Default_Server_Strategy_Factory (void);

  // = Service Configurator hooks.
  virtual int init (int argc, ACE_TCHAR* argv[]);

  // = The TAO_Server_Strategy_Factory methods, please read the
  //   documentation in "tao/Server_Strategy_Factory.h"
  virtual int open (TAO_ORB_Core*);
  virtual int activate_server_connections (void);
  virtual int thread_per_connection_timeout (ACE_Time_Value &timeout);
  virtual int server_connection_thread_flags (void);
  virtual int server_connection_thread_count (void);

  /// Parse the arguments, check the documentation in
  /// $TAO_ROOT/docs/Options.html for details
  int parse_args (int argc, ACE_TCHAR* argv[]);

protected:
  void tokenize (ACE_TCHAR* flag_string);

  void report_option_value_error (const ACE_TCHAR* option_name,
                                  const ACE_TCHAR* option_value);

protected:
  /// Should the server connection handlers run in their own thread?
  int activate_server_connections_;

  /// Default thread flags passed to thr_create().
  int thread_flags_;

  /// The timeout flag and value for the thread-per-connection model
  int thread_per_connection_use_timeout_;
  ACE_Time_Value thread_per_connection_timeout_;
};

ACE_STATIC_SVC_DECLARE_EXPORT (TAO, TAO_Default_Server_Strategy_Factory)
ACE_FACTORY_DECLARE (TAO, TAO_Default_Server_Strategy_Factory)

TAO_END_VERSIONED_NAMESPACE_DECL

#include /**/ "ace/post.h"
#endif /* TAO_DEFAULT_SERVER_FACTORY_H */