AsyncStartupWaiter_i Class Reference

#include <AsyncStartupWaiter_i.h>

Collaboration diagram for AsyncStartupWaiter_i:

Collaboration graph
[legend]
List of all members.

Public Member Functions

void wait_for_startup (ImplementationRepository::AMH_AsyncStartupWaiterResponseHandler_ptr rh, const char *name ACE_ENV_ARG_DECL) throw (CORBA::SystemException)
void unblock_one (const char *name, const char *partial_ior, const char *ior, bool queue)
void unblock_all (const char *name)
void debug (bool dbg)

Private Types

typedef ACE_Vector< PendingDataPendingList
typedef ACE_Strong_Bound_Ptr<
PendingList, ACE_Null_Mutex
PendingListPtr
typedef ACE_Hash_Map_Manager_Ex<
ACE_CString, PendingListPtr,
ACE_Hash< ACE_CString >,
ACE_Equal_To< ACE_CString >,
ACE_Null_Mutex
PendingMap
typedef ACE_Vector< ImplementationRepository::AMH_AsyncStartupWaiterResponseHandler_var > RHList
typedef ACE_Strong_Bound_Ptr<
RHList, ACE_Null_Mutex
RHListPtr
typedef ACE_Hash_Map_Manager_Ex<
ACE_CString, RHListPtr, ACE_Hash<
ACE_CString >, ACE_Equal_To<
ACE_CString >, ACE_Null_Mutex
WaitingMap

Private Member Functions

ImplementationRepository::AMH_AsyncStartupWaiterResponseHandler_ptr get_one_waiter (const char *name)
void get_all_waiters (const char *name, RHList &ret)
void send_response (ImplementationRepository::AMH_AsyncStartupWaiterResponseHandler &rh, const char *name, const char *partial_ior, const char *ior)

Private Attributes

WaitingMap waiting_
PendingMap pending_
bool debug_

Member Typedef Documentation

typedef ACE_Vector<PendingData> AsyncStartupWaiter_i::PendingList [private]
 

Definition at line 31 of file AsyncStartupWaiter_i.h.

Referenced by unblock_one().

typedef ACE_Strong_Bound_Ptr<PendingList, ACE_Null_Mutex> AsyncStartupWaiter_i::PendingListPtr [private]
 

Definition at line 32 of file AsyncStartupWaiter_i.h.

Referenced by unblock_one().

typedef ACE_Hash_Map_Manager_Ex<ACE_CString, PendingListPtr, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex> AsyncStartupWaiter_i::PendingMap [private]
 

Definition at line 37 of file AsyncStartupWaiter_i.h.

typedef ACE_Vector<ImplementationRepository::AMH_AsyncStartupWaiterResponseHandler_var> AsyncStartupWaiter_i::RHList [private]
 

Definition at line 39 of file AsyncStartupWaiter_i.h.

Referenced by get_all_waiters(), get_one_waiter(), and unblock_all().

typedef ACE_Strong_Bound_Ptr<RHList, ACE_Null_Mutex> AsyncStartupWaiter_i::RHListPtr [private]
 

Definition at line 40 of file AsyncStartupWaiter_i.h.

Referenced by get_all_waiters(), and get_one_waiter().

typedef ACE_Hash_Map_Manager_Ex<ACE_CString, RHListPtr, ACE_Hash<ACE_CString>, ACE_Equal_To<ACE_CString>, ACE_Null_Mutex> AsyncStartupWaiter_i::WaitingMap [private]
 

Definition at line 45 of file AsyncStartupWaiter_i.h.


Member Function Documentation

void AsyncStartupWaiter_i::debug bool  dbg  ) 
 

Definition at line 21 of file AsyncStartupWaiter_i.cpp.

Referenced by ImR_Locator_i::init_with_orb().

00022 {
00023   debug_ = dbg;
00024 }

void AsyncStartupWaiter_i::get_all_waiters const char *  name,
RHList ret
[private]
 

Definition at line 155 of file AsyncStartupWaiter_i.cpp.

References ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::find(), ACE_Strong_Bound_Ptr< X, ACE_LOCK >::null(), ACE_Vector< T, DEFAULT_SIZE >::push_back(), RHList, and RHListPtr.

Referenced by unblock_all().

00156 {
00157   RHListPtr lst;
00158   waiting_.find (name, lst);
00159   if (! lst.null ()) {
00160     for (size_t i = 0; i < lst->size (); ++i)
00161       {
00162         RHList& tmp = *lst;
00163         ret.push_back (tmp[i]);
00164         // The ACE_Vector will not destruct the elements when cleared, so we must
00165         // make sure to do so here.
00166         tmp[i] = ImplementationRepository::AMH_AsyncStartupWaiterResponseHandler::_nil ();
00167       }
00168     lst->clear ();
00169   }
00170 }

ImplementationRepository::AMH_AsyncStartupWaiterResponseHandler_ptr AsyncStartupWaiter_i::get_one_waiter const char *  name  )  [private]
 

Definition at line 139 of file AsyncStartupWaiter_i.cpp.

References ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::find(), ACE_Strong_Bound_Ptr< X, ACE_LOCK >::null(), RHList, and RHListPtr.

Referenced by unblock_one().

00140 {
00141   RHListPtr lst;
00142   waiting_.find (name, lst);
00143   if (! lst.null() && lst->size () > 0)
00144     {
00145       RHList& rhlst = *lst;
00146       ImplementationRepository::AMH_AsyncStartupWaiterResponseHandler_var& tmp = rhlst[rhlst.size () - 1];
00147       ImplementationRepository::AMH_AsyncStartupWaiterResponseHandler_ptr ret = tmp._retn ();
00148       rhlst.pop_back ();
00149       return ret;
00150     }
00151   return ImplementationRepository::AMH_AsyncStartupWaiterResponseHandler::_nil ();
00152 }

