3 * @file AsyncListManager.h
5 * @author Phil Mesnier <mesnier_p@ociweb.com>
8 #ifndef IMR_ASYNCLISTMANAGER_H_
9 #define IMR_ASYNCLISTMANAGER_H_
11 #include "locator_export.h"
13 #include "ImR_LocatorC.h"
14 #include "ace/Vector_T.h"
15 #include "ace/SString.h"
17 #if !defined (ACE_LACKS_PRAGMA_ONCE)
19 #endif /* ACE_LACKS_PRAGMA_ONCE */
21 #include "tao/Intrusive_Ref_Count_Handle_T.h"
23 #include "LiveCheck.h"
25 class Locator_Repository
;
27 //----------------------------------------------------------------------------
29 * @class AsyncListManager
31 * @brief manages active detection of multiple servers to satisfy "list -a"
33 * A client of the locator may issue a list command to be filtered to
34 * currently active servers only. To satisfy that request each server must
35 * be pinged to determine liveness. The AsyncListManager handles the
36 * callbacks for all of the ping requests as efficiently as possible.
39 class AsyncListManager
42 AsyncListManager (const Locator_Repository
*repo
,
43 PortableServer::POA_ptr poa
,
48 PortableServer::POA_ptr
poa ();
49 void list (ImplementationRepository::AMH_AdministrationResponseHandler_ptr _tao_rh
,
52 CORBA::ULong
list (ImplementationRepository::AMH_ServerInformationIteratorResponseHandler_ptr _tao_rh
,
53 CORBA::ULong start
, CORBA::ULong count
);
55 bool evaluate_status (CORBA::ULong index
, LiveStatus status
, int pid
);
56 void ping_replied (CORBA::ULong index
, LiveStatus status
, int pid
);
58 AsyncListManager
*_add_ref ();
63 void list_i (CORBA::ULong start
, CORBA::ULong count
);
64 bool make_iterator (ImplementationRepository::ServerInformationIterator_out si
,
68 const Locator_Repository
*repo_
;
69 PortableServer::POA_var poa_
;
70 ImplementationRepository::AMH_AdministrationResponseHandler_var primary_
;
71 ImplementationRepository::AMH_ServerInformationIteratorResponseHandler_var secondary_
;
73 ImplementationRepository::ServerInformationList server_list_
;
75 CORBA::ULong how_many_
;
76 CORBA::ULong waiters_
;
77 std::atomic
<int> refcount_
;
80 typedef TAO_Intrusive_Ref_Count_Handle
<AsyncListManager
> AsyncListManager_ptr
;
82 //----------------------------------------------------------------------------
84 class ListLiveListener
: public LiveListener
87 ListLiveListener (const char * server
,
90 AsyncListManager
*owner
,
93 virtual ~ListLiveListener ();
97 bool status_changed (LiveStatus status
);
100 AsyncListManager_ptr owner_
;
108 #endif /* IMR_ASYNCACCESSMANGER_H_ */