Go to the documentation of this file.00001
00002 #include "Validate_Client_Task.h"
00003
00004 ACE_RCSID(Notify, Validate_Client_Task, "$Id: Validate_Client_Task.cpp 84703 2009-03-04 03:01:13Z mesnier_p $")
00005
00006 #include "EventChannelFactory.h"
00007 #include "tao/ORB_Core.h"
00008 #include "tao/debug.h"
00009 #include "ace/Reactor.h"
00010
00011
00012 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00013
00014 TAO_Notify_validate_client_Task::
00015 TAO_Notify_validate_client_Task (const ACE_Time_Value &delay,
00016 const ACE_Time_Value &interval,
00017 TAO_Notify_EventChannelFactory *ecf)
00018 : delay_ (delay),
00019 interval_ (interval),
00020 ecf_ (ecf),
00021 shutdown_ (false)
00022 {
00023 if (this->activate (THR_NEW_LWP | THR_JOINABLE, 1) == -1)
00024 {
00025 ACE_ERROR ((LM_ERROR,
00026 ACE_TEXT("(%P|%t)TAO_Notify_validate_client_Task: %p\n"),"activate"));
00027 }
00028 }
00029
00030
00031 TAO_Notify_validate_client_Task::~TAO_Notify_validate_client_Task (void)
00032 {
00033 }
00034
00035
00036 int
00037 TAO_Notify_validate_client_Task::svc (void)
00038 {
00039 ACE_Time_Value due = ACE_OS::gettimeofday () + this->delay_;
00040 while (! this->shutdown_)
00041 {
00042 {
00043 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, *(this->condition_.mutex()), -1);
00044 this->condition_.wait (&due);
00045 }
00046
00047 if (this->shutdown_)
00048 break;
00049
00050 try
00051 {
00052 if (TAO_debug_level > 0)
00053 {
00054 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%P|%t)%T TAO_Notify_validate_client_Task::svc validate start\n")));
00055 }
00056 this->ecf_->validate ();
00057 if (TAO_debug_level > 0)
00058 {
00059 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("%P|%t)%T TAO_Notify_validate_client_Task::svc validate end\n")));
00060 }
00061 }
00062 catch (...)
00063 {
00064
00065 }
00066
00067 if (this->interval_ == ACE_Time_Value::zero)
00068 break;
00069
00070 due = ACE_OS::gettimeofday () + this->interval_;
00071 }
00072
00073 return 0;
00074 }
00075
00076
00077 void
00078 TAO_Notify_validate_client_Task::shutdown (void)
00079 {
00080 {
00081 ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, *(this->condition_.mutex()));
00082 this->shutdown_ = true;
00083 this->condition_.signal ();
00084 }
00085 this->wait ();
00086 }
00087
00088 TAO_END_VERSIONED_NAMESPACE_DECL