Revert "Minor modernization of DynamicAny code"
[ACE_TAO.git] / TAO / tao / IORTable / Async_IOR_Table_Impl.cpp
blobe343a903b129fc3d968a47e03b0bf27b20c0ed61
1 /**
2 * @file Async_IOR_Table_Impl.cpp
4 * @author Phil Mesnier <mesnier_p@ociweb.com>
5 */
7 #include "tao/IORTable/Async_IOR_Table_Impl.h"
8 #include "tao/PortableServer/ForwardRequestC.h"
9 #include "tao/DynamicInterface/AMH_DSI_Response_Handler.h"
10 #include "ace/Guard_T.h"
12 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
14 TAO_Async_IOR_Table_Impl::TAO_Async_IOR_Table_Impl ()
18 TAO_Async_IOR_Table_Impl::~TAO_Async_IOR_Table_Impl ()
22 void
23 TAO_Async_IOR_Table_Impl::async_find (::IORTable::Locate_ResponseHandler handler,
24 const char *object_key)
26 // We don't want the lock held during locate, so make it go out
27 // of scope before then.
29 ACE_CString key (object_key);
30 ACE_CString ior;
31 TAO_AMH_Locate_ResponseHandler_var rh = handler;
32 ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->lock_);
33 if (this->map_.find (key, ior) == 0)
35 rh->forward_ior (ior.c_str(), false);
36 return;
38 if (CORBA::is_nil (this->async_locator_.in ()))
40 if (CORBA::is_nil (this->locator_.in ()))
42 rh->raise_excep (IORTable::NotFound ());
44 else
46 try
48 ior = this->locator_->locate (object_key);
49 rh->forward_ior (ior.c_str(), false);
51 catch (const CORBA::Exception &ex)
53 rh->raise_excep (ex);
56 return;
59 this->async_locator_->async_locate (handler, object_key);
62 void
63 TAO_Async_IOR_Table_Impl::set_locator (IORTable::Locator_ptr locator)
65 ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->lock_);
66 this->locator_ = IORTable::Locator::_duplicate (locator);
67 this->async_locator_ = IORTable::AsyncLocator::_narrow (locator);
70 TAO_END_VERSIONED_NAMESPACE_DECL