Public Member Functions | Private Member Functions | Private Attributes

TAO::LocateRequest_Invocation_Adapter Class Reference

Adapter class for locate request invocations. More...

#include <LocateRequest_Invocation_Adapter.h>

Collaboration diagram for TAO::LocateRequest_Invocation_Adapter:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 LocateRequest_Invocation_Adapter (CORBA::Object_ptr target)
void invoke (void)
 Start the invocation on the target.
CORBA::PolicyList * get_inconsistent_policies (void)
 Accessor to the inconsistent policy list.

Private Member Functions

bool get_timeout (ACE_Time_Value &val)
void object_forwarded (CORBA::Object_var &effective_target, TAO_Stub *stub, CORBA::Boolean permanent_forward)

Private Attributes

CORBA::Object_ptr target_
CORBA::PolicyList_var list_

Detailed Description

Adapter class for locate request invocations.

This class provides a look and feel similar to the TAO::Invocation_Adapter though the functionalities are different. For the record, IDL compiler doesn't know the existence of this class. This class is concerned with the creation and invocation of locate request invocations to the target object

Todo:
Need to think what happens if the target is collocated. Looks like there are no ways to utilize the opportunity that may have been presented.

Definition at line 58 of file LocateRequest_Invocation_Adapter.h.


Constructor & Destructor Documentation

TAO::LocateRequest_Invocation_Adapter::LocateRequest_Invocation_Adapter ( CORBA::Object_ptr  target  ) 

Definition at line 3 of file LocateRequest_Invocation_Adapter.cpp.

               : LocateRequest_Invocation_Adapter.cpp 85483 2009-06-02 06:48:10Z johnnyw $")


Member Function Documentation

CORBA::PolicyList * TAO::LocateRequest_Invocation_Adapter::get_inconsistent_policies ( void   ) 

Accessor to the inconsistent policy list.

Definition at line 89 of file LocateRequest_Invocation_Adapter.cpp.

bool TAO::LocateRequest_Invocation_Adapter::get_timeout ( ACE_Time_Value val  )  [private]

Definition at line 95 of file LocateRequest_Invocation_Adapter.cpp.

          {
            this->list_ = resolver.steal_inconsistent_policies ();
            throw;
          }
      }

    return;

void TAO::LocateRequest_Invocation_Adapter::invoke ( void   ) 

Start the invocation on the target.

Definition at line 11 of file LocateRequest_Invocation_Adapter.cpp.

               : LocateRequest_Invocation_Adapter.cpp 85483 2009-06-02 06:48:10Z johnnyw $")

TAO_BEGIN_VERSIONED_NAMESPACE_DECL

namespace TAO
{
  LocateRequest_Invocation_Adapter::LocateRequest_Invocation_Adapter (
    CORBA::Object_ptr target)
    : target_ (target)
    , list_ (0)
  {
  }

  void
  LocateRequest_Invocation_Adapter::invoke (void)
  {
    CORBA::Object_var effective_target =
      CORBA::Object::_duplicate (this->target_);

    TAO_Stub * const stub =
      this->target_->_stubobj ();
    if (stub == 0)
      throw ::CORBA::INTERNAL (
                     CORBA::SystemException::_tao_minor_code (
                       0,
                         EINVAL),
                        CORBA::COMPLETED_NO);

    // The invocation has got to be within the context of the
    // corresponding ORB's configuration. Otherwise things like
    // timeout hooks, etc may not work as expected. Especially if
    // there are multiple ORB instances in the process, each with its
    // own, local configuration.
    ACE_Service_Config_Guard scg (stub->orb_core ()->configuration ());

    ACE_Time_Value tmp_wait_time;
    ACE_Time_Value *max_wait_time = 0;

    if (this->get_timeout (tmp_wait_time))
      max_wait_time = &tmp_wait_time;

    Invocation_Status s = TAO_INVOKE_START;

    while (s == TAO_INVOKE_START || s == TAO_INVOKE_RESTART)
      {
        Profile_Transport_Resolver resolver (effective_target.in (), stub, true);

        try
          {
            resolver.init_inconsistent_policies ();

            resolver.resolve (max_wait_time);

            if (!resolver.transport ())
              {
                // We failed to find a profile we could connect to.
                throw CORBA::TRANSIENT (CORBA::OMGVMCID | 2, CORBA::COMPLETED_NO);
              }

            // Dummy operation details that is used to instantiate the
            // LocateRequest class.
            TAO_Operation_Details op (0, 0);

            op.request_id (resolver.transport ()->tms ()->request_id ());
            TAO::LocateRequest_Invocation synch (this->target_, resolver, op);

            s = synch.invoke (max_wait_time);
            if (s == TAO_INVOKE_RESTART &&
                (synch.reply_status () == GIOP::LOCATION_FORWARD ||
                 synch.reply_status () == GIOP::LOCATION_FORWARD_PERM))
              {
                CORBA::Boolean const is_permanent_forward =

void TAO::LocateRequest_Invocation_Adapter::object_forwarded ( CORBA::Object_var effective_target,
TAO_Stub stub,
CORBA::Boolean  permanent_forward 
) [private]

Helper method that takes care of setting the profiles within the stub object if the target gets forwarded

Definition at line 106 of file LocateRequest_Invocation_Adapter.cpp.

  {
    return this->list_._retn ();
  }

  bool
  LocateRequest_Invocation_Adapter::get_timeout (ACE_Time_Value &timeout)
  {
    bool has_timeout = false;
    this->target_->orb_core ()->call_timeout_hook (this->target_->_stubobj (),
                                                   has_timeout,
                                                   timeout);

    return has_timeout;
  }

  void
  LocateRequest_Invocation_Adapter::object_forwarded (
    CORBA::Object_var &effective_target,
    TAO_Stub *stub,
    CORBA::Boolean permanent_forward)
  {
    // The object pointer has to be changed to a TAO_Stub pointer
    // in order to obtain the profiles.
    TAO_Stub *stubobj = 0;

    bool nil_forward_ref = false;
    if (CORBA::is_nil (effective_target.in ()))
      nil_forward_ref = true;
    else
      {
        stubobj =
          effective_target->_stubobj ();

        if (stubobj && stubobj->base_profiles ().size () == 0)
          nil_forward_ref = true;
      }

    if (nil_forward_ref)
      throw ::CORBA::TRANSIENT (
        CORBA::SystemException::_tao_minor_code (
          TAO_INVOCATION_LOCATION_FORWARD_MINOR_CODE,
          errno),
        CORBA::COMPLETED_NO);

    if (stubobj == 0)


Member Data Documentation

CORBA::PolicyList_var TAO::LocateRequest_Invocation_Adapter::list_ [private]

Definition at line 81 of file LocateRequest_Invocation_Adapter.h.

CORBA::Object_ptr TAO::LocateRequest_Invocation_Adapter::target_ [private]

Definition at line 80 of file LocateRequest_Invocation_Adapter.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines