Public Member Functions | Protected Member Functions | Protected Attributes

TAO_Notify_Supplier Class Reference

Base Wrappers for Suppliers that connect to the EventChannel. More...

#include <Supplier.h>

Inheritance diagram for TAO_Notify_Supplier:
Inheritance graph
[legend]
Collaboration diagram for TAO_Notify_Supplier:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 TAO_Notify_Supplier (TAO_Notify_ProxyConsumer *proxy)
 Constructor.
virtual ~TAO_Notify_Supplier ()
 Destructor.
TAO_Notify_ProxyConsumerproxy_consumer (void)
 Access Specific Proxy.
virtual TAO_Notify_Proxyproxy (void)
 Access Base Proxy.
virtual CORBA::Object_ptr get_supplier (void)=0
bool is_alive (bool allow_nil_supplier)

Protected Member Functions

virtual void dispatch_updates_i (const CosNotification::EventTypeSeq &added, const CosNotification::EventTypeSeq &removed)
 Dispatch updates implementation.

Protected Attributes

TAO_Notify_ProxyConsumerproxy_
 The proxy that we associate with.
CosNotifyComm::NotifySubscribe_var subscribe_
 Interface that accepts subscription_changes.
CORBA::Object_var rtt_obj_

Detailed Description

Base Wrappers for Suppliers that connect to the EventChannel.

Definition at line 35 of file Supplier.h.


Constructor & Destructor Documentation

TAO_Notify_Supplier::TAO_Notify_Supplier ( TAO_Notify_ProxyConsumer proxy  ) 

Constructor.

Definition at line 25 of file Supplier.cpp.

  : proxy_ (proxy)
{
}

TAO_Notify_Supplier::~TAO_Notify_Supplier (  )  [virtual]

Destructor.

Definition at line 30 of file Supplier.cpp.

{
}


Member Function Documentation

void TAO_Notify_Supplier::dispatch_updates_i ( const CosNotification::EventTypeSeq added,
const CosNotification::EventTypeSeq removed 
) [protected, virtual]

Dispatch updates implementation.

Implements TAO_Notify_Peer.

Definition at line 41 of file Supplier.cpp.

{
  if (!CORBA::is_nil (this->subscribe_.in ()))
    this->subscribe_->subscription_change (added, removed);
}

virtual CORBA::Object_ptr TAO_Notify_Supplier::get_supplier ( void   )  [pure virtual]
bool TAO_Notify_Supplier::is_alive ( bool  allow_nil_supplier  ) 

Definition at line 52 of file Supplier.cpp.

{
  bool status = false;
  CORBA::Object_var supplier = this->get_supplier ();
  if (CORBA::is_nil (supplier.in ()))
  {
    // The supplier may not connected or the supplier did
    // not provide a callback. In this case, the liveliness
    // check should return true so it will be validated in 
    // next period. 
    if (allow_nil_supplier)
      return true;
    else
      return status;
  }

  CORBA::PolicyList policy_list;
  try
    {
      bool do_liveliness_check = false;
      ACE_Time_Value now = ACE_OS::gettimeofday ();
      ACE_Time_Value last_ping = proxy_->last_ping();
      if (CORBA::is_nil (this->rtt_obj_.in ()))
      {
        // We need to determine if the supplier on the other end is still
        // alive.  Since we may be in an upcall from the owner of the
        // original supplier, we have to put a timeout on the call in case
        // the client side is not processing ORB requests at this time.  In
        // the event that the timeout exception occurs, we will assume that
        // the original supplier is still around.  If we get any other
        // exception we will say that the original supplier is not
        // available anymore.
        TimeBase::TimeT timeout = 10000000;
        CORBA::Any timeout_any;
        timeout_any <<= timeout;

        policy_list.length (1);
        policy_list[0] = TAO_Notify_PROPERTIES::instance()->orb()->
                          create_policy (
                                Messaging::RELATIVE_RT_TIMEOUT_POLICY_TYPE,
                                timeout_any);
        rtt_obj_ =
          supplier->_set_policy_overrides (policy_list,
                                          CORBA::ADD_OVERRIDE);

        // Clean up the policy that was allocated in the try/catch
        for (CORBA::ULong i = 0; i < policy_list.length (); i++)
          policy_list[i]->destroy ();

        do_liveliness_check 
          = (last_ping == ACE_Time_Value::zero ? true 
          : now - last_ping >= TAO_Notify_PROPERTIES::instance()->validate_client_delay ());
      }
      else
        do_liveliness_check = 
          now - last_ping >= TAO_Notify_PROPERTIES::instance()->validate_client_interval ();

      if (CORBA::is_nil (rtt_obj_.in ()))
        status = false;
      else if (do_liveliness_check || allow_nil_supplier)
      {
        this->proxy_->last_ping (now);
        status = !rtt_obj_->_non_existent ();
      }
      else
        status = true;
    }
  catch (CORBA::TIMEOUT&)
    {
       status = true;
    }
  catch (CORBA::Exception& ex)
    {
      if (DEBUG_LEVEL > 0)
      {        
        ex._tao_print_exception ("TAO_Notify_Supplier::is_alive: false");
      }
    }

  return status;
}

TAO_Notify_Proxy * TAO_Notify_Supplier::proxy ( void   )  [virtual]

Access Base Proxy.

Implements TAO_Notify_Peer.

Definition at line 35 of file Supplier.cpp.

{
  return this->proxy_consumer ();
}

TAO_Notify_ProxyConsumer * TAO_Notify_Supplier::proxy_consumer ( void   ) 

Access Specific Proxy.

Definition at line 8 of file Supplier.inl.

{
  return this->proxy_;
}


Member Data Documentation

The proxy that we associate with.

Definition at line 61 of file Supplier.h.

Definition at line 66 of file Supplier.h.

CosNotifyComm::NotifySubscribe_var TAO_Notify_Supplier::subscribe_ [protected]

Interface that accepts subscription_changes.

Definition at line 64 of file Supplier.h.


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