Merge pull request #1551 from DOCGroup/plm_jira_333
[ACE_TAO.git] / TAO / orbsvcs / examples / LoadBalancing / ServerRequestInterceptor.h
blobf2bd24e4225037b63bfd070186100060e43f3a07
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file ServerRequestInterceptor.h
7 * @author Ossama Othman <ossama@dre.vanderbilt.edu>
8 */
9 //=============================================================================
12 #ifndef TAO_SERVER_REQUEST_INTERCEPTOR_H
13 #define TAO_SERVER_REQUEST_INTERCEPTOR_H
15 #include "ace/config-all.h"
17 #if !defined (ACE_LACKS_PRAGMA_ONCE)
18 # pragma once
19 #endif /* ACE_LACKS_PRAGMA_ONCE */
21 #include "tao/PI_Server/PI_Server.h"
22 #include "tao/PortableInterceptorC.h"
23 #include "tao/LocalObject.h"
25 #include "ace/Atomic_Op.h"
27 #if defined(_MSC_VER)
28 #pragma warning(push)
29 #pragma warning(disable:4250)
30 #endif /* _MSC_VER */
32 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
33 class TAO_LB_LoadAlert;
34 TAO_END_VERSIONED_NAMESPACE_DECL
36 /**
37 * @class ServerRequestInterceptor
39 * @brief ServerRequestInterceptor that calculates the number of
40 * requests arriving per second.
42 * This ServerRequestInterceptor is responsible for redirecting
43 * requests back to the LoadManager.
45 class ServerRequestInterceptor
46 : public virtual PortableInterceptor::ServerRequestInterceptor,
47 public virtual ::CORBA::LocalObject
49 public:
51 /// Constructor.
52 ServerRequestInterceptor (void);
54 /**
55 * @name Methods Required by the ServerRequestInterceptor
56 * Interface
58 * These are the canonical methods required for all
59 * ServerRequestInterceptors.
61 //@{
62 virtual char * name (void);
64 virtual void destroy (void);
66 virtual void receive_request_service_contexts (
67 PortableInterceptor::ServerRequestInfo_ptr ri);
69 virtual void receive_request (
70 PortableInterceptor::ServerRequestInfo_ptr ri);
72 virtual void send_reply (
73 PortableInterceptor::ServerRequestInfo_ptr ri);
75 virtual void send_exception (
76 PortableInterceptor::ServerRequestInfo_ptr ri);
78 virtual void send_other (
79 PortableInterceptor::ServerRequestInfo_ptr ri);
80 //@}
82 CORBA::Long request_count (void);
84 protected:
86 /// Destructor.
87 /**
88 * Protected destructor to enforce correct memory management via
89 * reference counting.
91 ~ServerRequestInterceptor (void);
93 private:
95 /// The number of requests that have arrived on the server.
96 ACE_Atomic_Op<TAO_SYNCH_MUTEX, long> request_count_;
100 #if defined(_MSC_VER)
101 #pragma warning(pop)
102 #endif /* _MSC_VER */
105 #endif /* TAO_SERVER_REQUEST_INTERCEPTOR_H */