summaryrefslogtreecommitdiff
path: root/TAO/tao/Server_Strategy_Factory.h
blob: e2ada048d39b447325cc30dcd57a36e9fb5f0c49 (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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
// -*- C++ -*-

//=============================================================================
/**
 *  @file     Server_Strategy_Factory.h
 *
 *  @author  Chris Cleeland
 */
//=============================================================================

#ifndef TAO_SERVER_STRATEGY_FACTORY_H
#define TAO_SERVER_STRATEGY_FACTORY_H

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

#include "ace/Service_Object.h"

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

#include /**/ "tao/TAO_Export.h"
#include "tao/Basic_Types.h"

TAO_BEGIN_VERSIONED_NAMESPACE_DECL

class TAO_ORB_Core;

enum TAO_Demux_Strategy
{
  TAO_LINEAR,
  TAO_DYNAMIC_HASH,
  TAO_ACTIVE_DEMUX,
  TAO_USER_DEFINED
};

/**
 * @class TAO_Server_Strategy_Factory
 *
 * @brief Base class for the server's abstract factory that manufactures
 * various strategies of special utility to it.  This simply
 * serves as an interface to a subclass that REALLY gets
 * specified and loaded by the Service Configurator.
 */
class TAO_Export TAO_Server_Strategy_Factory : public ACE_Service_Object
{
public:
  struct Active_Object_Map_Creation_Parameters
  {
    /// Constructor.
    Active_Object_Map_Creation_Parameters ();

    /// Default size of object lookup table.
    CORBA::ULong active_object_map_size_;

    /// The type of lookup/demultiplexing strategy being used for user
    /// id policy
    TAO_Demux_Strategy object_lookup_strategy_for_user_id_policy_;

    /// The type of lookup/demultiplexing strategy being used for
    /// system id policy
    TAO_Demux_Strategy object_lookup_strategy_for_system_id_policy_;

    /// The type of reverse lookup/demultiplexing strategy being used
    /// for the UNIQUE_ID policy
    TAO_Demux_Strategy reverse_object_lookup_strategy_for_unique_id_policy_;

    /// Flag to indicate whether the active hint should be used with
    /// the IOR.
    int use_active_hint_in_ids_;

    /// Flag to indicate whether reactivations of servants was required
    /// (under the system id policy).  If not, certain resources may
    /// not be required.
    int allow_reactivation_of_system_ids_;

    CORBA::ULong poa_map_size_;

    TAO_Demux_Strategy poa_lookup_strategy_for_transient_id_policy_;

    TAO_Demux_Strategy poa_lookup_strategy_for_persistent_id_policy_;

    int use_active_hint_in_poa_names_;
  };

  /// Constructor.
  TAO_Server_Strategy_Factory ();

  /// Destructor.
  virtual ~TAO_Server_Strategy_Factory();

  /**
   * Call <open> on various strategies.  This is not performed in
   * <init> so that the other portions of the ORB have a chance to
   * "settle" in their initialization since the strategies herein
   * might need some of that information.
   */
  virtual int open (TAO_ORB_Core* orb_core) = 0;

  /// Are server connections active (i.e. run in their own thread)
  virtual int activate_server_connections () = 0;

  /**
   * Obtain the timeout value used by the thread-per-connection server
   * threads to poll the shutdown flag in the ORB.
   * Return -1 if the ORB should use the compile-time defaults.
   * If the return value is zero then the threads block without
   * timeouts.
   */
  virtual int thread_per_connection_timeout (ACE_Time_Value &timeout) = 0;

  /// The thread activation parameters
  virtual int server_connection_thread_flags () = 0;
  virtual int server_connection_thread_count () = 0;

  /// Return the active object map creation parameters.
  virtual
  const Active_Object_Map_Creation_Parameters &
  active_object_map_creation_parameters () const;

protected:
  /// Active object map creation parameters.
  Active_Object_Map_Creation_Parameters active_object_map_creation_parameters_;
};

TAO_END_VERSIONED_NAMESPACE_DECL

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

#endif /* TAO_SERVER_STRATEGY_FACTORY_H */