Kea  2.1.7-git
isc::dhcp::TimerMgrImpl Class Reference

Implementation of the TimerMgr. More...

Public Member Functions

 TimerMgrImpl ()
 Constructor. More...
 
void cancel (const std::string &timer_name)
 Cancels the execution of the interval timer. More...
 
bool isTimerRegistered (const std::string &timer_name)
 Checks if the timer with a specified name has been registered. More...
 
void registerTimer (const std::string &timer_name, const asiolink::IntervalTimer::Callback &callback, const long interval, const asiolink::IntervalTimer::Mode &scheduling_mode)
 Registers new timer in the TimerMgr. More...
 
void setIOService (const IOServicePtr &io_service)
 Sets IO service to be used by the Timer Manager. More...
 
void setup (const std::string &timer_name)
 Schedules the execution of the interval timer. More...
 
size_t timersCount () const
 Returns the number of registered timers. More...
 
void unregisterTimer (const std::string &timer_name)
 Unregisters specified timer. More...
 
void unregisterTimers ()
 Unregisters all timers. More...
 

Detailed Description

Implementation of the TimerMgr.

Definition at line 83 of file timer_mgr.cc.

Constructor & Destructor Documentation

◆ TimerMgrImpl()

isc::dhcp::TimerMgrImpl::TimerMgrImpl ( )

Constructor.

Definition at line 234 of file timer_mgr.cc.

Referenced by isc::dhcp::TimerMgr::instance().

Member Function Documentation

◆ cancel()

void isc::dhcp::TimerMgrImpl::cancel ( const std::string &  timer_name)

Cancels the execution of the interval timer.

Parameters
timer_nameUnique timer name.
Exceptions
BadValueif the timer hasn't been registered.

Definition at line 394 of file timer_mgr.cc.

References isc::dhcp::DHCPSRV_DBG_TRACE_DETAIL, isc::dhcp::dhcpsrv_logger, isc::dhcp::DHCPSRV_TIMERMGR_CALLBACK_FAILED, isc::dhcp::DHCPSRV_TIMERMGR_RUN_TIMER_OPERATION, isc_throw, LOG_DEBUG, and LOG_ERROR.

◆ isTimerRegistered()

bool isc::dhcp::TimerMgrImpl::isTimerRegistered ( const std::string &  timer_name)

Checks if the timer with a specified name has been registered.

Parameters
timer_nameName of the timer.
Returns
true if the timer with the specified name has been registered, false otherwise.

Definition at line 346 of file timer_mgr.cc.

◆ registerTimer()

void isc::dhcp::TimerMgrImpl::registerTimer ( const std::string &  timer_name,
const asiolink::IntervalTimer::Callback callback,
const long  interval,
const asiolink::IntervalTimer::Mode scheduling_mode 
)

Registers new timer in the TimerMgr.

Parameters
timer_nameUnique name for the timer.
callbackPointer to the callback function to be invoked when the timer elapses, e.g. function processing expired leases in the DHCP server.
intervalTimer interval in milliseconds.
scheduling_modeScheduling mode of the timer as described in asiolink::IntervalTimer::Mode.
Exceptions
BadValueif the timer name is invalid or duplicate.

Definition at line 248 of file timer_mgr.cc.

References isc_throw.

◆ setIOService()

void isc::dhcp::TimerMgrImpl::setIOService ( const IOServicePtr io_service)

Sets IO service to be used by the Timer Manager.

Parameters
io_servicePointer to the new IO service.

Definition at line 239 of file timer_mgr.cc.

References isc_throw.

◆ setup()

void isc::dhcp::TimerMgrImpl::setup ( const std::string &  timer_name)

Schedules the execution of the interval timer.

This method schedules the timer, i.e. the callback will be executed after specified interval elapses. The interval has been specified during timer registration. Depending on the mode selected during the timer registration, the callback will be executed once after it has been scheduled or until it is cancelled. Though, in the former case the timer can be re-scheduled in the callback function.

Parameters
timer_nameUnique timer name.
Exceptions
BadValueif the timer hasn't been registered.

Definition at line 366 of file timer_mgr.cc.

References isc_throw.

◆ timersCount()

size_t isc::dhcp::TimerMgrImpl::timersCount ( ) const

Returns the number of registered timers.

Definition at line 356 of file timer_mgr.cc.

◆ unregisterTimer()

void isc::dhcp::TimerMgrImpl::unregisterTimer ( const std::string &  timer_name)

Unregisters specified timer.

This method cancels the timer if it is setup and removes the timer from the internal collection of timers.

Parameters
timer_nameName of the timer to be unregistered.
Exceptions
BadValueif the specified timer hasn't been registered.

Definition at line 288 of file timer_mgr.cc.

References isc_throw.

◆ unregisterTimers()

void isc::dhcp::TimerMgrImpl::unregisterTimers ( )

Unregisters all timers.

This method must be explicitly called prior to termination of the process.

Definition at line 316 of file timer_mgr.cc.


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