summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/orbsvcs/Log/Iterator_i.cpp
blob: 139e85e262c66de5401253404d43a79f6861ad44 (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
60
61
62
63
64
65
66
67
68
69
70
#include "orbsvcs/Log/Iterator_i.h"

ACE_RCSID (Log,
           Iterator_i,
           "$Id$")


TAO_BEGIN_VERSIONED_NAMESPACE_DECL

// iterator inactivity timeout
ACE_Time_Value
TAO_Iterator_i::timeout_(60 * 60);

TAO_Iterator_i::TAO_Iterator_i (PortableServer::POA_ptr poa,
				ACE_Reactor* reactor)
  : poa_ (PortableServer::POA::_duplicate (poa)),
    reactor_ (reactor)
{
   if (this->timeout_ != ACE_Time_Value::zero) 
     {
       this->timer_id_ = 
         this->reactor_->schedule_timer (this, 0, this->timeout_);
     }
}


TAO_Iterator_i::~TAO_Iterator_i (void)
{
  // cancel timer
  if (this->timer_id_ != -1)
    {
      this->reactor_->cancel_timer (this->timer_id_); 
    }
}


void
TAO_Iterator_i::destroy (ACE_ENV_SINGLE_ARG_DECL)
  ACE_THROW_SPEC ((CORBA::SystemException))
{
  PortableServer::ObjectId_var oid =
    this->poa_->servant_to_id (this ACE_ENV_ARG_PARAMETER);
  ACE_CHECK;

  // Goodbye cruel world...
  // deactivate from the poa.
  this->poa_->deactivate_object (oid.in ()
                                 ACE_ENV_ARG_PARAMETER);
  ACE_CHECK;
  return;
}


int
TAO_Iterator_i::handle_timeout(const ACE_Time_Value&, const void*)
{
  ACE_TRY_NEW_ENV
    {
      this->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
      ACE_TRY_CHECK;
    }
  ACE_CATCHANY
    {
    }
  ACE_ENDTRY;

  return 0;
}

TAO_END_VERSIONED_NAMESPACE_DECL