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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
/* -*- C++ -*- */
//=============================================================================
/**
* @file RT_Servant_Dispatcher.h
*
* $Id$
*
* @author Frank Hunleth (fhunleth@cs.wustl.edu)
*/
//=============================================================================
#ifndef TAO_RT_SERVANT_DISPATCHER_H
#define TAO_RT_SERVANT_DISPATCHER_H
#include "ace/pre.h"
#include "rtportableserver_export.h"
#include "tao/PortableServer/Servant_Dispatcher.h"
#include "tao/RTCORBA/RTCORBA.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
// Forward references.
class TAO_Service_Context;
/**
* @class TAO_RT_Servant_Dispatcher
*
* @brief Concrete instantiation of the Servant_Dispatcher strategy.
*
*
*/
class TAO_RTPortableServer_Export TAO_RT_Servant_Dispatcher
: public TAO_Servant_Dispatcher
{
public:
virtual ~TAO_RT_Servant_Dispatcher (void);
/// Dispatch the request to the servant.
virtual void dispatch (TAO_Object_Adapter::Servant_Upcall &servant_upcall,
TAO_ServerRequest &req,
CORBA::Environment &ACE_TRY_ENV);
/// Factory method for creating new POA's.
virtual TAO_POA *create_POA (const ACE_CString &name,
TAO_POA_Manager &poa_manager,
const TAO_POA_Policy_Set &policies,
TAO_POA *parent,
ACE_Lock &lock,
TAO_SYNCH_MUTEX &thread_lock,
TAO_ORB_Core &orb_core,
TAO_Object_Adapter *object_adapter,
CORBA_Environment &ACE_TRY_ENV);
};
/**
* @class RT_Priority_Model_Processing
*
* @brief
*
* This class encapsulates processing necessary for
* RTCORBA CLIENT_PROPAGATED priority model.
*
* Although the destructor of this class resets the priority of
* the thread to it's original value, application should use
* <post_invoke> method for that purpose: destructor cannot
* propagate possible exceptions to the callee. Destructor's
* reset capability is intended as a last resort, i.e., if
* <post_invoke> isn't reached for some reason.
*/
class TAO_RTPortableServer_Export RT_Priority_Model_Processing
{
public:
// Constructor.
RT_Priority_Model_Processing (TAO_POA &poa);
// Resets the priority of the current thread back to its original
// value if necessary, i.e., if it was changed and the
// <post_invoke> method hasn't been called. Unlike <post_invoke>,
// this method cannot propagate exceptions to the user.
~RT_Priority_Model_Processing (void);
// Checks if target POA supports RTCORBA::CLIENT_PROPAGATED
// PriorityModel. If so, stores the original priority of the
// current thread, and sets the thread to the client-propagated
// priority.
void pre_invoke (TAO_Service_Context &request_service_context,
TAO_Service_Context &reply_service_context,
CORBA::Environment &ACE_TRY_ENV);
// Resets the priority of the current thread back to its original
// value, if necessary.
void post_invoke (CORBA::Environment &ACE_TRY_ENV);
private:
RT_Priority_Model_Processing (const RT_Priority_Model_Processing &);
void operator= (const RT_Priority_Model_Processing &);
enum State
{
NO_ACTION_REQUIRED,
PRIORITY_RESET_REQUIRED
};
// Indicates whether the priority of the thread needs to be reset
// back to its original value.
State state_;
// Poa of the target servant.
TAO_POA &poa_;
// Original priority of the thread.
RTCORBA::Priority original_priority_;
};
#include "ace/post.h"
#endif /* TAO_RT_SERVANT_DISPATCHER_H */
|