bes Updated for version 3.21.1
The Backend Server (BES) is the lower two tiers of the Hyrax data server
|
The master request service timer for this server; a singleton. More...
#include <RequestServiceTimer.h>
Public Member Functions | |
void | disable_timeout () |
Set the time_out is disabled. | |
std::string | dump (bool pretty=false) const |
void | dump (std::ostream &strm) const |
dumps information about this object | |
std::chrono::milliseconds | elapsed () const |
Return the time duration in milliseconds since the timer was started. | |
std::chrono::steady_clock::time_point | get_start_time () const |
bool | is_expired () const |
if the time_out is disabled return false. | |
bool | is_timeout_enabled () const |
std::chrono::milliseconds | remaining () const |
If the time_out is enabled returns the time remaining. If the time_out is disabled returns 0. | |
void | start (std::chrono::milliseconds timeout_ms) |
Set/Reset the timer start_time to now(). | |
void | throw_if_timeout_expired (const std::string &message, const std::string &file, const int line) |
Checks the RequestServiceTimer to determine if the time spent servicing the request at this point has exceeded the bes_timeout configuration element. If the request timeout has expired throw BESInternalFatalError. | |
Static Public Member Functions | |
static RequestServiceTimer * | TheTimer () |
Return a pointer to a singleton timer instance. If an instance does not exist it will create and initialize one. The initialization sets the start_time to now and time_out disabled. | |
The master request service timer for this server; a singleton.
Definition at line 41 of file RequestServiceTimer.h.
void RequestServiceTimer::disable_timeout | ( | ) |
Set the time_out is disabled.
Definition at line 144 of file RequestServiceTimer.cc.
Definition at line 149 of file RequestServiceTimer.cc.
void RequestServiceTimer::dump | ( | std::ostream & | strm | ) | const |
dumps information about this object
Displays the pointer value of this instance
strm | C++ i/o stream to dump the information to |
Definition at line 175 of file RequestServiceTimer.cc.
milliseconds RequestServiceTimer::elapsed | ( | ) | const |
Return the time duration in milliseconds since the timer was started.
Definition at line 103 of file RequestServiceTimer.cc.
|
inline |
Definition at line 62 of file RequestServiceTimer.h.
bool RequestServiceTimer::is_expired | ( | ) | const |
if the time_out is disabled return false.
If the time_out is enabled return false if there is time remaining else return true; the time_out has expired.
Definition at line 134 of file RequestServiceTimer.cc.
|
inline |
Definition at line 68 of file RequestServiceTimer.h.
milliseconds RequestServiceTimer::remaining | ( | ) | const |
If the time_out is enabled returns the time remaining. If the time_out is disabled returns 0.
The return value is only of interest if the timeout is enabled so checking is_timeout_enabled() is an important precondition before assessing the value of remaining().
Definition at line 115 of file RequestServiceTimer.cc.
void RequestServiceTimer::start | ( | std::chrono::milliseconds | timeout_ms | ) |
Set/Reset the timer start_time to now().
timeout_ms | the time_out, in milliseconds. A timeout_ms of 0 sets timeout_disabled to true. |
The RequestServiceTimer is a per request timer, the start method should be called prior to executing each request.
Definition at line 85 of file RequestServiceTimer.cc.
|
static |
Return a pointer to a singleton timer instance. If an instance does not exist it will create and initialize one. The initialization sets the start_time to now and time_out disabled.
Definition at line 59 of file RequestServiceTimer.cc.
void RequestServiceTimer::throw_if_timeout_expired | ( | const std::string & | message, |
const std::string & | file, | ||
const int | line ) |
Checks the RequestServiceTimer to determine if the time spent servicing the request at this point has exceeded the bes_timeout configuration element. If the request timeout has expired throw BESInternalFatalError.
message | to be delivered in error response. |
file | The file (FILE) that called this method |
line | The line (LINE) in the file that made the call to this method. |
Definition at line 190 of file RequestServiceTimer.cc.