Example #1
0
TAO::Invocation_Retry_State::Invocation_Retry_State (TAO_Stub &stub)
  : forward_on_reply_closed_count_ (0)
  , forward_on_exception_limit_used_ (false)
{
  this->ex_count_map_[FOE_OBJECT_NOT_EXIST] = 0;
  this->ex_count_map_[FOE_COMM_FAILURE] = 0;
  this->ex_count_map_[FOE_TRANSIENT] = 0;
  this->ex_count_map_[FOE_INV_OBJREF] = 0;

  // Cast away const to avoid tedious iterator operations on the ACE_Array_Map.
  TAO::Invocation_Retry_Params &command_line_params =
    const_cast<TAO::Invocation_Retry_Params &> (stub.orb_core ()
      ->orb_params ()->invocation_retry_params ());
  TAO::Invocation_Retry_Params &client_factory_params =
    const_cast<TAO::Invocation_Retry_Params &> (stub.orb_core ()
      ->client_factory ()->invocation_retry_params ());

  retry_params_calc(command_line_params,
                    client_factory_params,
                    this->retry_params_);

  for (Invocation_Retry_Params::exception_limit_map_type::const_iterator i =
         this->retry_params_.forward_on_exception_limit_.begin();
       i != this->retry_params_.forward_on_exception_limit_.end(); ++i)
    {
      if (i->second > 0)
        {
          forward_on_exception_limit_used_ = true;
          break;
        }
    }
}
Example #2
0
  void
  Asynch_Invocation_Adapter::invoke (
    Messaging::ReplyHandler_ptr reply_handler_ptr,
    const TAO_Reply_Handler_Stub &reply_handler_stub)
  {
    TAO_Stub * stub =
      this->get_stub ();

    if (TAO_debug_level >= 4)
      {
        TAOLIB_DEBUG ((LM_DEBUG,
                    "TAO_Messaging (%P|%t) - Asynch_Invocation_Adapter::"
                    "invoke\n"));
      }

    // If the reply handler is nil, we do not create a reply dispatcher.
    // The ORB will drop replies to which it cannot associate a reply
    // dispatcher.
    if (!CORBA::is_nil (reply_handler_ptr))
      {
        // New reply dispatcher on the heap or allocator, because
        // we will go out of scope and hand over the reply dispatcher
        // to the ORB.
        TAO_Asynch_Reply_Dispatcher *rd = 0;

        // Get the allocator we could use.
        ACE_Allocator* ami_allocator =
          stub->orb_core ()->lane_resources().ami_response_handler_allocator();

        // If we have an allocator, use it, else use the heap.
        if (ami_allocator)
          {
            ACE_NEW_MALLOC (
              rd,
              static_cast<TAO_Asynch_Reply_Dispatcher *> (
                ami_allocator->malloc (sizeof (TAO_Asynch_Reply_Dispatcher))),
              TAO_Asynch_Reply_Dispatcher (reply_handler_stub,
                                           reply_handler_ptr,
                                           stub->orb_core (),
                                           ami_allocator));
          }
        else
          {
            ACE_NEW (rd,
                     TAO_Asynch_Reply_Dispatcher (reply_handler_stub,
                                                  reply_handler_ptr,
                                                  stub->orb_core (),
                                                  0));
          }

        if (rd == 0)
          {
            throw ::CORBA::NO_MEMORY ();
          }

        this->safe_rd_.reset (rd);
      }

    Invocation_Adapter::invoke (0, 0);
  }