Merge pull request #2216 from jwillemsen/jwi-cxxversionchecks
[ACE_TAO.git] / TAO / tao / Invocation_Retry_State.h
blobffb26c0d0cc5c124c7e1eadbe654198fbc7c9c46
1 /* -*- C++ -*- */
2 //=============================================================================
3 /**
4 * @file Invocation_Retry_State.h
6 * @author Byron Harris (harrisb@ociweb.com)
7 */
8 //=============================================================================
10 #ifndef TAO_INVOCATION_RETRY_STATE_H
11 #define TAO_INVOCATION_RETRY_STATE_H
13 #include "tao/Stub.h"
14 #include "tao/Invocation_Retry_Params.h"
16 #include "ace/Array_Map.h"
18 #if !defined (ACE_LACKS_PRAGMA_ONCE)
19 # pragma once
20 #endif /* ACE_LACKS_PRAGMA_ONCE */
22 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
24 namespace TAO
26 /**
27 * @class Invocation_Retry_State
29 * @brief Maintains state of invocation retries.
31 class Invocation_Retry_State
33 public:
34 Invocation_Retry_State (TAO_Stub &stub);
36 ~Invocation_Retry_State ();
38 /**
39 * Answer if any profile forward on exception limit
40 * parameter is used.
42 bool forward_on_exception_limit_used () const;
44 /**
45 * Attempt to increment the count of profile
46 * forwards.
47 * @return false if forward on exception is not
48 * being used or the limit has been reached.
50 bool forward_on_exception_increment (const int ef);
52 /**
53 * Attempt to increment the count of retries
54 * when a server connection is seen as closed
55 * during reply.
57 bool forward_on_reply_closed_increment ();
59 /**
60 * Increment to next profile in preparation
61 * to retry using that profile.
62 * If the next profile is the starting
63 * base profile then also call
64 * sleep ().
65 * @see TAO_Stub::next_profile_retry()
67 void next_profile_retry (TAO_Stub &stub) const;
69 /**
70 * Sleep if profile is the starting
71 * base profile.
73 void sleep_at_starting_profile (TAO_Stub &stub) const;
75 /**
76 * Sleep according to the delay value
77 * in Invocation_Retry_Params.
79 void sleep () const;
81 private:
82 typedef ACE_Array_Map<int, int> Ex_Count_Map;
83 Ex_Count_Map ex_count_map_;
84 int forward_on_reply_closed_count_;
85 Invocation_Retry_Params retry_params_;
86 bool forward_on_exception_limit_used_;
90 TAO_END_VERSIONED_NAMESPACE_DECL
92 #endif /* TAO_INVOCATION_RETRY_STATE_H*/