00001 // $Id: CSD_TP_Cancel_Visitor.cpp 71473 2006-03-10 07:19:20Z jtc $ 00002 00003 #include "tao/CSD_ThreadPool/CSD_TP_Cancel_Visitor.h" 00004 #include "tao/CSD_ThreadPool/CSD_TP_Request.h" 00005 00006 ACE_RCSID (CSD_TP, 00007 Cancel_Visitor, 00008 "$Id: CSD_TP_Cancel_Visitor.cpp 71473 2006-03-10 07:19:20Z jtc $") 00009 00010 #if !defined (__ACE_INLINE__) 00011 # include "tao/CSD_ThreadPool/CSD_TP_Cancel_Visitor.inl" 00012 #endif /* ! __ACE_INLINE__ */ 00013 00014 00015 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00016 00017 TAO::CSD::TP_Cancel_Visitor::~TP_Cancel_Visitor() 00018 { 00019 } 00020 00021 00022 bool 00023 TAO::CSD::TP_Cancel_Visitor::visit_request(TP_Request* request, 00024 bool& remove_flag) 00025 { 00026 // If our servant_ data member is in the 'nil' state, then 00027 // we are supposed to cancel *ALL* requests that we visit. 00028 // 00029 // Otherwise, if our servant_ data member is not in the 'nil' state, 00030 // we are supposed to cancel only requests that target our specific 00031 // servant_. 00032 00033 if ((this->servant_.in() == 0) || (request->is_target(this->servant_.in()))) 00034 { 00035 // Set the remove_flag to true so that this request is removed 00036 // (and released) from the queue when we finish our visit. 00037 remove_flag = true; 00038 00039 // Cancel the request 00040 request->cancel(); 00041 } 00042 00043 // Since we are either cancelling requests to any servant or a 00044 // specific servant, always continue visitation. 00045 return true; 00046 } 00047 00048 TAO_END_VERSIONED_NAMESPACE_DECL