summaryrefslogtreecommitdiff
path: root/TAO/tests/CSD_Strategy_Tests/TP_Foo_C/Foo_C_cust_op3.cpp
blob: b6bfad9dc67ccc6983a62c2cd671189dcc6695c7 (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
// $Id$
#include "Foo_C_cust_op3.h"
#include "Foo_C_i.h"
#include "CancelledExceptionC.h"


Foo_C_cust_op3::Foo_C_cust_op3(Foo_C_i* servant, long arg)
  : TAO::CSD::TP_Custom_Request_Operation(servant),
    arg_(arg),
    result_(0),
    cancelled_(false),
    servant_(servant)
{
  // This try-catch block is not really necessary, but we have to add it to  
  // satisfy the non-exception builds. Since there is actually no exception 
  // raised from _add_ref, we just ignore the exception here.
  ACE_TRY_NEW_ENV
  {
    servant_->_add_ref (ACE_ENV_SINGLE_ARG_PARAMETER);
    ACE_TRY_CHECK;
  }
  ACE_CATCHALL
  {
  }
  ACE_ENDTRY;
}


Foo_C_cust_op3::~Foo_C_cust_op3()
{
  // This try-catch block is not really necessary, but we have to add it to  
  // satisfy the non-exception builds. Since there is actually no exception 
  // raised from _add_ref, we just ignore the exception here.
  ACE_TRY_NEW_ENV
  {
    servant_->_remove_ref (ACE_ENV_SINGLE_ARG_PARAMETER);
    ACE_TRY_CHECK;
  }
  ACE_CATCHALL
  {
  }
  ACE_ENDTRY;
}


long
Foo_C_cust_op3::result(ACE_ENV_SINGLE_ARG_DECL)
{
  if (this->cancelled_)
    {
      ACE_THROW_RETURN (CancelledException(), -1);
    }

  return this->result_;
}


void
Foo_C_cust_op3::execute_i()
{
  this->result_ = this->servant_->cust_op3(this->arg_);
}


void
Foo_C_cust_op3::cancel_i()
{
  this->cancelled_ = true;
}