Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / TAO / orbsvcs / Fault_Detector / Fault_Detector_i.h
blob544fa7283093760d8592d93ad80764110e1f2298
1 /* -*- C++ -*- */
2 //=============================================================================
3 /**
4 * @file Fault_Detector_i.h
6 * This file is part of Fault Tolerant CORBA.
7 * This file declares the Fault_Detector_i class.
8 * The class implements the FaultDetectors as defined
9 * in the specification.
10 * A FaultDetector monitors the health of replicas.
11 * It is *NOT* a CORBA object and does not implement an IDL interface.
12 * All CORBA interaction with a FaultDetector is via a FaultDetectorFactory.
14 * @author Dale Wilson <wilson_d@ociweb.com>
16 //=============================================================================
19 #ifndef FAULT_DETECTOR_I_H_
20 #define FAULT_DETECTOR_I_H_
21 #include /**/ <ace/pre.h>
22 #include <ace/ACE.h>
23 #if !defined (ACE_LACKS_PRAGMA_ONCE)
24 # pragma once
25 #endif /* ACE_LACKS_PRAGMA_ONCE */
27 #include <ace/Manual_Event.h>
30 #include "orbsvcs/FT_NotifierC.h"
31 #include "orbsvcs/FT_ReplicaC.h"
32 #include "ace/Time_Value.h"
34 // Classes declared in this header
35 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
37 namespace TAO
39 //////////////////////
40 // Forward references
42 class FT_FaultDetectorFactory_i;
44 //////////////////////
45 // Class declarations
47 class Fault_Detector_i
49 ///////////////////
50 // Public interface
51 public:
52 /**
53 * Construct FaultDetector.
54 * @param factory to be notified when this detector goes away.
55 * @param id to use when notifyting the factory of detector departure.
56 * @param notifier to receive the fault notification if our monitorable faults.
57 * @param monitorable object to be monitored.
58 * @param domain_id data to include in fault notification.
59 * @param object_location data to include in fault notification.
60 * @param object_type data to include in fault notification.
61 * @param group_id data to include in fault notification.
63 Fault_Detector_i (
64 FT_FaultDetectorFactory_i & factory,
65 CORBA::ULong id,
66 FT::FaultNotifier_ptr & notifier,
67 FT::PullMonitorable_ptr & monitorable,
68 FT::FTDomainId domain_id,
69 const PortableGroup::Location & object_location,
70 PortableGroup::TypeId object_type,
71 PortableGroup::ObjectGroupId group_id);
72 /**
73 * destructor.
74 * Non-virtual because this class does not take part in
75 * inheritence.
77 ~Fault_Detector_i ();
79 /**
80 * Start the thread associated with this fault detector.
81 * @param threadManager to track this thread.
83 void start(ACE_Thread_Manager & threadManager);
85 /**
86 * Request that this detector shut itself down.
88 void request_quit();
90 ////////////////////////
91 // Static public methods
92 public:
93 /**
94 * Set the polling time for all FaultDetectors in this process.
95 * @param value the time between polls.
97 static void set_time_for_all_detectors (ACE_Time_Value value);
99 /////////////////////////
100 // implementation methods
101 private:
103 * Send the notification message.
105 void notify();
108 * The method to be run in the fault detector thread.
110 void run();
113 * The startup function for the fault detector thread.
115 static ACE_THR_FUNC_RETURN thr_func (void * arg);
117 ////////////////////
118 // Forbidden methods
119 private:
120 Fault_Detector_i ();
121 Fault_Detector_i (Fault_Detector_i & rhs);
122 Fault_Detector_i & operator = (const Fault_Detector_i & rhs);
124 ///////////////
125 // Static data
126 private:
128 * Time between polls for all fault detectors in this process.
130 static ACE_Time_Value sleep_time_;
132 ///////////////
133 // Data members
134 private:
136 * The factory that "owns" us."
138 FT_FaultDetectorFactory_i & factory_;
141 * How the factory knows who we are.
143 CORBA::ULong id_;
146 * Where to send fault notification messages.
148 FT::FaultNotifier_var notifier_;
151 * What to monitor.
153 FT::PullMonitorable_var monitorable_;
156 * Data for the notification message.
158 FT::FTDomainId domain_id_;
159 PortableGroup::Location object_location_;
160 PortableGroup::TypeId object_type_;
161 PortableGroup::ObjectGroupId group_id_;
164 * An Event (in the Win32 sense) to implement interruptable sleep.
165 * Manual rather than auto because once quit is requested we never
166 * want to sleep again.
168 ACE_Manual_Event sleep_;
171 * A boolean flag. If true, this fault detector should leave.
173 int quit_requested_;
175 } // namespace TAO
177 TAO_END_VERSIONED_NAMESPACE_DECL
179 #include /**/ <ace/post.h>
180 #endif // FAULT_DETECTOR_I_H_