1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
/* -*- C++ -*- $Id$ */
#include "orbsvcs/Log_Macros.h"
#include "Validate_Client_Task.h"
#include "EventChannelFactory.h"
#include "tao/ORB_Core.h"
#include "tao/debug.h"
#include "ace/Reactor.h"
TAO_BEGIN_VERSIONED_NAMESPACE_DECL
TAO_Notify_validate_client_Task::
TAO_Notify_validate_client_Task (const ACE_Time_Value &delay,
const ACE_Time_Value &interval,
TAO_Notify_EventChannelFactory *ecf)
: delay_ (delay),
interval_ (interval),
ecf_ (ecf),
shutdown_ (false)
{
if (this->activate (THR_NEW_LWP | THR_JOINABLE, 1) == -1)
{
ORBSVCS_ERROR ((LM_ERROR,
ACE_TEXT("(%P|%t)TAO_Notify_validate_client_Task: %p\n"),"activate"));
}
}
TAO_Notify_validate_client_Task::~TAO_Notify_validate_client_Task (void)
{
}
int
TAO_Notify_validate_client_Task::svc (void)
{
ACE_Time_Value due = ACE_OS::gettimeofday () + this->delay_;
while (! this->shutdown_)
{
{
ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, *(this->condition_.mutex()), -1);
this->condition_.wait (&due);
}
if (this->shutdown_)
break;
try
{
if (TAO_debug_level > 0)
{
ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("%P|%t)%T TAO_Notify_validate_client_Task::svc validate start\n")));
}
this->ecf_->validate ();
if (TAO_debug_level > 0)
{
ORBSVCS_DEBUG ((LM_DEBUG, ACE_TEXT ("%P|%t)%T TAO_Notify_validate_client_Task::svc validate end\n")));
}
}
catch (...)
{
// Ignore all exceptions
}
if (this->interval_ == ACE_Time_Value::zero)
break;
due = ACE_OS::gettimeofday () + this->interval_;
}
return 0;
}
void
TAO_Notify_validate_client_Task::shutdown (void)
{
{
ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, *(this->condition_.mutex()));
this->shutdown_ = true;
this->condition_.signal ();
}
this->wait ();
}
TAO_END_VERSIONED_NAMESPACE_DECL
|