TAO::Portable_Server::Servant_Upcall Class Reference

This class finds out the POA and the servant to perform an upcall. It can only be instantiated without the object adapter's lock held. For each upcall a new instance of this class is created. More...

#include <Servant_Upcall.h>

Collaboration diagram for TAO::Portable_Server::Servant_Upcall:

Collaboration graph
[legend]
List of all members.

Public Types

 INITIAL_STAGE
 OBJECT_ADAPTER_LOCK_ACQUIRED
 POA_CURRENT_SETUP
 OBJECT_ADAPTER_LOCK_RELEASED
 SERVANT_LOCK_ACQUIRED
enum  State {
  INITIAL_STAGE, OBJECT_ADAPTER_LOCK_ACQUIRED, POA_CURRENT_SETUP, OBJECT_ADAPTER_LOCK_RELEASED,
  SERVANT_LOCK_ACQUIRED
}

Public Member Functions

 Servant_Upcall (TAO_ORB_Core *orb_core)
 Constructor.
 ~Servant_Upcall (void)
 Destructor.
int prepare_for_upcall (const TAO::ObjectKey &key, const char *operation, CORBA::Object_out forward_to)
 Locate POA and servant.
int prepare_for_upcall_i (const TAO::ObjectKey &key, const char *operation, CORBA::Object_out forward_to, bool &wait_occurred_restart_call)
 Helper.
void pre_invoke_remote_request (TAO_ServerRequest &req)
 Run pre_invoke for a remote request.
void pre_invoke_collocated_request (void)
 Run pre_invoke for a collocated request.
void post_invoke (void)
 Run post_invoke for a request.
::TAO_Root_POAlookup_POA (const TAO::ObjectKey &key)
 Locate POA.
::TAO_Root_POApoa (void) const
 POA accessor.
TAO_Object_Adapterobject_adapter (void) const
 Object Adapter accessor.
const PortableServer::ObjectIdid (void) const
 System ID accessor.
void user_id (const PortableServer::ObjectId *)
const PortableServer::ObjectIduser_id (void) const
PortableServer::Servant servant (void) const
 Servant accessor.
void * locator_cookie (void) const
 Get the Servant Locator's cookie.
void locator_cookie (void *cookie)
 Set the Servant Locator's cookie.
const char * operation (void) const
 Get the operation name.
void operation (const char *)
 Set the operation name.
void active_object_map_entry (TAO_Active_Object_Map_Entry *entry)
 Set the active_object_map_entry.
TAO_Active_Object_Map_Entryactive_object_map_entry (void) const
 Get the active_object_map_entry.
CORBA::Short priority (void) const
 Get the priority for the current upcall.
State state (void) const
 Get the state.
void state (State)
 Set the state.
void increment_servant_refcount (void)
 Increment the refcount.

Protected Member Functions

void post_invoke_servant_cleanup (void)
void single_threaded_poa_setup (void)
void single_threaded_poa_cleanup (void)
void servant_cleanup (void)
void poa_cleanup (void)
void upcall_cleanup (void)
 Clean-up / reset state of this Servant_Upcall object.

Protected Attributes

TAO_Object_Adapterobject_adapter_
::TAO_Root_POApoa_
PortableServer::Servant servant_
State state_
CORBA::Octet system_id_buf_ [TAO_POA_OBJECT_ID_BUF_SIZE]
PortableServer::ObjectId system_id_
const PortableServer::ObjectIduser_id_
POA_Current_Impl current_context_
void * cookie_
 Servant Locator's cookie.
const char * operation_
 Operation name for this current.
TAO_Active_Object_Map_Entryactive_object_map_entry_
Pre_Invoke_State pre_invoke_state_
 Preinvoke data for the upcall.

Private Member Functions

 Servant_Upcall (const Servant_Upcall &)
void operator= (const Servant_Upcall &)

Friends

class ::TAO_RT_Collocation_Resolver

Classes

class  Pre_Invoke_State
 This struct keeps track of state related to pre- and post-invoke operations. More...

Detailed Description

This class finds out the POA and the servant to perform an upcall. It can only be instantiated without the object adapter's lock held. For each upcall a new instance of this class is created.

Definition at line 60 of file Servant_Upcall.h.


Member Enumeration Documentation

enum TAO::Portable_Server::Servant_Upcall::State

