#include <Forwarder.h>

Inheritance diagram for Ipc::Forwarder:
Collaboration diagram for Ipc::Forwarder:

Public Types

typedef CbcPointer< AsyncJobPointer
 

Public Member Functions

 Forwarder (Request::Pointer aRequest, double aTimeout)
 
virtual ~Forwarder ()
 
virtual void callException (const std::exception &e)
 called when the job throws during an async call More...
 
bool canBeCalled (AsyncCall &call) const
 whether we can be called More...
 
void callStart (AsyncCall &call)
 
virtual void callEnd ()
 called right after the called job method More...
 
virtual void * toCbdata ()=0
 

Static Public Member Functions

static void HandleRemoteAck (unsigned int requestId)
 finds and calls the right Forwarder upon Coordinator's response More...
 
static Pointer Start (AsyncJob *job)
 starts a freshly created job (i.e., makes the job asynchronous) More...
 

Protected Types

typedef std::map< unsigned int,
AsyncCall::Pointer
RequestsMap
 maps request->id to Forwarder::handleRemoteAck callback More...
 

Protected Member Functions

virtual void start ()
 called by AsyncStart; do not call directly More...
 
virtual void swanSong ()
 
virtual bool doneAll () const
 whether positive goal has been reached More...
 
virtual void cleanup ()
 perform cleanup actions More...
 
virtual void handleError ()
 
virtual void handleTimeout ()
 
virtual void handleException (const std::exception &e)
 terminate with an error More...
 
void deleteThis (const char *aReason)
 
void mustStop (const char *aReason)
 
bool done () const
 the job is destroyed in callEnd() when done() More...
 
virtual const char * status () const
 internal cleanup; do not call directly More...
 

Protected Attributes

Request::Pointer request
 
const double timeout
 response wait timeout in seconds More...
 
const char * stopReason
 reason for forcing done() to be true More...
 
const char * typeName
 kid (leaf) class name, for debugging More...
 
AsyncCall::Pointer inCall
 the asynchronous call being handled, if any More...
 
const InstanceId< AsyncJobid
 job identifier More...
 

Static Protected Attributes

static RequestsMap TheRequestsMap
 pending Coordinator requests More...
 
static unsigned int LastRequestId = 0
 last requestId used More...
 

Private Member Functions

 CBDATA_CLASS (Forwarder)
 
void requestTimedOut ()
 called when Coordinator fails to start processing the request [in time] More...
 
void removeTimeoutEvent ()
 called when we are no longer waiting for Coordinator to respond More...
 
void handleRemoteAck ()
 called when Coordinator starts processing the request More...
 

Static Private Member Functions

static void RequestTimedOut (void *param)
 Ipc::Forwarder::requestTimedOut wrapper. More...
 
static AsyncCall::Pointer DequeueRequest (unsigned int requestId)
 returns and forgets the right Forwarder callback for the request More...
 

Detailed Description

Forwards a worker request to coordinator. Waits for an ACK from Coordinator Send the data unit with an error response if forwarding fails.

Definition at line 28 of file Forwarder.h.

Member Typedef Documentation

Definition at line 34 of file AsyncJob.h.

typedef std::map<unsigned int, AsyncCall::Pointer> Ipc::Forwarder::RequestsMap
protected

Definition at line 67 of file Forwarder.h.

Constructor & Destructor Documentation

Ipc::Forwarder::Forwarder ( Request::Pointer  aRequest,
double  aTimeout 
)

Definition at line 26 of file Forwarder.cc.

References debugs, and HERE().

Ipc::Forwarder::~Forwarder ( )
virtual

Reimplemented in Mgr::Forwarder.

Definition at line 33 of file Forwarder.cc.

References debugs, HERE(), Must, and request().

Member Function Documentation

void AsyncJob::callEnd ( )
virtualinherited
void Ipc::Forwarder::callException ( const std::exception &  e)
virtual

Reimplemented from AsyncJob.

Definition at line 142 of file Forwarder.cc.

References AsyncJob::callException(), DBG_CRITICAL, debugs, and HERE().

void AsyncJob::callStart ( AsyncCall call)
inherited
bool AsyncJob::canBeCalled ( AsyncCall call) const
inherited

Definition at line 101 of file AsyncJob.cc.

References AsyncCall::cancel(), debugs, HERE(), AsyncJob::inCall, and NULL.

Ipc::Forwarder::CBDATA_CLASS ( Forwarder  )
private
void Ipc::Forwarder::cleanup ( )
protectedvirtual

Reimplemented in Mgr::Forwarder, and Snmp::Forwarder.

Definition at line 42 of file Forwarder.cc.

void AsyncJob::deleteThis ( const char *  aReason)
protectedinherited
AsyncCall::Pointer Ipc::Forwarder::DequeueRequest ( unsigned int  requestId)
staticprivate

Definition at line 154 of file Forwarder.cc.

References debugs, HERE(), Must, NULL, and request().

bool AsyncJob::done ( ) const
protectedinherited

Definition at line 90 of file AsyncJob.cc.

References AsyncJob::doneAll(), NULL, and AsyncJob::stopReason.

Referenced by AsyncJob::callEnd(), and Downloader::downloadFinished().

bool Ipc::Forwarder::doneAll ( ) const
protectedvirtual

Reimplemented from AsyncJob.

Definition at line 86 of file Forwarder.cc.

References debugs, HERE(), and request().

void Ipc::Forwarder::handleError ( )
protectedvirtual

Reimplemented in Mgr::Forwarder.

Definition at line 122 of file Forwarder.cc.

void Ipc::Forwarder::handleException ( const std::exception &  e)
protectedvirtual

Reimplemented in Mgr::Forwarder, and Snmp::Forwarder.

Definition at line 135 of file Forwarder.cc.

References debugs, and HERE().

Referenced by Snmp::Forwarder::handleException(), and Mgr::Forwarder::handleException().

void Ipc::Forwarder::HandleRemoteAck ( unsigned int  requestId)
static
void Ipc::Forwarder::handleRemoteAck ( )
private

Definition at line 94 of file Forwarder.cc.

References debugs, HERE(), and request().

Referenced by start().

void Ipc::Forwarder::handleTimeout ( )
protectedvirtual

Reimplemented in Mgr::Forwarder, and Snmp::Forwarder.

Definition at line 128 of file Forwarder.cc.

Referenced by Snmp::Forwarder::handleTimeout(), and Mgr::Forwarder::handleTimeout().

void Ipc::Forwarder::removeTimeoutEvent ( )
private

Definition at line 170 of file Forwarder.cc.

References eventDelete(), eventFind(), and RequestTimedOut().

void Ipc::Forwarder::RequestTimedOut ( void *  param)
staticprivate

Definition at line 104 of file Forwarder.cc.

References CallJobHere, debugs, HERE(), Must, and NULL.

Referenced by removeTimeoutEvent(), and start().

void Ipc::Forwarder::requestTimedOut ( )
private

Definition at line 115 of file Forwarder.cc.

References debugs, and HERE().

void Ipc::Forwarder::start ( )
protectedvirtual
void Ipc::Forwarder::swanSong ( )
protectedvirtual

Reimplemented from AsyncJob.

Definition at line 74 of file Forwarder.cc.

References debugs, HERE(), and request().

virtual void* CbdataParent::toCbdata ( )
pure virtualinherited

Member Data Documentation

const InstanceId<AsyncJob> AsyncJob::id
protectedinherited

Definition at line 70 of file AsyncJob.h.

AsyncCall::Pointer AsyncJob::inCall
protectedinherited
unsigned int Ipc::Forwarder::LastRequestId = 0
staticprotected

Definition at line 70 of file Forwarder.h.

Request::Pointer Ipc::Forwarder::request
protected

Definition at line 63 of file Forwarder.h.

const char* AsyncJob::stopReason
protectedinherited
Ipc::Forwarder::RequestsMap Ipc::Forwarder::TheRequestsMap
staticprotected

Definition at line 68 of file Forwarder.h.

const double Ipc::Forwarder::timeout
protected

Definition at line 64 of file Forwarder.h.


The documentation for this class was generated from the following files:

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors