summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/orbsvcs/LB_ReplicaLocator.h
blob: 129c969207f586c5019d4ccc4806313b5eafebf8 (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
// -*- C++ -*-

//=============================================================================
/**
 *  @file LB_ReplicaLocator.h
 *
 *  $Id$
 *
 *  @author Ossama Othman <ossama@uci.edu>
 */
//=============================================================================


#ifndef TAO_LB_REPLICA_LOCATOR_H
#define TAO_LB_REPLICA_LOCATOR_H

#include "ace/pre.h"

#include "ace/config-all.h"

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

#include "tao/PortableServer/PortableServerC.h"

// Forward declaration.
class TAO_LoadBalancing_ReplicationManager_i;

/**
 * @class TAO_LB_ReplicaLocator
 *
 * @brief ServantLocator implementation for the Load Balancer.
 *
 * This is a Servant Locator implementation that forwards requests to
 * a replica returned by the Load Balancer.
 */
class TAO_LB_ReplicaLocator
  : public virtual PortableServer::ServantLocator
{
public:

  /// Constructor
  TAO_LB_ReplicaLocator (TAO_LB_LoadBalancer *load_balancer);

  /**
   * @name The PortableServer::ServantLocator methods.
   */
  //@{

  /// Clients requests are forwarded via the
  /// PortableServer::ForwardRequest exception thrown in this method.
  virtual PortableServer::Servant preinvoke (
      const PortableServer::ObjectId &oid,
      PortableServer::POA_ptr adapter,
      const char *operation,
      PortableServer::ServantLocator::Cookie & the_cookie
      TAO_ENV_ARG_DECL)
    ACE_THROW_SPEC ((CORBA::SystemException,
                     PortableServer::ForwardRequest));

  /// This method is no-op in this ServantLocator implementation.
  virtual void postinvoke (
      const PortableServer::ObjectId &oid,
      PortableServer::POA_ptr adapter,
      const char *operation,
      PortableServer::ServantLocator::Cookie the_cookie,
      PortableServer::Servant the_servant
      TAO_ENV_ARG_DECL)
    ACE_THROW_SPEC ((CORBA::SystemException));

  //@}

private:

  /// The load balancer implementation.
  TAO_LoadBalancing_ReplicationManager_i *load_balancer_;

};

#include "ace/post.h"

#endif  /* TAO_LB_REPLICA_LOCATOR_H */