Enumerator:
INITIAL_STAGE 
OBJECT_ADAPTER_LOCK_ACQUIRED 
POA_CURRENT_SETUP 
OBJECT_ADAPTER_LOCK_RELEASED 
SERVANT_LOCK_ACQUIRED 

Definition at line 165 of file Servant_Upcall.h.


Constructor & Destructor Documentation

TAO::Portable_Server::Servant_Upcall::Servant_Upcall ( TAO_ORB_Core orb_core  )  [explicit]

Constructor.

Definition at line 32 of file Servant_Upcall.cpp.

References object_adapter(), object_adapter_, and TAO_ORB_Core::poa_adapter().

00033       : object_adapter_ (0),
00034         poa_ (0),
00035         servant_ (0),
00036         state_ (INITIAL_STAGE),
00037         system_id_ (TAO_POA_OBJECT_ID_BUF_SIZE, 0, system_id_buf_),
00038         user_id_ (0),
00039         current_context_ (),
00040 #if (TAO_HAS_MINIMUM_POA == 0)
00041         cookie_ (0),
00042         operation_ (0),
00043 #endif /* TAO_HAS_MINIMUM_POA == 0 */
00044         active_object_map_entry_ (0)
00045     {
00046       TAO_Object_Adapter *object_adapter =
00047         dynamic_cast<TAO_Object_Adapter *>(oc->poa_adapter ());
00048       this->object_adapter_ = object_adapter;
00049     }

TAO::Portable_Server::Servant_Upcall::~Servant_Upcall ( void   ) 

Destructor.

Definition at line 234 of file Servant_Upcall.cpp.

References upcall_cleanup().

00235     {
00236       this->upcall_cleanup ();
00237     }

TAO::Portable_Server::Servant_Upcall::Servant_Upcall ( const Servant_Upcall  )  [private]


Member Function Documentation

ACE_INLINE TAO_Active_Object_Map_Entry * TAO::Portable_Server::Servant_Upcall::active_object_map_entry ( void   )  const

Get the active_object_map_entry.

Definition at line 83 of file Servant_Upcall.inl.

References active_object_map_entry_.

00084     {
00085       return this->active_object_map_entry_;
00086     }

ACE_INLINE void TAO::Portable_Server::Servant_Upcall::active_object_map_entry ( TAO_Active_Object_Map_Entry entry  ) 

Set the active_object_map_entry.

Definition at line 77 of file Servant_Upcall.inl.

References active_object_map_entry_.

Referenced by TAO::Portable_Server::ServantRetentionStrategyRetain::find_servant(), and TAO::Portable_Server::ServantRetentionStrategyRetain::rebind_using_user_id_and_system_id().

00078     {
00079       this->active_object_map_entry_ = entry;
00080     }

ACE_INLINE const PortableServer::ObjectId & TAO::Portable_Server::Servant_Upcall::id ( void   )  const

System ID accessor.

Definition at line 30 of file Servant_Upcall.inl.

References system_id_.

00031     {
00032       return this->system_id_;
00033     }

void TAO::Portable_Server::Servant_Upcall::increment_servant_refcount ( void   ) 

Increment the refcount.

Definition at line 337 of file Servant_Upcall.cpp.

References active_object_map_entry_, and TAO_Active_Object_Map_Entry::reference_count_.

Referenced by TAO::Portable_Server::ServantRetentionStrategyRetain::find_servant(), and TAO::Portable_Server::RequestProcessingStrategyServantActivator::locate_servant().

00338     {
00339       // Cleanup servant related stuff.
00340       if (this->active_object_map_entry_ != 0)
00341         ++this->active_object_map_entry_->reference_count_;
00342     }

ACE_INLINE void TAO::Portable_Server::Servant_Upcall::locator_cookie ( void *  cookie  ) 

Set the Servant Locator's cookie.

Definition at line 57 of file Servant_Upcall.inl.

References cookie_.

00058     {
00059       this->cookie_ = cookie;
00060     }

ACE_INLINE void * TAO::Portable_Server::Servant_Upcall::locator_cookie ( void   )  const

Get the Servant Locator's cookie.

Definition at line 51 of file Servant_Upcall.inl.

References cookie_.

Referenced by TAO::Portable_Server::RequestProcessingStrategyServantLocator::locate_servant(), and TAO::Portable_Server::RequestProcessingStrategyServantLocator::post_invoke_servant_cleanup().

00052     {
00053       return this->cookie_;
00054     }

TAO_Root_POA * TAO::Portable_Server::Servant_Upcall::lookup_POA ( const TAO::ObjectKey &  key  ) 

Locate POA.

Definition at line 212 of file Servant_Upcall.cpp.

References TAO_Object_Adapter::locate_poa(), object_adapter_, OBJECT_ADAPTER_LOCK_ACQUIRED, poa_, state_, and TAO_Object_Adapter::wait_for_non_servant_upcalls_to_complete().

00213     {
00214       // Acquire the object adapter lock first.
00215       if (this->object_adapter_->lock ().acquire () == -1)
00216         // Locking error.
00217         throw ::CORBA::OBJ_ADAPTER ();
00218 
00219       // We have acquired the object adapter lock.  Record this for later
00220       // use.
00221       this->state_ = OBJECT_ADAPTER_LOCK_ACQUIRED;
00222 
00223       // Check if a non-servant upcall is in progress.  If a non-servant
00224       // upcall is in progress, wait for it to complete.  Unless of
00225       // course, the thread making the non-servant upcall is this thread.
00226       this->object_adapter_->wait_for_non_servant_upcalls_to_complete ();
00227 
00228       // Locate the POA.
00229       this->object_adapter_->locate_poa (key, this->system_id_, this->poa_);
00230 
00231       return this->poa_;
00232     }

ACE_INLINE TAO_Object_Adapter & TAO::Portable_Server::Servant_Upcall::object_adapter ( void   )  const

Object Adapter accessor.

Definition at line 24 of file Servant_Upcall.inl.

References object_adapter_.

Referenced by Servant_Upcall().

00025     {
00026       return *this->object_adapter_;
00027     }

ACE_INLINE void TAO::Portable_Server::Servant_Upcall::operation ( const char *   ) 

Set the operation name.

Definition at line 69 of file Servant_Upcall.inl.

References operation_.

00070     {
00071       this->operation_ = name;
00072     }

ACE_INLINE const char * TAO::Portable_Server::Servant_Upcall::operation ( void   )  const

Get the operation name.

Definition at line 63 of file Servant_Upcall.inl.

References operation_.

Referenced by TAO::Portable_Server::RequestProcessingStrategyServantLocator::locate_servant(), and TAO::Portable_Server::RequestProcessingStrategyServantLocator::post_invoke_servant_cleanup().

00064     {
00065       return this->operation_;
00066     }

void TAO::Portable_Server::Servant_Upcall::operator= ( const Servant_Upcall  )  [private]

ACE_INLINE::TAO_Root_POA & TAO::Portable_Server::Servant_Upcall::poa ( void   )  const

POA accessor.

Definition at line 12 of file Servant_Upcall.inl.

References poa_.

Referenced by TAO_Object_Adapter::bind_persistent_poa(), TAO_Object_Adapter::bind_transient_poa(), TAO_Object_Adapter::find_persistent_poa(), and TAO_Object_Adapter::find_poa().

00013     {
00014       return *this->poa_;
00015     }

void TAO::Portable_Server::Servant_Upcall::poa_cleanup ( void   )  [protected]

Definition at line 379 of file Servant_Upcall.cpp.

References TAO_Root_POA::complete_destruction_i(), TAO_Root_POA::decrement_outstanding_requests(), TAO_Root_POA::outstanding_requests_condition_, and poa_.

Referenced by upcall_cleanup().

00380     {
00381       // Decrease <poa->outstanding_requests_> now that the upcall
00382       // is complete.
00383       //
00384       // Note that the object adapter lock is acquired before
00385       // <POA::outstanding_requests_> is decreased.
00386       CORBA::ULong outstanding_requests =
00387         this->poa_->decrement_outstanding_requests ();
00388 
00389       // Check if all pending requests are over.
00390       if (outstanding_requests == 0)
00391         {
00392           // If locking is enabled and some thread is waiting in POA::destroy.
00393           if (this->object_adapter_->enable_locking_ &&
00394               this->poa_->wait_for_completion_pending_)
00395             {
00396               // Wakeup all waiting threads.
00397               this->poa_->outstanding_requests_condition_.broadcast ();
00398             }
00399 
00400           // Note that there is no need to check for
00401           // <non_servant_upcall_in_progress> since it is not possible for
00402           // non-servant upcalls to be in progress at this point.
00403           if (this->poa_->waiting_destruction_)
00404             {
00405               try
00406                 {
00407                   this->poa_->complete_destruction_i ();
00408                 }
00409               catch (const ::CORBA::Exception& ex)
00410                 {
00411                   // Ignore exceptions
00412                   ex._tao_print_exception ("TAO_POA::~complete_destruction_i");
00413                 }
00414 
00415               this->poa_ = 0;
00416             }
00417         }
00418     }

