blob: 50096e1a4500622de6170c6015400105f08ece32 (
plain)
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
|
#include "orbsvcs/Log/Log_Compaction_Handler.h"
#include "orbsvcs/Log/Log_i.h"
#include "ace/Reactor.h"
TAO_BEGIN_VERSIONED_NAMESPACE_DECL
TAO_Log_Compaction_Handler::TAO_Log_Compaction_Handler (ACE_Reactor* reactor,
TAO_Log_i* log,
const ACE_Time_Value& interval)
: timer_id_(-1),
reactor_(reactor),
log_(log),
interval_(interval)
{
}
TAO_Log_Compaction_Handler::~TAO_Log_Compaction_Handler ()
{
this->cancel ();
}
void
TAO_Log_Compaction_Handler::schedule ()
{
this->cancel ();
this->timer_id_ =
this->reactor_->schedule_timer (this, 0, this->interval_, this->interval_);
}
void
TAO_Log_Compaction_Handler::cancel ()
{
if (this->timer_id_ != -1)
{
this->reactor_->cancel_timer (timer_id_);
this->timer_id_ = -1;
}
}
int
TAO_Log_Compaction_Handler::handle_timeout (const ACE_Time_Value&,
const void *)
{
try
{
this->log_->remove_old_records();
}
catch (const CORBA::Exception&)
{
}
return 0;
}
TAO_END_VERSIONED_NAMESPACE_DECL
|