summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/orbsvcs/LoadBalancing/LB_RPMS_Monitor_Interceptor.cpp
blob: abe11761b4204e8b647a93f480214ef4c3927fae (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
// -*- C++ -*-

#include "LB_RPMS_Monitor_Interceptor.h"

ACE_RCSID (LoadBalancing,
           LB_RPMS_Monitor_Interceptor,
           "$Id$")


#if !defined (__ACE_INLINE__)
# include "LB_RPMS_Monitor_Interceptor.inl"
#endif /* __ACE_INLINE__ */


TAO_LB_RPMS_Monitor_Interceptor::TAO_LB_RPMS_Monitor_Interceptor (
  CORBA::Object_ptr object_group)
  : lock_ (),
    request_count_ (0),
    interval_start_ (ACE_OS::gettimeofday ()),
    redirect_table_ ()
{
}

char *
TAO_LB_RPMS_Monitor_Interceptor::name (TAO_ENV_SINGLE_ARG_DECL_NOT_USED)
  ACE_THROW_SPEC ((CORBA::SystemException))
{
  // @todo It might be necessary to use an anonymous interceptor,
  //       i.e. an interceptor whose name is the empty string ("") in
  //       case multiple interceptors of this type are registered with
  //       an ORB.
  return CORBA::string_dup ("TAO_LB_RPMS_Monitor_Interceptor");
}

void
TAO_LB_RPMS_Monitor_Interceptor::destroy (TAO_ENV_SINGLE_ARG_DECL_NOT_USED)
  ACE_THROW_SPEC ((CORBA::SystemException))
{
  this->redirect_table_.destroy ();
}

void
TAO_LB_RPMS_Monitor_Interceptor::receive_request_service_contexts (
    PortableInterceptor::ServerRequestInfo_ptr ri
    TAO_ENV_ARG_DECL)
  ACE_THROW_SPEC ((CORBA::SystemException,
                   PortableInterceptor::ForwardRequest))
{
  TAO_ENV_ARG_DEFN;

  ACE_GUARD (TAO_SYNCH_MUTEX, guard, this->lock_);

  ++this->request_count_;

  // If required to do so by the load balancer, redirect all
  // requests back to the target corresponding to the RepositoryId in
  // redirect table.
  this->redirect_table_.find_redirect (ri,
                                       ACE_TRY_ENV);
  ACE_CHECK;
}

void
TAO_LB_RPMS_Monitor_Interceptor::receive_request (
    PortableInterceptor::ServerRequestInfo_ptr
    TAO_ENV_ARG_DECL_NOT_USED)
  ACE_THROW_SPEC ((CORBA::SystemException,
                   PortableInterceptor::ForwardRequest))
{
}

void
TAO_LB_RPMS_Monitor_Interceptor::send_reply (
    PortableInterceptor::ServerRequestInfo_ptr
    TAO_ENV_ARG_DECL_NOT_USED)
  ACE_THROW_SPEC ((CORBA::SystemException))
{
}

void
TAO_LB_RPMS_Monitor_Interceptor::send_exception (
    PortableInterceptor::ServerRequestInfo_ptr
    TAO_ENV_ARG_DECL_NOT_USED)
  ACE_THROW_SPEC ((CORBA::SystemException,
                   PortableInterceptor::ForwardRequest))
{
}

void
TAO_LB_RPMS_Monitor_Interceptor::send_other (
    PortableInterceptor::ServerRequestInfo_ptr
    TAO_ENV_ARG_DECL_NOT_USED)
  ACE_THROW_SPEC ((CORBA::SystemException,
                   PortableInterceptor::ForwardRequest))
{
}