void TAO::Portable_Server::Servant_Upcall::post_invoke ( void   ) 

Run post_invoke for a request.

Definition at line 197 of file Servant_Upcall.cpp.

References object_adapter_, TAO_Servant_Dispatcher::post_invoke(), pre_invoke_state_, and TAO_Object_Adapter::servant_dispatcher_.

Referenced by upcall_cleanup().

00198     {
00199       this->object_adapter_->servant_dispatcher_->post_invoke (
00200         this->poa (),
00201         this->pre_invoke_state_);
00202     }

void TAO::Portable_Server::Servant_Upcall::post_invoke_servant_cleanup ( void   )  [protected]

Definition at line 301 of file Servant_Upcall.cpp.

References poa_, and TAO_Root_POA::post_invoke_servant_cleanup().

Referenced by upcall_cleanup().

00302     {
00303       this->poa_->post_invoke_servant_cleanup (this->current_context_.object_id (),
00304                                                *this);
00305     }

void TAO::Portable_Server::Servant_Upcall::pre_invoke_collocated_request ( void   ) 

Run pre_invoke for a collocated request.

Definition at line 188 of file Servant_Upcall.cpp.

References object_adapter_, TAO_Servant_Dispatcher::pre_invoke_collocated_request(), pre_invoke_state_, priority(), and TAO_Object_Adapter::servant_dispatcher_.

Referenced by TAO::Collocated_Object_Proxy_Broker::_get_interface(), TAO::Collocated_Object_Proxy_Broker::_is_a(), TAO::Collocated_Object_Proxy_Broker::_non_existent(), and TAO_Object_Adapter::dispatch_servant().

00189     {
00190       this->object_adapter_->servant_dispatcher_->pre_invoke_collocated_request (
00191         this->poa (),
00192         this->priority (),
00193         this->pre_invoke_state_);
00194     }

void TAO::Portable_Server::Servant_Upcall::pre_invoke_remote_request ( TAO_ServerRequest req  ) 

Run pre_invoke for a remote request.

Definition at line 178 of file Servant_Upcall.cpp.

References object_adapter_, TAO_Servant_Dispatcher::pre_invoke_remote_request(), pre_invoke_state_, priority(), and TAO_Object_Adapter::servant_dispatcher_.

Referenced by TAO_Object_Adapter::dispatch_servant().

00179     {
00180       this->object_adapter_->servant_dispatcher_->pre_invoke_remote_request (
00181         this->poa (),
00182         this->priority (),
00183         req,
00184         this->pre_invoke_state_);
00185     }

int TAO::Portable_Server::Servant_Upcall::prepare_for_upcall ( const TAO::ObjectKey &  key,
const char *  operation,
CORBA::Object_out  forward_to 
)

Locate POA and servant.

Definition at line 52 of file Servant_Upcall.cpp.

References TAO_Adapter::DS_FAILED, prepare_for_upcall_i(), and upcall_cleanup().

Referenced by TAO::Collocated_Object_Proxy_Broker::_get_component(), TAO::Collocated_Object_Proxy_Broker::_get_interface(), TAO::Collocated_Object_Proxy_Broker::_is_a(), TAO::Collocated_Object_Proxy_Broker::_non_existent(), TAO::Collocated_Object_Proxy_Broker::_repository_id(), and TAO_Object_Adapter::dispatch_servant().

00056     {
00057       while (1)
00058         {
00059           bool wait_occurred_restart_call = false;
00060 
00061           int result =
00062             this->prepare_for_upcall_i (key,
00063                                         operation,
00064                                         forward_to,
00065                                         wait_occurred_restart_call);
00066 
00067           if (result == TAO_Adapter::DS_FAILED &&
00068               wait_occurred_restart_call)
00069             {
00070               // We ended up waiting on a condition variable.  The POA
00071               // state may have changed while we are waiting.  Therefore,
00072               // we need to call prepare_for_upcall_i() again.  We also
00073               // need to cleanup the state of the upcall object before
00074               // continuing.
00075               this->upcall_cleanup ();
00076               continue;
00077             }
00078           else
00079             {
00080               return result;
00081             }
00082         }
00083     }

int TAO::Portable_Server::Servant_Upcall::prepare_for_upcall_i ( const TAO::ObjectKey &  key,
const char *  operation,
CORBA::Object_out  forward_to,
bool &  wait_occurred_restart_call 
)

Helper.

Definition at line 86 of file Servant_Upcall.cpp.

References CORBA::Object::_duplicate(), ACE_Lock::acquire(), TAO_Root_POA::check_state(), current_context_, TAO_Adapter::DS_FAILED, TAO_Adapter::DS_FORWARD, TAO_Adapter::DS_OK, TAO_Root_POA::increment_outstanding_requests(), TAO_Object_Adapter::locate_poa(), TAO_Root_POA::locate_servant_i(), TAO_Object_Adapter::lock(), object_adapter_, OBJECT_ADAPTER_LOCK_ACQUIRED, OBJECT_ADAPTER_LOCK_RELEASED, poa_, POA_CURRENT_SETUP, ACE_Lock::release(), TAO::Portable_Server::POA_Current_Impl::servant(), servant_, SERVANT_LOCK_ACQUIRED, TAO::Portable_Server::POA_Current_Impl::setup(), single_threaded_poa_setup(), state_, and TAO_Object_Adapter::wait_for_non_servant_upcalls_to_complete().

Referenced by prepare_for_upcall().

00091     {
00092       // Acquire the object adapter lock first.
00093       int result = this->object_adapter_->lock ().acquire ();
00094       if (result == -1)
00095         // Locking error.
00096         throw ::CORBA::OBJ_ADAPTER ();
00097 
00098       // We have acquired the object adapter lock.  Record this for later
00099       // use.
00100       this->state_ = OBJECT_ADAPTER_LOCK_ACQUIRED;
00101 
00102       // Check if a non-servant upcall is in progress.  If a non-servant
00103       // upcall is in progress, wait for it to complete.  Unless of
00104       // course, the thread making the non-servant upcall is this thread.
00105       this->object_adapter_->wait_for_non_servant_upcalls_to_complete ();
00106 
00107       // Locate the POA.
00108       this->object_adapter_->locate_poa (key, this->system_id_, this->poa_);
00109 
00110       // Check the state of the POA.
00111       this->poa_->check_state ();
00112 
00113       // Setup current for this request.
00114       this->current_context_.setup (this->poa_, key);
00115 
00116       // Increase <poa->outstanding_requests_> for the duration of finding
00117       // the POA, finding the servant, and making the upcall.
00118       this->poa_->increment_outstanding_requests ();
00119 
00120       // We have setup the POA Current.  Record this for later use.
00121       this->state_ = POA_CURRENT_SETUP;
00122 
00123 #if (TAO_HAS_MINIMUM_CORBA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
00124       try
00125         {
00126 #endif /* TAO_HAS_MINIMUM_CORBA */
00127           // Lookup the servant.
00128           this->servant_ =
00129             this->poa_->locate_servant_i (operation,
00130                                           this->system_id_,
00131                                           *this,
00132                                           this->current_context_,
00133                                           wait_occurred_restart_call);
00134 
00135           if (wait_occurred_restart_call)
00136             return TAO_Adapter::DS_FAILED;
00137 #if (TAO_HAS_MINIMUM_CORBA == 0) && !defined (CORBA_E_COMPACT) && !defined (CORBA_E_MICRO)
00138         }
00139       catch (const ::PortableServer::ForwardRequest& forward_request)
00140         {
00141           forward_to =
00142             CORBA::Object::_duplicate (forward_request.forward_reference.in ());
00143           return TAO_Adapter::DS_FORWARD;
00144         }
00145 #else
00146       ACE_UNUSED_ARG (forward_to);
00147 #endif /* TAO_HAS_MINIMUM_CORBA */
00148 
00149       // Now that we know the servant.
00150       this->current_context_.servant (this->servant_);
00151 
00152       // For servants from Servant Locators, there is no active object map
00153       // entry.
00154       if (this->active_object_map_entry ())
00155         this->current_context_.priority (this->active_object_map_entry ()->priority_);
00156 
00157       if (this->state_ != OBJECT_ADAPTER_LOCK_RELEASED)
00158         {
00159           // Release the object adapter lock.
00160           this->object_adapter_->lock ().release ();
00161 
00162           // We have release the object adapter lock.  Record this for
00163           // later use.
00164           this->state_ = OBJECT_ADAPTER_LOCK_RELEASED;
00165         }
00166 
00167       // Serialize servants (if appropriate).
00168       this->single_threaded_poa_setup ();
00169 
00170       // We have acquired the servant lock.  Record this for later use.
00171       this->state_ = SERVANT_LOCK_ACQUIRED;
00172 
00173       // After this point, <this->servant_> is ready for dispatching.
00174       return TAO_Adapter::DS_OK;
00175     }

ACE_INLINE CORBA::Short TAO::Portable_Server::Servant_Upcall::priority ( void   )  const

Get the priority for the current upcall.

Definition at line 89 of file Servant_Upcall.inl.

References current_context_, and TAO::Portable_Server::POA_Current_Impl::priority().

Referenced by pre_invoke_collocated_request(), and pre_invoke_remote_request().

00090     {
00091       return this->current_context_.priority ();
00092     }

ACE_INLINE PortableServer::Servant TAO::Portable_Server::Servant_Upcall::servant ( void   )  const

Servant accessor.

Definition at line 18 of file Servant_Upcall.inl.

References servant_.

Referenced by TAO::Collocated_Object_Proxy_Broker::_get_component(), TAO::Collocated_Object_Proxy_Broker::_get_interface(), TAO::Collocated_Object_Proxy_Broker::_is_a(), TAO::Collocated_Object_Proxy_Broker::_non_existent(), TAO::Collocated_Object_Proxy_Broker::_repository_id(), TAO_Object_Adapter::do_dispatch(), TAO_Object_Adapter::find_servant(), and TAO::Portable_Server::RequestProcessingStrategyServantLocator::post_invoke_servant_cleanup().

00019     {
00020       return this->servant_;
00021     }

void TAO::Portable_Server::Servant_Upcall::servant_cleanup ( void   )  [protected]

Definition at line 345 of file Servant_Upcall.cpp.

References active_object_map_entry_, TAO_Root_POA::cleanup_servant(), TAO_Object_Adapter::enable_locking_, object_adapter_, poa_, and TAO_Active_Object_Map_Entry::reference_count_.

Referenced by upcall_cleanup().

00346     {
00347       // Cleanup servant related stuff.
00348       if (this->active_object_map_entry_ != 0)
00349         {
00350           // Decrement the reference count.
00351           CORBA::UShort const new_count =
00352             --this->active_object_map_entry_->reference_count_;
00353 
00354           if (new_count == 0)
00355             {
00356               try
00357                 {
00358                   this->poa_->cleanup_servant (
00359                     this->active_object_map_entry_->servant_,
00360                     this->active_object_map_entry_->user_id_);
00361 
00362                 }
00363               catch (...)
00364                 {
00365                   // Ignore errors from servant cleanup ....
00366                 }
00367 
00368               if (this->poa_->waiting_servant_deactivation() > 0 &&
00369                   this->object_adapter_->enable_locking_)
00370                 {
00371                   // Wakeup all waiting threads.
00372                   this->poa_->servant_deactivation_condition_.broadcast ();
00373                 }
00374             }
00375         }
00376     }

void TAO::Portable_Server::Servant_Upcall::single_threaded_poa_cleanup ( void   )  [protected]

Definition at line 326 of file Servant_Upcall.cpp.

References TAO_Root_POA::exit(), and poa_.

Referenced by upcall_cleanup().

00327     {
00328 #if (TAO_HAS_MINIMUM_POA == 0)
00329       // Since the servant lock was acquired, we must release it.
00330       int const result = this->poa_->exit ();
00331 
00332       ACE_UNUSED_ARG (result);
00333 #endif /* TAO_HAS_MINIMUM_POA == 0 */
00334     }

