00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file CSD_TP_Collocated_Synch_With_Server_Request.h 00006 * 00007 * $Id: CSD_TP_Collocated_Synch_With_Server_Request.h 76551 2007-01-24 13:42:44Z johnnyw $ 00008 * 00009 * @author Tim Bradley <bradley_t@ociweb.com> 00010 */ 00011 //============================================================================= 00012 00013 #ifndef TAO_CSD_TP_COLLOCATED_SYNCH_WITH_SERVER_REQUEST_H 00014 #define TAO_CSD_TP_COLLOCATED_SYNCH_WITH_SERVER_REQUEST_H 00015 00016 #include /**/ "ace/pre.h" 00017 00018 #include "tao/CSD_ThreadPool/CSD_TP_Export.h" 00019 00020 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00021 # pragma once 00022 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00023 00024 #include "tao/CSD_ThreadPool/CSD_TP_Corba_Request.h" 00025 #include "tao/CSD_ThreadPool/CSD_TP_Synch_Helper.h" 00026 00027 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00028 00029 namespace TAO 00030 { 00031 namespace CSD 00032 { 00033 00034 class TP_Collocated_Synch_With_Server_Request; 00035 typedef TAO_Intrusive_Ref_Count_Handle 00036 <TP_Collocated_Synch_With_Server_Request> 00037 TP_Collocated_Synch_With_Server_Request_Handle; 00038 00039 /** 00040 * @class TP_Collocated_Synch_With_Server_Request 00041 * 00042 * @brief Represents a "queue-able", one-way, collocated, CORBA 00043 * request with a "Synch Scope" policy of SYNC_WITH_SERVER. 00044 * 00045 * This kind of request is one-way request with the SYNC_WITH_SERVER 00046 * policy applied. It is cloned before enqueuing and the "enqueuing" 00047 * thread will block until it is signalled by the TP_Task thread that 00048 * will happen just before the request is dispatched or the request 00049 * is cancelled. 00050 */ 00051 class TAO_CSD_TP_Export TP_Collocated_Synch_With_Server_Request 00052 : public TP_Corba_Request 00053 { 00054 public: 00055 00056 /// Constructor. 00057 TP_Collocated_Synch_With_Server_Request 00058 (TAO_ServerRequest& server_request, 00059 const PortableServer::ObjectId& object_id, 00060 PortableServer::POA_ptr poa, 00061 const char* operation, 00062 PortableServer::Servant servant, 00063 TP_Servant_State* servant_state); 00064 00065 /// Virtual Destructor. 00066 virtual ~TP_Collocated_Synch_With_Server_Request(); 00067 00068 /// Wait until the request has been dispatched (but not completed), or 00069 /// until it has been cancelled. Note that this will wait until just 00070 /// *before* the request is dispatched by a worker thread. This is 00071 /// different than the TP_Collocated_Synch_Request which waits until 00072 /// just *after* the request is dispatched by a worker thread. 00073 /// Returns true if the request has been dispatched, and returns 00074 /// false if the request has been cancelled. 00075 bool wait(void); 00076 00077 00078 protected: 00079 00080 /// Prepare this TP_Collocated_Synch_With_Server_Request object to be 00081 /// placed into the request queue. This will cause the underlying 00082 /// TAO_ServerRequest object to be cloned. 00083 virtual void prepare_for_queue_i(); 00084 00085 /// Dispatch the request to the servant. 00086 virtual void dispatch_i(); 00087 00088 /// Cancel the request. 00089 virtual void cancel_i(); 00090 00091 00092 private: 00093 00094 /// Helper used to block and unblock the thread that invokes our 00095 /// wait() method. 00096 TP_Synch_Helper synch_helper_; 00097 }; 00098 00099 } 00100 } 00101 00102 TAO_END_VERSIONED_NAMESPACE_DECL 00103 00104 #if defined (__ACE_INLINE__) 00105 # include "tao/CSD_ThreadPool/CSD_TP_Collocated_Synch_With_Server_Request.inl" 00106 #endif /* __ACE_INLINE__ */ 00107 00108 #include /**/ "ace/post.h" 00109 00110 #endif /* TAO_CSD_TP_COLLOCATED_SYNCH_WITH_SERVER_REQUEST_H */