Example #1
0
  Invocation_Status
  Asynch_Invocation_Adapter::invoke_collocated_i (
    TAO_Stub *stub,
    TAO_Operation_Details &details,
    CORBA::Object_var &effective_target,
    Collocation_Strategy strat)
  {
    if (stub->orb_core ()->orb_params ()->ami_collication ())
      {
        // When doing a collocation asynch invocation we shouldn't use the
        // stub args but use the skel args
        details.use_stub_args (false);

        TAO_AMI_Arguments_Converter_Impl* ami_arguments_converter
          = ACE_Dynamic_Service<TAO_AMI_Arguments_Converter_Impl>::instance (
            "AMI_Arguments_Converter");
        details.cac (ami_arguments_converter);

        // Release the owner ship of the reply dispatcher
        details.reply_dispatcher (this->safe_rd_.release ());

        return Invocation_Adapter::invoke_collocated_i (stub,
                                                        details,
                                                        effective_target,
                                                        strat);
      }
    else
      {
        ACE_Time_Value *max_wait_time = 0;
        return Invocation_Adapter::invoke_remote_i (stub,
                                                    details,
                                                    effective_target,
                                                    max_wait_time);
      }
  }
Example #2
0
  void
  Invocation_Adapter::set_response_flags (
    TAO_Stub *stub,
    TAO_Operation_Details &details)
  {
    switch (this->type_)
      {
      case TAO_ONEWAY_INVOCATION:
        {
          // Grab the syncscope policy from the ORB.
          Messaging::SyncScope sync_scope;

          bool has_synchronization = false;

          stub->orb_core ()->call_sync_scope_hook (stub,
                                                   has_synchronization,
                                                   sync_scope);
          if (has_synchronization)
            details.response_flags (CORBA::Octet (sync_scope));
          else
            details.response_flags (
              CORBA::Octet (Messaging::SYNC_WITH_TRANSPORT));
          break;
        }
      case TAO_TWOWAY_INVOCATION:
        {
          // @@note: Need to change this to something better. Too many
          // hash defines meaning the same things.
          details.response_flags (TAO_TWOWAY_RESPONSE_FLAG);
          break;
        }
      }
  }
Example #3
0
  Invocation_Status
  Invocation_Adapter::invoke_remote_i (TAO_Stub *stub,
                                       TAO_Operation_Details &details,
                                       CORBA::Object_var &effective_target,
                                       ACE_Time_Value *&max_wait_time,
                                       Invocation_Retry_State *retry_state)
  {
    (void) this->set_response_flags (stub, details);

    CORBA::Octet const rflags = details.response_flags ();
    bool const block_connect =
      rflags != static_cast<CORBA::Octet> (Messaging::SYNC_NONE)
      && rflags != static_cast<CORBA::Octet> (TAO::SYNC_DELAYED_BUFFERING);
    // Create the resolver which will pick (or create) for us a
    // transport and a profile from the effective_target.
    Profile_Transport_Resolver resolver (
      effective_target.in (),
      stub,
      block_connect);
    resolver.resolve (max_wait_time);

    if (TAO_debug_level)
      {
        if (max_wait_time && *max_wait_time == ACE_Time_Value::zero)
          TAOLIB_DEBUG ((LM_DEBUG,
                      ACE_TEXT ("TAO (%P|%t) - Invocation_Adapter::invoke_remote_i, ")
                      ACE_TEXT ("max wait time consumed during transport resolution\n")));
      }
    // Update the request id now that we have a transport
    if (resolver.transport ())
      {
        details.request_id (resolver.transport ()->tms ()->request_id ());
      }
    switch (this->type_)
      {
        case TAO_ONEWAY_INVOCATION:
          {
            return this->invoke_oneway (details,
                                        effective_target,
                                        resolver,
                                        max_wait_time);
          }
        case TAO_TWOWAY_INVOCATION:
          {
            return this->invoke_twoway (details,
                                        effective_target,
                                        resolver,
                                        max_wait_time,
                                        retry_state);

          }
      }
    return TAO_INVOKE_FAILURE;
  }
Example #4
0
// Constructor used in Thru-POA collocation code.
TAO_ServerRequest::TAO_ServerRequest (TAO_ORB_Core * orb_core,
                                      TAO_Operation_Details const & details,
                                      CORBA::Object_ptr target)
  : mesg_base_ (0),
    operation_ (details.opname ()),
    operation_len_ (details.opname_len ()),
    release_operation_ (false),
    is_forwarded_ (false),
    incoming_ (0),
    outgoing_ (0),
    response_expected_ (details.response_flags () == TAO_TWOWAY_RESPONSE_FLAG
                        || details.response_flags () == static_cast<CORBA::Octet> (Messaging::SYNC_WITH_SERVER)
                        || details.response_flags () == static_cast<CORBA::Octet> (Messaging::SYNC_WITH_TARGET)),
    deferred_reply_ (false),
    sync_with_server_ (details.response_flags () == static_cast<CORBA::Octet> (Messaging::SYNC_WITH_SERVER)),
    is_queued_ (false),
    is_dsi_ (false),
    reply_status_ (GIOP::NO_EXCEPTION),
    orb_core_ (orb_core),
    request_id_ (0),
    profile_ (orb_core),
    requesting_principal_ (0),
    dsi_nvlist_align_ (0),
    operation_details_ (&details),
    argument_flag_ (false)
#if TAO_HAS_INTERCEPTORS == 1
  , interceptor_count_ (0)
  , rs_pi_current_ (0)
  , caught_exception_ (0)
  , pi_reply_status_ (-1)
#endif  /* TAO_HAS_INTERCEPTORS == 1 */
  , transport_ (0)
{
  // Have to use a const_cast<>.  *sigh*
  this->profile_.object_key (
    const_cast<TAO::ObjectKey &> (target->_stubobj ()->object_key ()));

  // Shallow copy the request service context list. This way the operation
  // details and server request share the request context.
  IOP::ServiceContextList & dest_request_contexts =
    this->request_service_context_.service_info ();

  IOP::ServiceContextList & src_request_contexts =
    (const_cast <TAO_Operation_Details&> (details)).request_service_info ();

  dest_request_contexts.replace (src_request_contexts.maximum (),
                                 src_request_contexts.length (),
                                 src_request_contexts.get_buffer (),
                                 false /* Do not release. */);

  // Don't shallow copy the reply service context. It is probably empty,
  // when then during the request it is used, the buffer gets allocated and
  // then the operation details don't get the reply service context
}
int
TAO_BiDIR_Service_Context_Handler::generate_service_context (
  TAO_Stub *,
  TAO_Transport& transport,
  TAO_Operation_Details &opdetails,
  TAO_Target_Specification &,
  TAO_OutputCDR &msg)
{
  if (transport.orb_core ()->bidir_giop_policy () &&
      transport.messaging_object ()->is_ready_for_bidirectional (msg) &&
      transport.bidirectional_flag () < 0)
    {
      transport.set_bidir_context_info (opdetails);

      // Set the flag to 1 (i.e., originating side)
      transport.bidirectional_flag (1);

      // At the moment we enable BiDIR giop we have to get a new
      // request id to make sure that we follow the even/odd rule
      // for request id's. We only need to do this when enabled
      // it, after that the Transport Mux Strategy will make sure
      // that the rule is followed
      opdetails.request_id (transport.tms ()->request_id ());
    }

  return 0;
}
Example #6
0
  Invocation_Status
  Asynch_Invocation_Adapter::invoke_twoway (
    TAO_Operation_Details &op,
    CORBA::Object_var &effective_target,
    Profile_Transport_Resolver &r,
    ACE_Time_Value *&max_wait_time,
    Invocation_Retry_State *retry_state)
  {
    ACE_UNUSED_ARG (retry_state);

    // Simple sanity check
    if (this->mode_ != TAO_ASYNCHRONOUS_CALLBACK_INVOCATION
        || this->type_ != TAO_TWOWAY_INVOCATION)
      {
        throw ::CORBA::INTERNAL (
          CORBA::SystemException::_tao_minor_code (
            TAO::VMCID,
            EINVAL),
          CORBA::COMPLETED_NO);
      }

    if (this->safe_rd_.get () && r.transport ())
      {
        this->safe_rd_->transport (r.transport ());
        // AMI Timeout Handling Begin
        ACE_Time_Value tmp;

        if (this->get_timeout (r.stub (), tmp))
          {
            this->safe_rd_->schedule_timer (op.request_id (), *max_wait_time);
          }
      }

    // Loose ownership of the reply dispatcher
    TAO::Asynch_Remote_Invocation asynch (
       effective_target.in (),
       r,
       op,
       this->safe_rd_.release ());

    Invocation_Status const s = asynch.remote_invocation (max_wait_time);

    if (s == TAO_INVOKE_RESTART &&
        (asynch.reply_status () == GIOP::LOCATION_FORWARD ||
         asynch.reply_status () == GIOP::LOCATION_FORWARD_PERM))
      {
        CORBA::Boolean const permanent_forward =
          (asynch.reply_status () == GIOP::LOCATION_FORWARD_PERM);

        effective_target = asynch.steal_forwarded_reference ();

        this->object_forwarded (effective_target, r.stub (), permanent_forward);
      }

    return s;
  }
Example #7
0
  Invocation_Status
  DII_Invocation_Adapter::invoke_collocated_i (
    TAO_Stub *stub,
    TAO_Operation_Details &details,
    CORBA::Object_var &effective_target,
    Collocation_Strategy strat)
  {
    TAO_DII_Arguments_Converter_Impl* dii_arguments_converter
      = ACE_Dynamic_Service<TAO_DII_Arguments_Converter_Impl>::instance (
        "DII_Arguments_Converter");
    details.cac (dii_arguments_converter);

    return Invocation_Adapter::invoke_collocated_i (stub,
                                                    details,
                                                    effective_target,
                                                    strat);
  }
int
TAO_DiffServ_Service_Context_Handler::generate_service_context (
  TAO_Stub *stub,
  TAO_Transport&,
  TAO_Operation_Details &opdetails,
  TAO_Target_Specification &,
  TAO_OutputCDR &)
{
  if (stub)
    {
      CORBA::Policy_var cnpp =
        stub->get_cached_policy (TAO_CACHED_POLICY_CLIENT_NETWORK_PRIORITY);

      TAO::NetworkPriorityPolicy_var cnp =
         TAO::NetworkPriorityPolicy::_narrow (cnpp.in ());

      if (!CORBA::is_nil (cnp.in ()))
        {
          TAO::DiffservCodepoint const reply_diffserv_codepoint =
            cnp->reply_diffserv_codepoint ();

          CORBA::Long const rep_dscp_codepoint = reply_diffserv_codepoint;

          TAO_OutputCDR cdr;
          if (!(cdr << ACE_OutputCDR::from_boolean (TAO_ENCAP_BYTE_ORDER))
            || !(cdr << rep_dscp_codepoint))
            {
              throw CORBA::MARSHAL ();
            }

          opdetails.request_service_context ().set_context (IOP::REP_NWPRIORITY, cdr);
        }
    }

  return 0;
}
Example #9
0
  void
  Invocation_Adapter::invoke_i (TAO_Stub *stub, TAO_Operation_Details &details)
  {
    // 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 ());

    // Cache the target to a local variable.
    CORBA::Object_var effective_target =
      CORBA::Object::_duplicate (this->target_);

    // Initial state
    TAO::Invocation_Status status = TAO_INVOKE_START;
    ACE_Time_Value *max_wait_time = 0;
    ACE_Time_Value tmp_wait_time = ACE_Time_Value::zero;
    if (this->get_timeout (stub, tmp_wait_time))
      {
        max_wait_time= &tmp_wait_time;
      }

    TAO::Invocation_Retry_State retry_state (*stub);

    while (status == TAO_INVOKE_START || status == TAO_INVOKE_RESTART)
      {
        // Default we go to remote
        Collocation_Strategy strat = TAO_CS_REMOTE_STRATEGY;

        // If we have the opportunity for collocation we maybe
        // can use a collocated invocation.  Similarly, if the
        // target object reference contains a pointer to a servant,
        // the object reference also refers to a collocated object.
        // get the ORBStrategy
        strat = this->collocation_strategy (effective_target.in ());

        if (TAO_debug_level > 2)
          {
            TAOLIB_DEBUG ((LM_DEBUG,
              ACE_TEXT("TAO (%P|%t) - Invocation_Adapter::invoke_i, ")
              ACE_TEXT("making a %C invocation\n"),
              TAO::translate_collocation_strategy(strat)));
          }

        if (strat == TAO_CS_REMOTE_STRATEGY || strat == TAO_CS_LAST)
          {
            status =
              this->invoke_remote_i (stub,
                                     details,
                                     effective_target,
                                     max_wait_time,
                                     &retry_state);
          }
        else
          {
            if (strat == TAO_CS_THRU_POA_STRATEGY)
              {
                (void) this->set_response_flags (stub, details);
              }

            status =
              this->invoke_collocated_i (stub,
                                         details,
                                         effective_target,
                                         strat);
          }
        if (status == TAO_INVOKE_RESTART)
          {
            details.reset_request_service_info ();
            details.reset_reply_service_info ();

            if (TAO_debug_level > 2)
              {
                TAOLIB_DEBUG ((LM_DEBUG,
                  ACE_TEXT("TAO (%P|%t) - Invocation_Adapter::invoke_i, ")
                  ACE_TEXT("handling forwarded locations\n")));
              }
          }
      }
  }