void TAO::Portable_Server::Servant_Upcall::single_threaded_poa_setup ( void   )  [protected]

Definition at line 308 of file Servant_Upcall.cpp.

Referenced by prepare_for_upcall_i().

00309     {
00310 #if (TAO_HAS_MINIMUM_POA == 0)
00311       // Serialize servants (if necessary).
00312       //
00313       // Note that this lock must be acquired *after* the object adapter
00314       // lock has been released.  This is necessary since we cannot block
00315       // waiting for the servant lock while holding the object adapter
00316       // lock.  Otherwise, the thread that wants to release this lock will
00317       // not be able to do so since it can't acquire the object adapterx
00318       // lock.
00319       if (this->poa_->enter() == -1)
00320         // Locking error.
00321         throw ::CORBA::OBJ_ADAPTER ();
00322 #endif /* !TAO_HAS_MINIMUM_POA == 0 */
00323     }

ACE_INLINE void TAO::Portable_Server::Servant_Upcall::state ( State   ) 

Set the state.

Definition at line 101 of file Servant_Upcall.inl.

References state_.

00102     {
00103       this->state_ = state;
00104     }

ACE_INLINE Servant_Upcall::State TAO::Portable_Server::Servant_Upcall::state ( void   )  const

Get the state.

Definition at line 95 of file Servant_Upcall.inl.

References state_.

Referenced by TAO::Portable_Server::RequestProcessingStrategyServantLocator::locate_servant().

00096     {
00097       return this->state_;
00098     }

void TAO::Portable_Server::Servant_Upcall::upcall_cleanup ( void   )  [protected]

Clean-up / reset state of this Servant_Upcall object.

Definition at line 240 of file Servant_Upcall.cpp.

References ACE_Lock::acquire(), current_context_, INITIAL_STAGE, TAO_Object_Adapter::lock(), object_adapter_, OBJECT_ADAPTER_LOCK_ACQUIRED, OBJECT_ADAPTER_LOCK_RELEASED, poa_cleanup(), POA_CURRENT_SETUP, post_invoke(), post_invoke_servant_cleanup(), ACE_Lock::release(), servant_cleanup(), SERVANT_LOCK_ACQUIRED, single_threaded_poa_cleanup(), TAO::Portable_Server::POA_Current_Impl::teardown(), and TAO_Object_Adapter::wait_for_non_servant_upcalls_to_complete_no_throw().

Referenced by prepare_for_upcall(), and ~Servant_Upcall().

00241     {
00242       this->post_invoke ();
00243 
00244       switch (this->state_)
00245         {
00246         case SERVANT_LOCK_ACQUIRED:
00247           // Unlock servant (if appropriate).
00248           this->single_threaded_poa_cleanup ();
00249 
00250           /* FALLTHRU */
00251 
00252         case OBJECT_ADAPTER_LOCK_RELEASED:
00253           // Cleanup servant locator related state.  Note that because
00254           // this operation does not change any Object Adapter related
00255           // state, it is ok to call it outside the lock.
00256           this->post_invoke_servant_cleanup ();
00257 
00258           // Since the object adapter lock was released, we must acquire
00259           // it.
00260           //
00261           // Note that errors are ignored here since we cannot do much
00262           // with it.
00263           this->object_adapter_->lock ().acquire ();
00264 
00265           // Check if a non-servant upcall is in progress.  If a
00266           // non-servant upcall is in progress, wait for it to complete.
00267           // Unless of course, the thread making the non-servant upcall is
00268           // this thread.
00269           this->object_adapter_->wait_for_non_servant_upcalls_to_complete_no_throw ();
00270 
00271           // Cleanup servant related state.
00272           this->servant_cleanup ();
00273 
00274           /* FALLTHRU */
00275 
00276         case POA_CURRENT_SETUP:
00277           // Cleanup POA related state.
00278           this->poa_cleanup ();
00279 
00280           // Teardown current for this request.
00281           this->current_context_.teardown ();
00282 
00283           /* FALLTHRU */
00284 
00285         case OBJECT_ADAPTER_LOCK_ACQUIRED:
00286           // Finally, since the object adapter lock was acquired, we must
00287           // release it.
00288           this->object_adapter_->lock ().release ();
00289 
00290           /* FALLTHRU */
00291 
00292         case INITIAL_STAGE:
00293         default:
00294           // @@ Keep compiler happy, the states above are the only
00295           //    possible ones.
00296           break;
00297         }
00298     }

