00001 // $Id: CSD_TP_Dispatchable_Visitor.cpp 71473 2006-03-10 07:19:20Z jtc $ 00002 00003 #include "tao/CSD_ThreadPool/CSD_TP_Dispatchable_Visitor.h" 00004 00005 ACE_RCSID (CSD_TP, 00006 Dispatchable_Visitor, 00007 "$Id: CSD_TP_Dispatchable_Visitor.cpp 71473 2006-03-10 07:19:20Z jtc $") 00008 00009 #if !defined (__ACE_INLINE__) 00010 # include "tao/CSD_ThreadPool/CSD_TP_Dispatchable_Visitor.inl" 00011 #endif /* ! __ACE_INLINE__ */ 00012 00013 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00014 00015 TAO::CSD::TP_Dispatchable_Visitor::~TP_Dispatchable_Visitor() 00016 { 00017 } 00018 00019 00020 bool 00021 TAO::CSD::TP_Dispatchable_Visitor::visit_request(TP_Request* request, 00022 bool& remove_flag) 00023 { 00024 // Ask the request object if the target servant is "ready" to accept 00025 // a request being dispatched to it. 00026 if (request->is_ready()) 00027 { 00028 // Ok. This request is a "dispatchable" request. It is what we were 00029 // hoping to find. 00030 00031 // Save a copy of the request in our handle data member. 00032 request->_add_ref(); 00033 this->request_ = request; 00034 00035 // Make sure that the queue will extract the request from the queue 00036 // upon our return. 00037 remove_flag = true; 00038 00039 // Mark the target servant as being "busy". 00040 request->mark_as_busy(); 00041 00042 // Stop the visitation by returning false. 00043 return false; 00044 } 00045 00046 // The target servant object of the request isn't ready, so the request 00047 // is not considered to be a "dispatchable" request. 00048 00049 // Return true to visit the next request in the queue (if there is one). 00050 return true; 00051 } 00052 00053 TAO_END_VERSIONED_NAMESPACE_DECL