summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_Minimum_Dispersion.h
blob: af388ef2baa3e371ab944ccff0a1efebbf4b8e89 (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
// -*- C++ -*-

//=============================================================================
/**
 *  @file LB_Minimum_Dispersion_Strategy.h
 *
 *  $Id$
 *
 *  @author Carlos O'Ryan <coryan@uci.edu>
 */
//=============================================================================


#ifndef LB_MINIMUM_DISPERSION_H
#define LB_MINIMUM_DISPERSION_H

#include "ace/pre.h"

#include "LB_Balancing_Strategy.h"

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

#include "ace/Containers.h"
#include "ace/Synch.h"

// @@ Ossama: my class names suck too, any idea on what would be a
// good name for this strategy? It basically tries to keep all the
// loads "close to the average",  if one server is much higher than
// the load it is deemed too loaded and the advisory is sent.

// Forward declarations
// class TAO_LB_ReplicaProxy;
struct TAO_LB_ObjectGroup_Map_Entry;

// typedef ACE_Unbounded_Set<TAO_LB_ReplicaProxy *> TAO_LB_ReplicaProxySet;
// typedef ACE_Unbounded_Set_Iterator<TAO_LB_ReplicaProxy *> TAO_LB_ReplicaProxySetIterator;

/**
 * @class TAO_LB_Minimum_Dispersion_Strategy
 *
 * @brief Minimum Dispersion load balancing strategy
 */
class TAO_LoadBalancing_Export TAO_LB_Minimum_Dispersion_Strategy
  : public TAO_LB_Balancing_Strategy
{
public:

  /// Constructor.
  TAO_LB_Minimum_Dispersion_Strategy (void);

  /// Destructor
  ~TAO_LB_Minimum_Dispersion_Strategy (void);

  /**
   * @name The TAO_LB_LoadBalancing_Strategy methods
   */
  //@{

  virtual CORBA::Object_ptr replica (TAO_LB_ObjectGroup_Map_Entry *entry,
                                     CORBA_Environment &ACE_TRY_ENV)
    ACE_THROW_SPEC ((CORBA::SystemException));

  virtual void analyze_loads (TAO_LB_Location_Map &location_map,
                              CORBA::Environment &ACE_TRY_ENV);

  //@}

private:

  /// Lock used to ensure atomic access to state retained by this
  /// class.
  /// TAO_SYNCH_MUTEX lock_;

};

#include "ace/post.h"

#endif  /* LB_MINIMUM_DISPERSION_H */