ACE_INLINE const PortableServer::ObjectId & TAO::Portable_Server::Servant_Upcall::user_id ( void   )  const

Definition at line 43 of file Servant_Upcall.inl.

References user_id_.

00044     {
00045       return *(this->user_id_);
00046     }

ACE_INLINE void TAO::Portable_Server::Servant_Upcall::user_id ( const PortableServer::ObjectId  ) 

User ID accessors. This is the same value returned by PortableServer::Current::get_object_id().

Definition at line 36 of file Servant_Upcall.inl.

References user_id_.

Referenced by TAO::Portable_Server::ServantRetentionStrategyRetain::find_servant(), and TAO::Portable_Server::ServantRetentionStrategyNonRetain::find_servant().

00038     {
00039       this->user_id_ = id;
00040     }


Friends And Related Function Documentation

friend class ::TAO_RT_Collocation_Resolver [friend]

Definition at line 63 of file Servant_Upcall.h.


Member Data Documentation

TAO_Active_Object_Map_Entry* TAO::Portable_Server::Servant_Upcall::active_object_map_entry_ [protected]

Pointer to the entry in the TAO_Active_Object_Map corresponding to the servant for this request.

Definition at line 223 of file Servant_Upcall.h.

Referenced by active_object_map_entry(), increment_servant_refcount(), and servant_cleanup().

void* TAO::Portable_Server::Servant_Upcall::cookie_ [protected]

Servant Locator's cookie.

Definition at line 214 of file Servant_Upcall.h.

Referenced by locator_cookie().

POA_Current_Impl TAO::Portable_Server::Servant_Upcall::current_context_ [protected]

Definition at line 209 of file Servant_Upcall.h.

Referenced by prepare_for_upcall_i(), priority(), and upcall_cleanup().

TAO_Object_Adapter* TAO::Portable_Server::Servant_Upcall::object_adapter_ [protected]

Definition at line 196 of file Servant_Upcall.h.

Referenced by lookup_POA(), object_adapter(), post_invoke(), pre_invoke_collocated_request(), pre_invoke_remote_request(), prepare_for_upcall_i(), servant_cleanup(), Servant_Upcall(), and upcall_cleanup().

const char* TAO::Portable_Server::Servant_Upcall::operation_ [protected]

Operation name for this current.

Definition at line 217 of file Servant_Upcall.h.

Referenced by operation().

::TAO_Root_POA* TAO::Portable_Server::Servant_Upcall::poa_ [protected]

Definition at line 198 of file Servant_Upcall.h.

Referenced by lookup_POA(), poa(), poa_cleanup(), post_invoke_servant_cleanup(), prepare_for_upcall_i(), servant_cleanup(), and single_threaded_poa_cleanup().

Pre_Invoke_State TAO::Portable_Server::Servant_Upcall::pre_invoke_state_ [protected]

Preinvoke data for the upcall.

Definition at line 226 of file Servant_Upcall.h.

Referenced by post_invoke(), pre_invoke_collocated_request(), and pre_invoke_remote_request().

PortableServer::Servant TAO::Portable_Server::Servant_Upcall::servant_ [protected]

Definition at line 200 of file Servant_Upcall.h.

Referenced by prepare_for_upcall_i(), and servant().

State TAO::Portable_Server::Servant_Upcall::state_ [protected]

Definition at line 202 of file Servant_Upcall.h.

Referenced by lookup_POA(), prepare_for_upcall_i(), and state().

PortableServer::ObjectId TAO::Portable_Server::Servant_Upcall::system_id_ [protected]

Definition at line 205 of file Servant_Upcall.h.

Referenced by id().

CORBA::Octet TAO::Portable_Server::Servant_Upcall::system_id_buf_[TAO_POA_OBJECT_ID_BUF_SIZE] [protected]

Definition at line 204 of file Servant_Upcall.h.

const PortableServer::ObjectId* TAO::Portable_Server::Servant_Upcall::user_id_ [protected]

Definition at line 207 of file Servant_Upcall.h.

Referenced by user_id().


The documentation for this class was generated from the following files:
Generated on Tue Feb 2 17:41:50 2010 for TAO_PortableServer by  doxygen 1.4.7