summaryrefslogtreecommitdiff
path: root/trunk/TAO/tests/Big_Request_Muxing/Client_Task.h
blob: 408d7458438d144e77d1d302e4a00df8e470efde (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
//
// $Id$
//

#ifndef BIG_REQUEST_MUXING_CLIENT_TASK_H
#define BIG_REQUEST_MUXING_CLIENT_TASK_H
#include /**/ "ace/pre.h"

#include "TestC.h"
#include "tao/Messaging/Messaging.h"
#include "ace/Task.h"
#include "ace/SString.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

/// Implement a Task to run the experiments using multiple threads.
class Client_Task : public ACE_Task_Base
{
public:
  /// Constructor
  Client_Task (ACE_Thread_Manager *thr_mgr,
               Test::Payload_Receiver_ptr receiver,
               CORBA::Long event_count,
               CORBA::ULong event_size,
               CORBA::ORB_ptr orb,
               Messaging::SyncScope sync_scope,
               const ACE_CString& ident);

  /// Thread entry point
  int svc (void);

  bool done(void) const;

private:
  /// Make sure that all threads have connections available to
  /// workaround bug 189
  void validate_connection (void);

  void do_invocations(Test::Payload& payload);
  void do_sync_none_invocations(Test::Payload& payload);

private:
  /// Reference to the test interface
  Test::Payload_Receiver_var payload_receiver_;

  /// Total number of events
  CORBA::Long event_count_;

  /// Size of each message
  CORBA::ULong event_size_;

  /// Keep a reference to the ORB, used to initialize the SyncScope
  /// policy
  CORBA::ORB_var orb_;

  /// The SyncScope used in this Task
  Messaging::SyncScope sync_scope_;

  bool done_;

  ACE_CString id_;
};

#include /**/ "ace/post.h"
#endif /* BIG_REQUEST_MUXING_CLIENT_TASK_H */