3 //=============================================================================
7 * This class manages the synchronizing of XML files and server status
8 * shared between multiple Locators.
11 //=============================================================================
16 #include "ace/config-lite.h"
18 #if !defined (ACE_LACKS_PRAGMA_ONCE)
20 #endif /* ACE_LACKS_PRAGMA_ONCE */
22 #include "ImR_LocatorS.h"
23 #include "ace/Bound_Ptr.h"
24 #include "ace/Vector_T.h"
30 class Shared_Backing_Store
;
33 class UPN_i
: public virtual POA_ImplementationRepository::UpdatePushNotification
36 UPN_i (Replicator
&owner
);
38 /// provide the implementation for being notified of a
39 /// server or activator update
40 virtual void notify_update (CORBA::ULongLong seq_num
,
41 const ImplementationRepository::UpdateInfoSeq
& info
);
43 /// provide the implementation for registering a peer replica
44 /// @param replica the peer replica
45 /// @param ft_imr_ior the fault tolerant ImR IOR (passed in
46 /// as the replica's ImR IOR, passed back as fault
48 /// @param seq_num current sequence number to return to replica
49 virtual void register_replica
50 (ImplementationRepository::UpdatePushNotification_ptr replica
,
52 CORBA::ULongLong_out seq_num
);
61 * @brief XML backing store containing all ImR persistent information in
62 * multiple files shared between multiple Locators
65 class Replicator
: public ACE_Task_Base
70 typedef ImplementationRepository::UpdatePushNotification_var Replica_var
;
71 typedef ImplementationRepository::UpdatePushNotification_ptr Replica_ptr
;
72 typedef ACE_Hash_Map_Manager_Ex
<ACE_CString
,
73 ImplementationRepository::AAM_Status
,
74 ACE_Hash
<ACE_CString
>,
75 ACE_Equal_To
<ACE_CString
>,
76 ACE_Null_Mutex
> AAM_StatusMap
;
78 Replicator (Shared_Backing_Store
&repo
, const Options
& opts
);
80 virtual ~Replicator(void);
82 virtual int svc (void);
83 virtual int handle_exception (ACE_HANDLE
);
86 void send_access_state (const char *name
, ImplementationRepository::AAM_Status state
);
87 void send_entity (ImplementationRepository::UpdateInfo
&info
);
91 bool init_peer (const ACE_CString
&filename
);
92 int send_registration (char *&ior
);
94 bool peer_available (void);
100 CORBA::ULongLong seq_num_
;
101 CORBA::ULongLong replica_seq_num_
;
102 Shared_Backing_Store
&repo_
;
103 AAM_StatusMap prev_update_
;
105 ACE_Reactor
*reactor_
;
106 TAO_SYNCH_MUTEX lock_
;
108 ImplementationRepository::UpdateInfoSeq to_send_
;
110 ACE_CString endpoint_
;
111 ACE_Time_Value update_delay_
;
114 #endif /* REPLICATOR_H */