summaryrefslogtreecommitdiff
path: root/TAO/tests/Multiple_Retry_Tests/Retry_On_Reply_Failure/test_i.cpp
blob: 042b552b16d92cbd626b79ea783af5b52c74b05c (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
// $Id$

#include "test_i.h"
#include "tao/Invocation_Utils.h"

extern int raise_exception;

Simple_Server_i::Simple_Server_i (CORBA::ORB_ptr orb, int num_exceptions_to_throw)
  : orb_ (CORBA::ORB::_duplicate (orb))
  , num_exceptions_to_throw_(num_exceptions_to_throw)
  , num_exceptions_thrown_(0)
  , raise_exception_ (TAO::FOE_NON)
{
}

CORBA::Boolean
Simple_Server_i::test_is_a (const char * /* type */)
{
  if (this->num_exceptions_thrown_ ==
      this->num_exceptions_to_throw_)
    return 0;

  if ((raise_exception & TAO::FOE_OBJECT_NOT_EXIST) == TAO::FOE_OBJECT_NOT_EXIST)
  {
    //ACE_DEBUG ((LM_DEBUG, "(%P|%t) test_is_a called and raise OBJECT_NOT_EXIST\n"));
    ++this->num_exceptions_thrown_;
    throw ::CORBA::OBJECT_NOT_EXIST (CORBA::OMGVMCID | 1, CORBA::COMPLETED_NO);
  }

  if ((raise_exception & TAO::FOE_COMM_FAILURE) == TAO::FOE_COMM_FAILURE)
  {
    //ACE_DEBUG ((LM_DEBUG, "(%P|%t) test_is_a called and raise COMM_FAILURE\n"));
    ++this->num_exceptions_thrown_;
    throw ::CORBA::COMM_FAILURE (CORBA::OMGVMCID | 1, CORBA::COMPLETED_NO);
  }

  if ((raise_exception & TAO::FOE_TRANSIENT) == TAO::FOE_TRANSIENT)
  {
    //ACE_DEBUG ((LM_DEBUG, "(%P|%t) \t called and raise TRANSIENT\n"));
    ++this->num_exceptions_thrown_;
    throw ::CORBA::TRANSIENT (CORBA::OMGVMCID | 1, CORBA::COMPLETED_NO);
  }

  if ((raise_exception & TAO::FOE_INV_OBJREF) == TAO::FOE_INV_OBJREF)
  {
    //ACE_DEBUG ((LM_DEBUG, "(%P|%t) test_is_a called %d and raise INV_OBJREF\n", ncalls_));
    ++this->num_exceptions_thrown_;
    throw ::CORBA::INV_OBJREF (CORBA::OMGVMCID | 1, CORBA::COMPLETED_NO);
  }

  return 0;
}

void
Simple_Server_i::shutdown (void)
{
  this->orb_->shutdown (0);
}