2 #ifndef MT_TIMEOUT_CLIENT_TASK_H
3 #define MT_TIMEOUT_CLIENT_TASK_H
4 #include /**/ "ace/pre.h"
9 #if !defined (ACE_LACKS_PRAGMA_ONCE)
11 #endif /* ACE_LACKS_PRAGMA_ONCE */
13 /// Implement a Task to run the experiments using multiple threads.
14 class Client_Task
: public ACE_Task_Base
19 * Each Client_Task runs the test for a certain number of
20 * iterations, using pre-configured timeouts and sleep times.
21 * The test can be made to timeout on each request by using a
22 * timeout value smaller than the sleep time.
24 * @param orb A reference to the ORB, used to get the PolicyCurrent
26 * @param sleep_service The object reference used for this test.
27 * @param iterations Number of times the go_to_sleep() method is
28 * invoked, in microseconds
29 * @param sleep_time The sleep time passed on each test, in
31 * @param timeout The timeout set for the thread
34 Client_Task (CORBA::ORB_ptr orb
,
35 Test::Sleep_Service_ptr sleep_service
,
37 CORBA::ULong sleep_time
,
38 CORBA::ULong timeout
);
40 /// Return the total number of successful calls
41 int successful_calls () const;
43 /// Return the total number of timed out calls
44 int timed_out_calls () const;
46 /// Return the number of calls with a too huge difference in
47 /// timeout versus actual response arrival.
48 int too_big_difference_calls () const;
50 /// Thread entry point
54 /// Run one iteration of the test
57 /// Make sure that the thread has a connection available
58 void validate_connection ();
61 /// A reference to the ORB
64 /// Reference to the test interface
65 Test::Sleep_Service_var sleep_service_
;
67 /// Total number of processes created by each thread
70 /// Sleep time for each request, in microseconds
71 CORBA::ULong sleep_time_
;
73 /// Timeout period, in microseconds
74 CORBA::ULong timeout_
;
76 /// Count how many calls were successful
77 int successful_calls_
;
79 /// Count how many calls timed out
82 int too_big_difference_
;
84 /// Implement the Monitor Object Pattern.
85 TAO_SYNCH_MUTEX mutex_
;
88 #include /**/ "ace/post.h"
89 #endif /* MT_TIMEOUT_CLIENT_TASK_H */