Merge pull request #1551 from DOCGroup/plm_jira_333
[ACE_TAO.git] / TAO / examples / AMH / Sink_Server / Timer_Handler.cpp
bloba0a4d763ddb9bf0356c03836203e57a840e07e0f
1 // -*- C++ -*-
3 // =========================================================================
4 /**
5 * @file Timer_Handler.cpp
7 * @desc Fires servant upcall after a specified period of delay
9 * @author Mayur Deshpande <mayur@ics.uci.edu>
11 // =========================================================================
13 #include "Timer_Handler.h"
15 Timer_Handler::Timer_Handler (Test::AMH_RoundtripResponseHandler_ptr rh,
16 Test::Timestamp send_time)
17 : rh_ (Test::AMH_RoundtripResponseHandler::_duplicate (rh))
18 , send_time_ (send_time)
22 int
23 Timer_Handler::handle_timeout (const ACE_Time_Value &,
24 const void *)
26 try
28 this->rh_->test_method (this->send_time_);
30 catch (const CORBA::Exception& ex)
32 ex._tao_print_exception (
33 "Exception in Timer_Handler::handle_timeout\n");
34 return -1;
37 // Returning -1 calls handle_close which will clean up and
38 // deregister this handle from the reactor. DO not return anything
39 // else. I changes the return value inadvertently and it caused a
40 // memory leak. should have RTMFed this before. Took me a ****
41 // long time to figure out this memory leak, though in retrospect I
42 // should looked here first.
43 return -1;
47 int
48 Timer_Handler::handle_close (ACE_HANDLE,
49 ACE_Reactor_Mask)
51 // deregister from the reactor and destruct
53 delete this;
54 return 0;