void AsyncStartupWaiter_i::send_response ImplementationRepository::AMH_AsyncStartupWaiterResponseHandler &  rh,
const char *  name,
const char *  partial_ior,
const char *  ior
[private]
 

Definition at line 59 of file AsyncStartupWaiter_i.cpp.

References ACE_ANY_EXCEPTION, ACE_CATCHANY, ACE_DECLARE_NEW_CORBA_ENV, ACE_ENDTRY, ACE_ENV_ARG_PARAMETER, ACE_PRINT_EXCEPTION, ACE_TRY, and ACE_TRY_CHECK.

Referenced by unblock_one().

00061 {
00062   StartupInfo_var si = new StartupInfo();
00063   si->name = name;
00064   si->partial_ior = partial_ior;
00065   si->ior = ior;
00066 
00067   ACE_DECLARE_NEW_CORBA_ENV;
00068   ACE_TRY
00069     {
00070       rh.wait_for_startup (si.in () ACE_ENV_ARG_PARAMETER);
00071       ACE_TRY_CHECK;
00072     }
00073   ACE_CATCHANY
00074     {
00075       if (debug_)
00076         ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "AsyncStartupWaiter_i::send_response ()");
00077     }
00078   ACE_ENDTRY;
00079 }

void AsyncStartupWaiter_i::unblock_all const char *  name  ) 
 

Definition at line 107 of file AsyncStartupWaiter_i.cpp.

References ACE_ANY_EXCEPTION, ACE_CATCHANY, ACE_DECLARE_NEW_CORBA_ENV, ACE_ENDTRY, ACE_ENV_ARG_PARAMETER, ACE_PRINT_EXCEPTION, ACE_TRY, ACE_TRY_CHECK, get_all_waiters(), RHList, and ACE_Vector< T, DEFAULT_SIZE >::size().

00107                                                    {
00108   RHList tmp;
00109 
00110   get_all_waiters (name, tmp);
00111 
00112   // This startup info should be ignored when unblocking all, because we
00113   // don't know the ior or partial_ior at this point.
00114   StartupInfo_var si = new StartupInfo ();
00115   si->name = name;
00116 
00117   // Note : This method may be called when there are no waiters.
00118 
00119   for (size_t i = 0; i < tmp.size(); ++i)
00120   {
00121     ACE_DECLARE_NEW_CORBA_ENV;
00122     ACE_TRY
00123       {
00124         ImplementationRepository::AMH_AsyncStartupWaiterResponseHandler_var& rh = tmp[i];
00125 
00126         rh->wait_for_startup (si.in () ACE_ENV_ARG_PARAMETER);
00127         ACE_TRY_CHECK;
00128       }
00129     ACE_CATCHANY
00130       {
00131         if (debug_)
00132           ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "AsyncStartupWaiter_i::unblock_all ()");
00133       }
00134     ACE_ENDTRY;
00135   }
00136 }

void AsyncStartupWaiter_i::unblock_one const char *  name,
const char *  partial_ior,
const char *  ior,
bool  queue
 

Definition at line 82 of file AsyncStartupWaiter_i.cpp.

References ACE_ASSERT, ACE_DEBUG, ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::bind(), ACE_Hash_Map_Manager_Ex< EXT_ID, INT_ID, HASH_KEY, COMPARE_KEYS, ACE_LOCK >::find(), get_one_waiter(), CORBA::is_nil(), LM_DEBUG, ACE_Strong_Bound_Ptr< X, ACE_LOCK >::null(), pending_, PendingList, PendingListPtr, and send_response().

00082                                                                                                          {
00083   ImplementationRepository::AMH_AsyncStartupWaiterResponseHandler_var rh = get_one_waiter(name);
00084   if (! CORBA::is_nil(rh.in ()))
00085     {
00086       send_response (*rh.in (), name, partial_ior, ior);
00087     }
00088   else if (queue)
00089     {
00090       if (debug_)
00091         ACE_DEBUG((LM_DEBUG, "ImR: Queuing startup info.\n"));
00092 
00093       PendingListPtr lst;
00094       pending_.find (name, lst);
00095       if (lst.null ())
00096         {
00097           lst = PendingListPtr (new PendingList);
00098           int err = pending_.bind (name, lst);
00099           ACE_ASSERT (err == 0);
00100           ACE_UNUSED_ARG (err);
00101         }
00102       lst->push_back (PendingData (partial_ior, ior));
00103     }
00104 }

void AsyncStartupWaiter_i::wait_for_startup ImplementationRepository::AMH_AsyncStartupWaiterResponseHandler_ptr  rh,
const char *name  ACE_ENV_ARG_DECL
throw (CORBA::SystemException)
 


Member Data Documentation

bool AsyncStartupWaiter_i::debug_ [private]
 

Definition at line 71 of file AsyncStartupWaiter_i.h.

PendingMap AsyncStartupWaiter_i::pending_ [private]
 

Definition at line 70 of file AsyncStartupWaiter_i.h.

Referenced by unblock_one().

WaitingMap AsyncStartupWaiter_i::waiting_ [private]
 

Definition at line 69 of file AsyncStartupWaiter_i.h.


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 13:37:00 2006 for TAO_Implementation_Repository by doxygen 1.3.6