2 * @file Server_Timer.cpp
4 * @author Carlos O'Ryan <coryan@atdesk.com>
6 #include "Server_Timer.h"
7 #include "ace/Reactor.h"
8 #include "ace/OS_NS_string.h"
10 Server_Timer::Server_Timer(Test::Echo_ptr echo
,
11 ACE_Reactor
* reactor
)
12 : ACE_Event_Handler (reactor
)
13 , echo_(Test::Echo::_duplicate(echo
))
15 this->reference_counting_policy ().value (
16 ACE_Event_Handler::Reference_Counting_Policy::ENABLED
);
20 Server_Timer::activate ()
22 ACE_Time_Value
tv (0, 20000);
23 this->reactor()->schedule_timer (this, 0, tv
, tv
);
27 Server_Timer::handle_timeout (ACE_Time_Value
const &, void const *)
29 Test::Payload
pload (1024);
32 ACE_OS::memset (pload
.get_buffer(), 0, pload
.length());
36 if(CORBA::is_nil (this->echo_
.in ()))
40 Test::Echo::_duplicate (this->echo_
.in ());
42 echo
->echo_payload (pload
);
44 catch (const CORBA::Exception
&)
46 this->echo_
= Test::Echo::_nil ();
47 this->reactor ()->cancel_timer (this);