summaryrefslogtreecommitdiff
path: root/TAO/tao/Wait_On_Leader_Follower.cpp
blob: 87f7bd6a8bb5d1beb39483d779d2693fc9b686c3 (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
// $Id$

#include "tao/Wait_On_Leader_Follower.h"
#include "tao/LF_Follower.h"
#include "tao/Leader_Follower.h"
#include "tao/Transport.h"
#include "tao/Synch_Reply_Dispatcher.h"
#include "tao/ORB_Core.h"

ACE_RCSID (tao,
           Wait_On_Leader_Follower,
           "$Id$")

TAO_BEGIN_VERSIONED_NAMESPACE_DECL

TAO_Wait_On_Leader_Follower::TAO_Wait_On_Leader_Follower (TAO_Transport *transport)
  : TAO_Wait_Strategy (transport)
{
}

TAO_Wait_On_Leader_Follower::~TAO_Wait_On_Leader_Follower (void)
{
}

/*
 * Hook to specialize the wait strategy when the concrete strategy is
 * a simple "lf" strategy. Add all public/protected/private methods
 * within the *COPY* hooks.
 */

//@@ WAIT_STRATEGY_SPL_COPY_HOOK_START

int
TAO_Wait_On_Leader_Follower::register_handler (void)
{
  if (!this->is_registered_)
    {
      return this->transport_->register_handler ();
    }

  return 1;
}

bool
TAO_Wait_On_Leader_Follower::non_blocking (void) const
{
  return true;
}

int
TAO_Wait_On_Leader_Follower::sending_request (TAO_ORB_Core *orb_core,
                                              int two_way)
{
  // Register the handler.
  if (!this->is_registered_)
    {
      this->transport_->register_handler ();
    }

  // Send the request.
//@@ LF_WAIT_STRATEGY_SPL_COMMENT_HOOK_START
  return this->TAO_Wait_Strategy::sending_request (orb_core,
                                                   two_way);
//@@ LF_WAIT_STRATEGY_SPL_COMMENT_HOOK_END
}

int
TAO_Wait_On_Leader_Follower::wait (ACE_Time_Value *max_wait_time,
                                   TAO_Synch_Reply_Dispatcher &rd)
{
  TAO_Leader_Follower& leader_follower =
    this->transport_->orb_core ()->leader_follower ();
  return leader_follower.wait_for_event (&rd,
                                         this->transport_,
                                         max_wait_time);
}

bool
TAO_Wait_On_Leader_Follower::can_process_upcalls (void) const
{
  return true;
}

//@@ WAIT_STRATEGY_SPL_COPY_HOOK_END
/*
 * End copy hook.
 */

TAO_END_VERSIONED_NAMESPACE_DECL