Class: Mongo::Cluster::PeriodicExecutor Private
| Relationships & Source Files | |
| Super Chains via Extension / Inclusion / Inheritance | |
|
Instance Chain:
|
|
| Inherits: | Object |
| Defined in: | lib/mongo/cluster/periodic_executor.rb |
Overview
A manager that calls #execute on its executors at a regular interval.
Constant Summary
-
FREQUENCY =
# File 'lib/mongo/cluster/periodic_executor.rb', line 33
The default time interval for the periodic executor to execute.
5
::Mongo::Loggable - Included
Class Method Summary
-
.new(executors, options = {}) ⇒ PeriodicExecutor
constructor
Internal use only
Create a periodic executor.
Instance Attribute Summary
Instance Method Summary
- #do_work Internal use only
-
#execute
Internal use only
Trigger an execute call on each reaper.
-
#flush
Internal use only
Execute all pending operations.
- #pre_stop Internal use only
-
#restart!
Alias for BackgroundThread#run!.
- #stop(final = false) Internal use only
::Mongo::BackgroundThread - Included
| #run! | Start the background thread. |
| #stop! | Stop the background thread and wait for to terminate for a reasonable amount of time. |
| #do_work | Override this method to do the work in the background thread. |
| #pre_stop | Override this method to perform additional signaling for the background thread to stop. |
| #start!, | |
| #wait_for_stop | Waits for the thread to die, with a timeout. |
::Mongo::Loggable - Included
| #log_debug | Convenience method to log debug messages with the standard prefix. |
| #log_error | Convenience method to log error messages with the standard prefix. |
| #log_fatal | Convenience method to log fatal messages with the standard prefix. |
| #log_info | Convenience method to log info messages with the standard prefix. |
| #log_warn | Convenience method to log warn messages with the standard prefix. |
| #logger | Get the logger instance. |
| #_mongo_log_prefix, #format_message | |
Instance Attribute Details
#options (readonly)
# File 'lib/mongo/cluster/periodic_executor.rb', line 54
attr_reader :
Instance Method Details
#do_work
#execute
Trigger an execute call on each reaper.
# File 'lib/mongo/cluster/periodic_executor.rb', line 86
def execute @executors.each(&:execute) true end
#flush
Execute all pending operations.
# File 'lib/mongo/cluster/periodic_executor.rb', line 99
def flush @executors.each(&:flush) true end
#pre_stop
# File 'lib/mongo/cluster/periodic_executor.rb', line 63
def pre_stop @stop_semaphore.signal end
#restart!
Alias for BackgroundThread#run!.
# File 'lib/mongo/cluster/periodic_executor.rb', line 56
alias :restart! :run!
#stop(final = false)
# File 'lib/mongo/cluster/periodic_executor.rb', line 67
def stop(final = false) super begin flush rescue end true end