#include <AsyncJob.h>
Public Types | |
typedef CbcPointer< AsyncJob > | Pointer |
Public Member Functions | |
AsyncJob (const char *aTypeName) | |
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 | callException (const std::exception &e) |
called when the job throws during an async call More... | |
void | handleStopRequest () |
process external request to terminate now (i.e. during this async call) More... | |
virtual void * | toCbdata ()=0 |
Static Public Member Functions | |
static void | Start (const Pointer &job) |
static void | RegisterWithCacheManager () |
Public Attributes | |
const InstanceId< AsyncJob > | id |
job identifier More... | |
Protected Member Functions | |
void | deleteThis (const char *aReason) |
void | mustStop (const char *aReason) |
bool | done () const |
the job is destroyed in callEnd() when done() More... | |
virtual void | start () |
called by AsyncStart; do not call directly More... | |
virtual bool | doneAll () const |
whether positive goal has been reached More... | |
virtual void | swanSong () |
virtual const char * | status () const |
internal cleanup; do not call directly More... | |
~AsyncJob () override | |
Static Protected Member Functions | |
static void | ReportAllJobs (StoreEntry *) |
writes a cache manager report about all jobs existing in this worker More... | |
Protected Attributes | |
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... | |
bool | started_ = false |
Start() has finished successfully. More... | |
bool | swanSang_ = false |
swanSong() was called More... | |
Private Member Functions | |
virtual void | finalizedInCbdataChild ()=0 |
hack: ensure CBDATA_CHILD() after a toCbdata()-defining CBDATA_INTERMEDIATE() More... | |
Detailed Description
Base class for all asynchronous jobs
Definition at line 31 of file AsyncJob.h.
Member Typedef Documentation
◆ Pointer
typedef CbcPointer<AsyncJob> AsyncJob::Pointer |
Definition at line 34 of file AsyncJob.h.
Constructor & Destructor Documentation
◆ AsyncJob()
AsyncJob::AsyncJob | ( | const char * | aTypeName | ) |
Definition at line 43 of file AsyncJob.cc.
◆ ~AsyncJob()
|
overrideprotected |
Member Function Documentation
◆ callEnd()
|
virtual |
called right after the called job method
Reimplemented in Adaptation::Icap::Xaction.
Definition at line 152 of file AsyncJob.cc.
References assert, AsyncCall::debugLevel, debugs, AsyncCall::debugSection, done(), inCall, started_, status(), swanSang_, swanSong(), and typeName.
Referenced by Adaptation::Icap::Xaction::callEnd(), and deleteThis().
◆ callException()
|
virtual |
Reimplemented in ConnStateData, ClientHttpRequest, Adaptation::Icap::ModXact, Adaptation::Icap::ServiceRep, Adaptation::Icap::Xaction, Ipc::Forwarder, Ipc::Inquirer, and Ftp::Server.
Definition at line 143 of file AsyncJob.cc.
References cbdataReferenceValid(), debugs, Must, mustStop(), and CbdataParent::toCbdata().
Referenced by ConnStateData::callException(), Adaptation::Icap::Xaction::callException(), Ipc::Forwarder::callException(), Ipc::Inquirer::callException(), and Ftp::Server::callException().
◆ callStart()
void AsyncJob::callStart | ( | AsyncCall & | call | ) |
called just before the called method
Definition at line 130 of file AsyncJob.cc.
References cbdataReferenceValid(), AsyncCall::debugLevel, debugs, AsyncCall::debugSection, inCall, Must, status(), CbdataParent::toCbdata(), and typeName.
◆ canBeCalled()
bool AsyncJob::canBeCalled | ( | AsyncCall & | call | ) | const |
Definition at line 117 of file AsyncJob.cc.
References AsyncCall::cancel(), debugs, and inCall.
◆ deleteThis()
|
protected |
Definition at line 65 of file AsyncJob.cc.
References asyncCall(), callEnd(), debugs, deleteThis(), inCall, JobMemFun(), Must, stopReason, and typeName.
Referenced by ConnStateData::connStateClosed(), and deleteThis().
◆ done()
|
protected |
Definition at line 106 of file AsyncJob.cc.
References doneAll(), and stopReason.
Referenced by callEnd(), HappyConnOpener::checkForNewConnection(), Downloader::downloadFinished(), and HappyConnOpener::maybeOpenPrimeConnection().
◆ doneAll()
|
protectedvirtual |
Reimplemented in Adaptation::AccessCheck, Adaptation::Ecap::XactionRep, Adaptation::Icap::Launcher, Adaptation::Icap::ModXact, Adaptation::Icap::ServiceRep, Adaptation::Icap::Xaction, Adaptation::Iterator, BodySink, ConnStateData, ClientHttpRequest, Client, Http::Tunneler, Comm::ConnOpener, Comm::TcpAcceptor, Downloader, Rock::HeaderUpdater, Rock::Rebuild, HappyConnOpener, Ipc::Forwarder, Ipc::Inquirer, Ipc::Port, Ipc::UdsSender, Log::TcpLogger, Mgr::Inquirer, Mgr::StoreToCommWriter, PeerPoolMgr, Security::PeerConnector, Server, and Snmp::Inquirer.
Definition at line 112 of file AsyncJob.cc.
Referenced by done(), Adaptation::Ecap::XactionRep::doneAll(), Adaptation::Icap::Launcher::doneAll(), Adaptation::Icap::ServiceRep::doneAll(), Adaptation::Icap::Xaction::doneAll(), Adaptation::Iterator::doneAll(), BodySink::doneAll(), ConnStateData::doneAll(), ClientHttpRequest::doneAll(), Client::doneAll(), Comm::ConnOpener::doneAll(), Comm::TcpAcceptor::doneAll(), Downloader::doneAll(), Rock::HeaderUpdater::doneAll(), Rock::Rebuild::doneAll(), Ipc::UdsSender::doneAll(), Log::TcpLogger::doneAll(), PeerPoolMgr::doneAll(), Security::PeerConnector::doneAll(), and Server::doneAll().
◆ finalizedInCbdataChild()
|
privatepure virtualinherited |
◆ handleStopRequest()
|
inline |
Definition at line 73 of file AsyncJob.h.
References mustStop().
◆ mustStop()
|
protected |
Definition at line 85 of file AsyncJob.cc.
References debugs, inCall, Must, stopReason, and typeName.
Referenced by HttpStateData::abortAll(), callException(), HttpStateData::continueAfterParsingHeader(), HttpStateData::drop1xx(), HttpStateData::handleMoreRequestBodyAvailable(), handleStopRequest(), HttpStateData::httpStateConnClosed(), HttpStateData::httpTimeout(), HttpStateData::proceedAfter1xx(), ConnStateData::proxyProtocolError(), HttpStateData::readReply(), HttpStateData::start(), and HttpStateData::wroteLast().
◆ RegisterWithCacheManager()
|
static |
Definition at line 215 of file AsyncJob.cc.
References Mgr::RegisterAction(), and ReportAllJobs().
Referenced by mainInitialize().
◆ ReportAllJobs()
|
staticprotected |
Definition at line 198 of file AsyncJob.cc.
References AllJobs().
Referenced by RegisterWithCacheManager().
◆ start()
|
protectedvirtual |
Reimplemented in Adaptation::AccessCheck, Adaptation::Ecap::XactionRep, Adaptation::Icap::Launcher, Adaptation::Icap::ModXact, Adaptation::Icap::OptXact, Adaptation::Icap::Xaction, Adaptation::Iterator, ConnStateData, Ftp::Client, Ftp::Gateway, Ftp::Relay, Http::Tunneler, Comm::ConnOpener, Comm::TcpAcceptor, Downloader, Rock::HeaderUpdater, Rock::Rebuild, HappyConnOpener, HttpStateData, Ipc::Coordinator, Ipc::Forwarder, Ipc::Inquirer, Ipc::Strand, Ipc::UdsSender, Log::TcpLogger, Mgr::ActionWriter, Mgr::Filler, Mgr::Inquirer, Mgr::StoreToCommWriter, PeerPoolMgr, Security::PeerConnector, Ftp::Server, Http::One::Server, Server, Snmp::Inquirer, and Ipc::Port.
Definition at line 59 of file AsyncJob.cc.
Referenced by Adaptation::AccessCheck::start(), Adaptation::Icap::Launcher::start(), Adaptation::Icap::Xaction::start(), Adaptation::Iterator::start(), ConnStateData::start(), Http::Tunneler::start(), Ipc::UdsSender::start(), PeerPoolMgr::start(), Security::PeerConnector::start(), Ipc::Port::start(), and Start().
◆ Start()
|
static |
Promises to start the configured job (eventually). The job is deemed to be running asynchronously beyond this point, so the caller should only access the job object via AsyncCalls rather than directly.
swanSong() is only called for jobs for which this method has returned successfully (i.e. without throwing).
Definition at line 37 of file AsyncJob.cc.
References CallJobHere, start(), and started_.
Referenced by Ftp::Server::AcceptCtrlConnection(), clientListenerConnectionOpened(), Ipc::Coordinator::handleCacheMgrRequest(), Ipc::Coordinator::handleSnmpRequest(), httpAccept(), httpsAccept(), httpStart(), idnsInitVC(), Ftp::Gateway::listenForDataChannel(), Ftp::Server::listenForDataConnection(), Log::TcpLogger::Open(), peerProbeConnect(), Mgr::FunAction::respond(), Mgr::InfoAction::respond(), Ipc::SendMessage(), Mgr::Inquirer::sendResponse(), snmpConstructReponse(), SquidMain(), CacheManager::start(), Adaptation::AccessCheck::Start(), Rock::Rebuild::Start(), JobWaitBase::start_(), BodyPipe::startAutoConsumptionIfNeeded(), Ftp::StartGateway(), Ftp::StartRelay(), PeerPoolMgrsRr::syncConfig(), and Rock::SwapDir::updateHeaders().
◆ status()
|
protectedvirtual |
for debugging, starts with space
Reimplemented in Adaptation::Ecap::XactionRep, Adaptation::Icap::ServiceRep, Adaptation::Icap::Xaction, Adaptation::Initiate, Http::Tunneler, Comm::TcpAcceptor, HappyConnOpener, Ipc::Inquirer, and Security::PeerConnector.
Definition at line 182 of file AsyncJob.cc.
References MemBuf::append(), Packable::appendf(), MemBuf::content(), MemBuf::reset(), stopReason, and MemBuf::terminate().
Referenced by callEnd(), callStart(), Adaptation::Initiate::status(), and Comm::TcpAcceptor::status().
◆ swanSong()
|
inlineprotectedvirtual |
Reimplemented in Adaptation::Ecap::XactionRep, Adaptation::Icap::Launcher, Adaptation::Icap::ModXact, Adaptation::Icap::ModXactLauncher, Adaptation::Icap::OptXact, Adaptation::Icap::Xaction, Adaptation::Initiate, Adaptation::Iterator, ConnStateData, Client, Ftp::Relay, Http::Tunneler, Comm::ConnOpener, Comm::TcpAcceptor, Downloader, Rock::HeaderUpdater, Rock::Rebuild, HappyConnOpener, Ipc::Forwarder, Ipc::Inquirer, Ipc::UdsSender, Log::TcpLogger, Mgr::Filler, Mgr::Forwarder, Mgr::StoreToCommWriter, PeerPoolMgr, Security::PeerConnector, Server, and Snmp::Forwarder.
Definition at line 61 of file AsyncJob.h.
Referenced by callEnd(), Client::swanSong(), Http::Tunneler::swanSong(), Comm::ConnOpener::swanSong(), Comm::TcpAcceptor::swanSong(), Rock::HeaderUpdater::swanSong(), HappyConnOpener::swanSong(), Ipc::UdsSender::swanSong(), Log::TcpLogger::swanSong(), PeerPoolMgr::swanSong(), Security::PeerConnector::swanSong(), and Server::swanSong().
◆ toCbdata()
|
pure virtualinherited |
Referenced by callException(), and callStart().
Member Data Documentation
◆ id
const InstanceId<AsyncJob> AsyncJob::id |
Definition at line 75 of file AsyncJob.h.
◆ inCall
|
protected |
Definition at line 86 of file AsyncJob.h.
Referenced by callEnd(), callStart(), canBeCalled(), deleteThis(), and mustStop().
◆ started_
|
protected |
Definition at line 88 of file AsyncJob.h.
Referenced by ~AsyncJob(), callEnd(), and Start().
◆ stopReason
|
protected |
Definition at line 84 of file AsyncJob.h.
Referenced by deleteThis(), done(), mustStop(), status(), and HappyConnOpener::status().
◆ swanSang_
|
protected |
Definition at line 89 of file AsyncJob.h.
Referenced by ~AsyncJob(), and callEnd().
◆ typeName
|
protected |
Definition at line 85 of file AsyncJob.h.
Referenced by AsyncJob(), Adaptation::Icap::Xaction::Xaction(), ~AsyncJob(), callEnd(), callStart(), deleteThis(), and mustStop().
The documentation for this class was generated from the following files:
- src/base/AsyncJob.h
- src/base/AsyncJob.cc