summaryrefslogtreecommitdiff
path: root/TAO/tao/Wait_Strategy.h
blob: ecbe7fe21052ad589841f0f8c1894147e642d68b (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
87
88
89
// This may look like C, but it's really -*- C++ -*-
// $Id$

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

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

#include "tao/corbafwd.h"

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

class TAO_ORB_Core;
class TAO_Transport;

class TAO_Export TAO_Wait_Strategy
{
  // = TITLE
  //
  //    Strategy for waiting for the reply.
  //
  // = DESCRIPTION
  //

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

  virtual ~TAO_Wait_Strategy (void);
  // Destructor.

  virtual int sending_request (TAO_ORB_Core *orb_core,
                               int two_way);
  // The user is going to send a request, prepare any internal
  // variables because the reply may arrive *before* the user calls
  // wait.

  virtual int wait (ACE_Time_Value *max_wait_time,
                    int &reply_received) = 0;
  // Base class virtual method. Wait till the <reply_received> flag is
  // true or the time expires.

  virtual int register_handler (void) = 0;
  // Register the handler with the Reactor if it makes sense for the
  // strategy.

  virtual ACE_SYNCH_CONDITION *leader_follower_condition_variable (void);
  // Return the TSS leader follower condition variable used in the
  // Wait Strategy. Muxed Leader Follower implementation returns a
  // valid condition variable, others return 0.
  // The condition variable is acquired by the Reply_Dispatcher (when
  // needed) in the thread that binds it to the right Transport.
  // Later (when the reply is finally received) the Reply_Dispatcher
  // passes this condition variable back to Waiting_Strategy, that can
  // then signal the waiting thread if needed.

  virtual int reply_dispatched (int &reply_received_flag,
                                ACE_SYNCH_CONDITION *);
  // This is the callback used by the Reply_Dispatcher to inform the
  // Waiting_Strategy that a reply has been completely received, that
  // it was already stored in the right place, and that the condition
  // variable should be signalled if needed.
  // The Waiting_Strategy must set the reply received flag, using
  // whatever locks it needs.

  virtual void connection_closed (int &reply_received_flag,
                                  ACE_SYNCH_CONDITION*);
  // The connection has been closed by the lower level components in
  // the ORB.
  // The wait has finished and must result in an error.

protected:
  TAO_Transport *transport_;
  // Transport object.
};

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