summaryrefslogtreecommitdiff
path: root/TAO/tao/Exclusive_TMS.h
blob: 64d4ccb8f50d9817727df11a2893bc124584b499 (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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
// This may look like C, but it's really -*- C++ -*-
// $Id$

// ============================================================================
//
// = LIBRARY
//     TAO
//
// = AUTHOR
//     Alexander Babu Arulanthu <alex@cs.wustl.edu>
//
// ============================================================================

#ifndef TAO_EXCLUSIVE_TMS_H
#define TAO_EXCLUSIVE_TMS_H
#include "ace/pre.h"

#include "tao/Transport_Mux_Strategy.h"

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

#include "tao/GIOP_Message_State.h"

class TAO_Export TAO_Exclusive_TMS : public TAO_Transport_Mux_Strategy
{
  // = DESCRIPTION
  //   Using this strategy only one request can be pending at a time
  //   in a connection.  This improves performance because the client
  //   does not have to demux the reply, and there is less need for
  //   synchronization.
  //   On the other hand, it does not scale well when you have
  //   multiple client threads or asynchronous messaging.
  //

public:
  TAO_Exclusive_TMS (TAO_Transport *transport);
  // Constructor.

  virtual ~TAO_Exclusive_TMS (void);
  // Destructor.

  // = Please read the documentation in the TAO_Transport_Mux_Strategy
  //   class.
  virtual CORBA::ULong request_id (void);
  virtual int bind_dispatcher (CORBA::ULong request_id,
                               TAO_Reply_Dispatcher *rh);
  virtual void unbind_dispatcher (CORBA::ULong request_id);
  virtual int dispatch_reply (CORBA::ULong request_id,
                              CORBA::ULong reply_status,
                              const TAO_GIOP_Version& version,
                              IOP::ServiceContextList& reply_ctx,
                              TAO_GIOP_Message_State* message_state);
  virtual TAO_GIOP_Message_State *get_message_state (void);
  virtual void destroy_message_state (TAO_GIOP_Message_State *);
  virtual int idle_after_send (void);
  virtual int idle_after_reply (void);
  virtual void connection_closed (void);

protected:
  CORBA::ULong request_id_generator_;
  // Used to generate a different request_id on each call to
  // request_id().

  int has_request_;
  // If 0 then the request id and reply dispatcher below are
  // meaningless

  CORBA::ULong request_id_;
  // Request id for the current request.

  TAO_Reply_Dispatcher *rd_;
  // Reply Dispatcher corresponding to the request.

  TAO_GIOP_Message_State message_state_;
  // Message state to read the incoming message.

  // @@ Having members of type TAO_GIOP* indicates that we
  // (Transport_Mux_Strategy) are aware of the underlying messaging
  // protocol. But for the present let us close our eyes till we are
  // able to iterate on a use case - Bala.
};

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