00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file CSD_TP_Collocated_Synch_Request.h 00006 * 00007 * $Id: CSD_TP_Collocated_Synch_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_REQUEST_H 00014 #define TAO_CSD_TP_COLLOCATED_SYNCH_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 #include "tao/Exception.h" 00027 00028 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00029 00030 namespace TAO 00031 { 00032 namespace CSD 00033 { 00034 00035 class TP_Collocated_Synch_Request; 00036 typedef TAO_Intrusive_Ref_Count_Handle<TP_Collocated_Synch_Request> 00037 TP_Collocated_Synch_Request_Handle; 00038 00039 /** 00040 * @class TP_Collocated_Synch_Request 00041 * 00042 * @brief Represents a "queue-able", synchronous, collocated, 00043 * CORBA request. 00044 * 00045 * This kind request is the two-way or oneway(with SYNC_WITH_TARGET 00046 * policy applied) collocated request. It is NOT cloned before 00047 * enqueuing and the "enqueuing" thread will block until the request 00048 * is dispatched/handled or cancelled. 00049 */ 00050 class TAO_CSD_TP_Export TP_Collocated_Synch_Request 00051 : public TP_Corba_Request 00052 { 00053 public: 00054 00055 /// Constructor. 00056 TP_Collocated_Synch_Request 00057 (TAO_ServerRequest& server_request, 00058 const PortableServer::ObjectId& object_id, 00059 PortableServer::POA_ptr poa, 00060 const char* operation, 00061 PortableServer::Servant servant, 00062 TP_Servant_State* servant_state); 00063 00064 /// Virtual Destructor. 00065 virtual ~TP_Collocated_Synch_Request(); 00066 00067 /// Wait until the request has been dispatched (and completed), or 00068 /// until it has been cancelled. 00069 /// Returns true if the request has been dispatched, and returns 00070 /// false if the request has been cancelled. 00071 bool wait(void); 00072 00073 00074 protected: 00075 00076 /// Note that we do not override our base class implementation of 00077 /// prepare_for_queue_i() (which does nothing), because we don't 00078 /// need to clone the Server Request object. 00079 00080 /// Dispatch the request to the servant. 00081 virtual void dispatch_i(); 00082 00083 /// Cancel the request. 00084 virtual void cancel_i(); 00085 00086 00087 private: 00088 00089 /// Helper used to block and unblock the thread that invokes our 00090 /// wait() method. 00091 TP_Synch_Helper synch_helper_; 00092 00093 /// Set to NULL initially, and will only be set thereafter if an 00094 /// exception is raised from the dispatch() call on the server_request_. 00095 CORBA::Exception* exception_; 00096 }; 00097 00098 } 00099 } 00100 00101 TAO_END_VERSIONED_NAMESPACE_DECL 00102 00103 #if defined (__ACE_INLINE__) 00104 # include "tao/CSD_ThreadPool/CSD_TP_Collocated_Synch_Request.inl" 00105 #endif /* __ACE_INLINE__ */ 00106 00107 #include /**/ "ace/post.h" 00108 00109 #endif /* TAO_CSD_TP_COLLOCATED_SYNCH_REQUEST_H */