2 #include "Client_Task.h"
4 Client_Task::Client_Task (Test::Process_Factory_ptr process_factory
,
6 : process_factory_ (Test::Process_Factory::_duplicate (process_factory
))
7 , iterations_ (iterations
)
8 , successful_calls_ (0)
13 Client_Task::successful_calls () const
15 return this->successful_calls_
;
21 ACE_DEBUG ((LM_DEBUG
, "(%P|%t) Starting client task\n"));
23 int successful_calls
= 0;
27 this->validate_connection ();
29 for (int i
= 0; i
!= this->iterations_
; ++i
)
31 int retval
= this->one_iteration ();
39 "(%P|%t) - Client_Task::svc %d / %d iterations\n",
40 i
, this->iterations_
));
44 catch (const CORBA::Exception
& ex
)
46 ex
._tao_print_exception ("Exception caught:");
49 ACE_DEBUG ((LM_DEBUG
, "(%P|%t) Client task finished\n"));
51 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX
, ace_mon
, this->mutex_
, -1);
52 this->successful_calls_
+= successful_calls
;
58 Client_Task::validate_connection ()
62 for (int i
= 0; i
!= 100; ++i
)
64 (void) this->process_factory_
->noop ();
67 catch (const CORBA::TRANSIENT
& )
69 // Ignore transient exceptions
74 Client_Task::one_iteration ()
78 Test::Process_var process
=
79 this->process_factory_
->create_new_process ();
81 (void) process
->get_process_id ();
87 catch (const Test::Spawn_Failed
& )
89 // Ignore this exception, it is usually caused by a transient
92 catch (const CORBA::Exception
& ex
)
94 ex
._tao_print_exception ("Exception caught:");