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
00105
00106 int prepare_for_upcall_i (const TAO::ObjectKey &key,
00107 const char *operation,
00108 CORBA::Object_out forward_to,
00109 bool &wait_occurred_restart_call);
00110
00111
00112 void pre_invoke_remote_request (TAO_ServerRequest &req);
00113
00114
00115 void pre_invoke_collocated_request (void);
00116
00117
00118 void post_invoke (void);
00119
00120
00121 ::TAO_Root_POA *lookup_POA (const TAO::ObjectKey &key);
00122
00123
00124 ::TAO_Root_POA &poa (void) const;
00125
00126
00127 TAO_Object_Adapter &object_adapter (void) const;
00128
00129
00130 const PortableServer::ObjectId &id (void) const;
00131
00132
00133
00134 void user_id (const PortableServer::ObjectId *);
00135 const PortableServer::ObjectId &user_id (void) const;
00136
00137
00138 PortableServer::Servant servant (void) const;
00139
00140 #if (TAO_HAS_MINIMUM_POA == 0)
00141
00142
00143 void* locator_cookie (void) const;
00144
00145
00146 void locator_cookie (void* cookie);
00147
00148
00149 const char *operation (void) const;
00150
00151
00152 void operation (const char *);
00153
00154 #endif
00155
00156
00157 void active_object_map_entry (TAO_Active_Object_Map_Entry *entry);
00158
00159
00160 TAO_Active_Object_Map_Entry *active_object_map_entry (void) const;
00161
00162
00163 CORBA::Short priority (void) const;
00164
00165 enum State
00166 {
00167 INITIAL_STAGE,
00168 OBJECT_ADAPTER_LOCK_ACQUIRED,
00169 POA_CURRENT_SETUP,
00170 OBJECT_ADAPTER_LOCK_RELEASED,
00171 SERVANT_LOCK_ACQUIRED
00172 };
00173
00174
00175 State state (void) const;
00176
00177
00178 void state (State);
00179
00180
00181 void increment_servant_refcount (void);
00182
00183 protected:
00184
00185 void post_invoke_servant_cleanup (void);
00186 void single_threaded_poa_setup (void);
00187 void single_threaded_poa_cleanup (void);
00188 void servant_cleanup (void);
00189 void poa_cleanup (void);
00190
00191
00192 void upcall_cleanup (void);
00193
00194 protected:
00195
00196 TAO_Object_Adapter *object_adapter_;
00197
00198 ::TAO_Root_POA *poa_;
00199
00200 PortableServer::Servant servant_;
00201
00202 State state_;
00203
00204 CORBA::Octet system_id_buf_[TAO_POA_OBJECT_ID_BUF_SIZE];
00205 PortableServer::ObjectId system_id_;
00206
00207 const PortableServer::ObjectId *user_id_;
00208
00209 POA_Current_Impl current_context_;
00210
00211 #if (TAO_HAS_MINIMUM_POA == 0)
00212
00213
00214 void* cookie_;
00215
00216
00217 const char *operation_;
00218
00219 #endif
00220
00221
00222
00223 TAO_Active_Object_Map_Entry *active_object_map_entry_;
00224
00225
00226 Pre_Invoke_State pre_invoke_state_;
00227
00228 private:
00229 Servant_Upcall (const Servant_Upcall &);
00230 void operator= (const Servant_Upcall &);
00231 };
00232 }
00233 }
00234
00235 TAO_END_VERSIONED_NAMESPACE_DECL
00236
00237 #if defined(_MSC_VER)
00238 #pragma warning(pop)
00239 #endif
00240
00241 #if defined (__ACE_INLINE__)
00242 # include "tao/PortableServer/Servant_Upcall.inl"
00243 #endif
00244
00245 #include "ace/post.h"
00246
00247 #endif