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

// $Id$

// ============================================================================
//
// = LIBRARY
//    orbsvcs
//
// = FILENAME
//    Minimum_Dispersion_Strategy.h
//
// = AUTHOR
//    Carlos O'Ryan <coryan@uci.edu>
//
// ============================================================================

#ifndef MINIMUM_DISPERSION_H
#define MINIMUM_DISPERSION_H

#include "LoadBalancing_Strategy.h"
#include "orbsvcs/LoadBalancingS.h"
#include "ace/Containers.h"

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

// @@ 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;

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

class TAO_LoadBalancing_Export TAO_LB_Minimum_Dispersion_Strategy : public TAO_LB_LoadBalancing_Strategy
{
  // = TITLE
  //    Minimum Dispersion load balancing strategy

  // = DESCRIPTION
  //

public:
  TAO_LB_Minimum_Dispersion_Strategy (void);
  // Constructor.

  ~TAO_LB_Minimum_Dispersion_Strategy (void);
  // Destructor

  // = The TAO_LB_LoadBalancing_Strategy methods
  virtual CORBA::Object_ptr replica (CORBA_Environment &ACE_TRY_ENV)
    ACE_THROW_SPEC ((CORBA::SystemException));
  virtual int insert (TAO_LB_ReplicaProxy *);
  virtual int remove (TAO_LB_ReplicaProxy *);
  virtual void load_changed (TAO_LB_ReplicaProxy *,
                             CORBA::Environment &ACE_TRY_ENV);

private:
  TAO_LB_ReplicaProxySet proxies_;
  // Set containing the ReplicaProxy servants.
};

#endif  /* MINIMUM_DISPERSION_H */