blob: ea6e49c399d2b764ee30fa4467a80be762013aa8 (
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
71
72
73
74
|
// $Id$
#include "Client_Worker.h"
#include "tao/debug.h"
Client_Worker::Client_Worker (Simple_Server_ptr server,
int niterations)
: server_ (Simple_Server::_duplicate(server)),
niterations_ (niterations)
{
}
void
Client_Worker::validate_connection (ACE_ENV_SINGLE_ARG_DECL)
{
// Ping the object 100 times, ignoring all exceptions.
// It would be better to use validate_connection() but the test must
// run on minimum CORBA builds too!
for (int j = 0; j != 100; ++j)
{
ACE_TRY
{
this->server_->ping (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_TRY_CHECK;
if(TAO_debug_level > 0)
ACE_DEBUG (( LM_DEBUG,
"******** VALIDATED ******* \n"));
}
ACE_CATCHANY
{
}
ACE_ENDTRY;
}
}
int
Client_Worker::svc (void)
{
ACE_DECLARE_NEW_CORBA_ENV;
ACE_TRY
{
// Validate connections befire doing any actual work..
this->validate_connection (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_TRY_CHECK;
this->server_->validate_protocol (ACE_ENV_SINGLE_ARG_PARAMETER);
ACE_TRY_CHECK;
for (int i = 0; i < this->niterations_; ++i)
{
this->server_->test_method (i ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
if (TAO_debug_level > 0)
ACE_DEBUG ((LM_DEBUG,
" (%P|%t) iteration = %d\n",
i));
}
}
ACE_CATCHANY
{
ACE_ERROR ((LM_ERROR,
"(%P|%t) Got an exception \n"));
ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
"Client_Worker : Exception Raised");
return -1;
}
ACE_ENDTRY;
return 0;
}
|