Revert "Minor modernization of DynamicAny code"
[ACE_TAO.git] / TAO / tests / MT_Timeout / Client_Task.h
blob7bc86ce3050539ec9f8e096745b9f1135f04ebec
2 #ifndef MT_TIMEOUT_CLIENT_TASK_H
3 #define MT_TIMEOUT_CLIENT_TASK_H
4 #include /**/ "ace/pre.h"
6 #include "TestC.h"
7 #include "ace/Task.h"
9 #if !defined (ACE_LACKS_PRAGMA_ONCE)
10 # 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
16 public:
17 /// Constructor
18 /**
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
25 * interface
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
30 * microseconds
31 * @param timeout The timeout set for the thread
34 Client_Task (CORBA::ORB_ptr orb,
35 Test::Sleep_Service_ptr sleep_service,
36 int iterations,
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
51 int svc ();
53 private:
54 /// Run one iteration of the test
55 int one_iteration ();
57 /// Make sure that the thread has a connection available
58 void validate_connection ();
60 private:
61 /// A reference to the ORB
62 CORBA::ORB_var orb_;
64 /// Reference to the test interface
65 Test::Sleep_Service_var sleep_service_;
67 /// Total number of processes created by each thread
68 int iterations_;
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
80 int timed_out_calls_;
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 */