summaryrefslogtreecommitdiff
path: root/TAO/tao/Strategies/Optimized_Connection_Endpoint_Selector.h
blob: ddff6b17932f851fdb1a1666d824d155f9a12ece (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
//=============================================================================
/**
 *  @file   Optimized_Connection_Endpoint_Selector.h
 *
 * Strategies for selecting profile/endpoint from an IOR for making an
 * invocation.
 *
 *  @author Phil Mesnier <mesnier_p@ociweb.com>
 */
//=============================================================================

#ifndef TAO_OPTIMIZED_CONNECTION_ENDPOINT_SELECTOR_H
#define TAO_OPTIMIZED_CONNECTION_ENDPOINT_SELECTOR_H

#include /**/ "ace/pre.h"

#include "tao/corbafwd.h"

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

#include "tao/Strategies/strategies_export.h"

#include "tao/Invocation_Endpoint_Selectors.h"
#include "ace/Time_Value.h"

TAO_BEGIN_VERSIONED_NAMESPACE_DECL

class TAO_GIOP_Invocation;
class TAO_ORB_Core;
class TAO_Stub;
class TAO_Profile;

/**
 * @class TAO_Optimized_Connection_Endpoint_Selector
 *
 * @brief More efficient connection strategy for endpoint selection.
 *
 * This strategy builds on the default by first querying the connection
 * cache for all potential endpoints before iterating over the list to
 * attempt to create new connections.
 */

class TAO_Strategies_Export TAO_Optimized_Connection_Endpoint_Selector
 : public TAO_Default_Endpoint_Selector
{
public:
  /// Constructor.
  TAO_Optimized_Connection_Endpoint_Selector (const ACE_Time_Value& tv);

  /// Destructor.
  virtual ~TAO_Optimized_Connection_Endpoint_Selector (void);

  static void hook (TAO_ORB_Core *,
                    TAO_Stub *,
                    bool &has_timeout,
                    ACE_Time_Value &tv);

  virtual void select_endpoint (TAO::Profile_Transport_Resolver *,
                                ACE_Time_Value *max_wait_time);
private:

  int check_profile (TAO_Profile *,
                     TAO::Profile_Transport_Resolver *);

  static ACE_Time_Value timeout_;
};

TAO_END_VERSIONED_NAMESPACE_DECL

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