00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef TAO_SERVANT_UPCALL_H
00014 #define TAO_SERVANT_UPCALL_H
00015
00016 #include "ace/pre.h"
00017
00018 #include "tao/PortableServer/portableserver_export.h"
00019
00020 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00021 # pragma once
00022 #endif
00023
00024 #include "tao/PortableServer/POA_Current_Impl.h"
00025
00026 #if defined(_MSC_VER)
00027 #pragma warning(push)
00028 #pragma warning(disable:4250)
00029 #endif
00030
00031 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00032
00033
00034 class TAO_Root_POA;
00035 class TAO_ServerRequest;
00036 class TAO_Object_Adapter;
00037 class TAO_RT_Collocation_Resolver;
00038 struct TAO_Active_Object_Map_Entry;
00039
00040 namespace CORBA
00041 {
00042 class Object;
00043 typedef Object *Object_ptr;
00044 typedef TAO_Pseudo_Var_T<Object> Object_var;
00045 typedef TAO_Pseudo_Out_T<Object> Object_out;
00046 }
00047
00048 namespace TAO
00049 {
00050 namespace Portable_Server
00051 {
00052
00053
00054
00055
00056
00057
00058
00059
00060 class TAO_PortableServer_Export Servant_Upcall
00061 {
00062 public:
00063 friend class ::TAO_RT_Collocation_Resolver;
00064
00065
00066
00067
00068
00069
00070
00071 class Pre_Invoke_State
00072 {
00073 public:
00074
00075 Pre_Invoke_State (void);
00076
00077 enum State
00078 {
00079 NO_ACTION_REQUIRED,
00080 PRIORITY_RESET_REQUIRED
00081 };
00082
00083
00084
00085 State state_;
00086
00087
00088 CORBA::Short original_native_priority_;
00089
00090
00091 CORBA::Short original_CORBA_priority_;
00092 };
00093
00094
00095 explicit Servant_Upcall (TAO_ORB_Core *orb_core);
00096
00097
00098 ~Servant_Upcall (void);
00099
00100
00101 int prepare_for_upcall (const TAO::ObjectKey &key,
00102 const char *operation,
00103 CORBA::Object_out forward_to
00104 ACE_ENV_ARG_DECL_WITH_DEFAULTS);
00105
00106
00107 int prepare_for_upcall_i (const TAO::ObjectKey &key,
00108 const char *operation,
00109 CORBA::Object_out forward_to,
00110 int &wait_occurred_restart_call
00111 ACE_ENV_ARG_DECL_WITH_DEFAULTS);
00112
00113
00114 void pre_invoke_remote_request (TAO_ServerRequest &req
00115 ACE_ENV_ARG_DECL);
00116
00117
00118 void pre_invoke_collocated_request (ACE_ENV_SINGLE_ARG_DECL);
00119
00120
00121 void post_invoke (void);
00122
00123
00124 ::TAO_Root_POA *lookup_POA (const TAO::ObjectKey &key
00125 ACE_ENV_ARG_DECL);
00126
00127
00128 ::TAO_Root_POA &poa (void) const;
00129
00130
00131 TAO_Object_Adapter &object_adapter (void) const;
00132
00133
00134 const PortableServer::ObjectId &id (void) const;
00135
00136
00137
00138 void user_id (const PortableServer::ObjectId *);
00139 const PortableServer::ObjectId &user_id (void) const;
00140
00141
00142 PortableServer::Servant servant (void) const;
00143
00144 #if (TAO_HAS_MINIMUM_POA == 0)
00145
00146
00147 void* locator_cookie (void) const;
00148
00149
00150 void locator_cookie (void* cookie);
00151
00152
00153 const char *operation (void) const;
00154
00155
00156 void operation (const char *);
00157
00158 #endif
00159
00160
00161 void active_object_map_entry (TAO_Active_Object_Map_Entry *entry);
00162
00163
00164 TAO_Active_Object_Map_Entry *active_object_map_entry (void) const;
00165
00166
00167 CORBA::Short priority (void) const;
00168
00169 enum State
00170 {
00171 INITIAL_STAGE,
00172 OBJECT_ADAPTER_LOCK_ACQUIRED,
00173 POA_CURRENT_SETUP,
00174 OBJECT_ADAPTER_LOCK_RELEASED,
00175 SERVANT_LOCK_ACQUIRED
00176 };
00177
00178
00179 State state (void) const;
00180
00181
00182 void state (State);
00183
00184
00185 void increment_servant_refcount (void);
00186
00187 protected:
00188
00189 void post_invoke_servant_cleanup (void);
00190 void single_threaded_poa_setup (ACE_ENV_SINGLE_ARG_DECL);
00191 void single_threaded_poa_cleanup (void);
00192 void servant_cleanup (void);
00193 void poa_cleanup (void);
00194
00195
00196 void upcall_cleanup (void);
00197
00198 protected:
00199
00200 TAO_Object_Adapter *object_adapter_;
00201
00202 ::TAO_Root_POA *poa_;
00203
00204 PortableServer::Servant servant_;
00205
00206 State state_;
00207
00208 PortableServer::ObjectId system_id_;
00209
00210 const PortableServer::ObjectId *user_id_;
00211
00212 POA_Current_Impl current_context_;
00213
00214 #if (TAO_HAS_MINIMUM_POA == 0)
00215
00216
00217 void* cookie_;
00218
00219
00220 const char *operation_;
00221
00222 #endif
00223
00224
00225
00226 TAO_Active_Object_Map_Entry *active_object_map_entry_;
00227
00228
00229 Pre_Invoke_State pre_invoke_state_;
00230
00231 private:
00232 Servant_Upcall (const Servant_Upcall &);
00233 void operator= (const Servant_Upcall &);
00234 };
00235 }
00236 }
00237
00238 TAO_END_VERSIONED_NAMESPACE_DECL
00239
00240 #if defined(_MSC_VER)
00241 #pragma warning(pop)
00242 #endif
00243
00244 #if defined (__ACE_INLINE__)
00245 # include "tao/PortableServer/Servant_Upcall.inl"
00246 #endif
00247
00248 #include "ace/post.h"
00249
00250 #endif