3 //=============================================================================
5 * @file Connect_Strategy.h
7 * @author Balachandran Natarajan <bala@cs.wustl.edu>
9 //=============================================================================
11 #ifndef TAO_CONNECT_STRATEGY_H
12 #define TAO_CONNECT_STRATEGY_H
14 #include /**/ "ace/pre.h"
16 #include /**/ "tao/TAO_Export.h"
18 #if !defined (ACE_LACKS_PRAGMA_ONCE)
20 #endif /* ACE_LACKS_PRAGMA_ONCE */
22 #include /**/ "tao/Versioned_Namespace.h"
24 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
25 class ACE_Synch_Options
;
27 ACE_END_VERSIONED_NAMESPACE_DECL
29 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
33 class TAO_Connection_Handler
;
35 class TAO_LF_Multi_Event
;
39 * @class TAO_Connect_Strategy
41 * @brief Define the interface for the connect strategy, i.e. the
42 * algorithm that controls how does the ORB establishes remote
45 * The thread that establishes remote connections can either make a
46 * blocking or a non-blocking connect. The strategy to wait for the
47 * connection completion can also be different.
49 * This strategy controls how does the ORB schedules and waits for
50 * connection completion.
53 class TAO_Export TAO_Connect_Strategy
57 TAO_Connect_Strategy (TAO_ORB_Core
*orb
);
60 virtual ~TAO_Connect_Strategy () = default;
62 /// Obtain the synch options that can be passed to ACE_Connector
64 * Return the synch option for the connector, based on the timeout
65 * and the strategy in place. ACE_Connectors behavior can be altered
66 * by passing the right ACE_Synch_Options to the connect () call.
68 virtual void synch_options (ACE_Time_Value
*val
,
69 ACE_Synch_Options
&opt
) = 0;
71 /// Wait for the connection to be completed till a timeout occurs.
73 * If the connection establishment fails the state within the
74 * connection handler is set appropriately.
76 int wait (TAO_Connection_Handler
*ch
, ACE_Time_Value
*val
);
78 int wait (TAO_Transport
*t
, ACE_Time_Value
*val
);
80 /// Wait for one of many connections to complete. Returns when one
81 /// succeeds or all fail.
82 int wait (TAO_LF_Multi_Event
*ev
, ACE_Time_Value
*val
);
84 /// Do a quick check to see if any connections are complete. This
85 /// does the same as the wait with an explicit time value of 0.
86 int poll (TAO_LF_Multi_Event
*ev
);
89 /// This is the method that does all the real interesting stuff.
90 virtual int wait_i (TAO_LF_Event
*ev
,
92 ACE_Time_Value
*val
) = 0;
94 /// Cached copy of the ORB core pointer
95 TAO_ORB_Core
* const orb_core_
;
98 TAO_END_VERSIONED_NAMESPACE_DECL
100 #include /**/ "ace/post.h"
101 #endif /*TAO_CONNECT_STRATEGY_H*/