1 #include "tao/Leader_Follower_Flushing_Strategy.h"
2 #include "tao/LF_Follower.h"
3 #include "tao/Leader_Follower.h"
4 #include "tao/Transport.h"
5 #include "tao/Queued_Message.h"
6 #include "tao/ORB_Core.h"
8 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
11 TAO_Leader_Follower_Flushing_Strategy::schedule_output (TAO_Transport
*transport
)
13 return transport
->schedule_output_i ();
17 TAO_Leader_Follower_Flushing_Strategy::cancel_output (
18 TAO_Transport
*transport
)
20 return transport
->cancel_output_i ();
24 TAO_Leader_Follower_Flushing_Strategy::flush_message (
25 TAO_Transport
*transport
,
26 TAO_Queued_Message
*msg
,
27 ACE_Time_Value
*max_wait_time
)
29 TAO_Leader_Follower
&leader_follower
=
30 transport
->orb_core ()->leader_follower ();
31 return leader_follower
.wait_for_event (msg
, transport
, max_wait_time
);
35 TAO_Leader_Follower_Flushing_Strategy::flush_transport (
36 TAO_Transport
*transport
,
37 ACE_Time_Value
*max_wait_time
)
41 TAO_ORB_Core
* const orb_core
= transport
->orb_core ();
43 while (!transport
->queue_is_empty ())
45 // In case max_wait_time==0 we cannot simply run the orb because
46 // in multi-threaded applications it can easily happen that
47 // the other thread will run the orb and drain the queue in the
48 // transport we're coping with here and this thread will block.
49 // Instead we do run for a small amount of time and then recheck
51 if (max_wait_time
== nullptr)
53 ACE_Errno_Guard
eguard (errno
);
55 // Poll the reactor's queue.
56 ACE_Time_Value tv
= ACE_Time_Value::zero
;
57 orb_core
->orb ()->perform_work (&tv
);
61 orb_core
->orb ()->perform_work (max_wait_time
);
64 if (max_wait_time
!= nullptr) {
65 if (*max_wait_time
<= ACE_Time_Value::zero
) {
72 catch (const ::CORBA::Exception
&)
80 TAO_END_VERSIONED_NAMESPACE_DECL