blob: 25f130a55453419f653a172ccb41241051859095 (
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
|
#include "Client_Task.h"
Client_Task::Client_Task (Test::Sender_ptr sender,
CORBA::Long event_count,
CORBA::ULong event_size,
ACE_Thread_Manager *thr_mgr)
: ACE_Task_Base (thr_mgr)
, sender_ (Test::Sender::_duplicate (sender))
, event_count_ (event_count)
, event_size_ (event_size)
{
}
int
Client_Task::svc (void)
{
ACE_DEBUG ((LM_DEBUG, "(%P|%t) Starting client task\n"));
try
{
this->validate_connections ();
for (int i = 0; i != this->event_count_; ++i)
{
#if 0
if (i%100 == 0)
ACE_DEBUG ((LM_DEBUG,
"(%P|%t) In iteration [%d] ....\n",
i));
#endif /*if 0*/
Test::Payload_var pl;
this->sender_->get_data (this->event_size_, pl.out ());
}
}
catch (const CORBA::Exception&)
{
return -1;
}
ACE_DEBUG ((LM_DEBUG, "(%P|%t) Client task finished\n"));
return 0;
}
void
Client_Task::validate_connections (void)
{
for (int i = 0 ; i != 100; i++)
{
try
{
this->sender_->ping ();
}
catch (const CORBA::Exception&){}
}
}
|