2 //=============================================================================
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>
23 #if !defined (ACE_LACKS_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
39 //////////////////////
42 class FT_FaultDetectorFactory_i
;
44 //////////////////////
47 class Fault_Detector_i
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.
64 FT_FaultDetectorFactory_i
& factory
,
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
);
74 * Non-virtual because this class does not take part in
80 * Start the thread associated with this fault detector.
81 * @param threadManager to track this thread.
83 void start(ACE_Thread_Manager
& threadManager
);
86 * Request that this detector shut itself down.
90 ////////////////////////
91 // Static public methods
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
103 * Send the notification message.
108 * The method to be run in the fault detector thread.
113 * The startup function for the fault detector thread.
115 static ACE_THR_FUNC_RETURN
thr_func (void * arg
);
121 Fault_Detector_i (Fault_Detector_i
& rhs
);
122 Fault_Detector_i
& operator = (const Fault_Detector_i
& rhs
);
128 * Time between polls for all fault detectors in this process.
130 static ACE_Time_Value sleep_time_
;
136 * The factory that "owns" us."
138 FT_FaultDetectorFactory_i
& factory_
;
141 * How the factory knows who we are.
146 * Where to send fault notification messages.
148 FT::FaultNotifier_var notifier_
;
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.
177 TAO_END_VERSIONED_NAMESPACE_DECL
179 #include /**/ <ace/post.h>
180 #endif // FAULT_DETECTOR_I_H_