Class: Cadence::Activity::Poller
- Inherits:
-
Object
- Object
- Cadence::Activity::Poller
- Defined in:
- lib/cadence/activity/poller.rb
Constant Summary collapse
- DEFAULT_OPTIONS =
{ thread_pool_size: 20 }.freeze
Instance Method Summary collapse
-
#initialize(domain, task_list, activity_lookup, middleware = [], options = {}) ⇒ Poller
constructor
A new instance of Poller.
- #start ⇒ Object
- #stop ⇒ Object
- #wait ⇒ Object
Constructor Details
#initialize(domain, task_list, activity_lookup, middleware = [], options = {}) ⇒ Poller
Returns a new instance of Poller.
13 14 15 16 17 18 19 20 |
# File 'lib/cadence/activity/poller.rb', line 13 def initialize(domain, task_list, activity_lookup, middleware = [], = {}) @domain = domain @task_list = task_list @activity_lookup = activity_lookup @middleware = middleware @options = DEFAULT_OPTIONS.merge() @shutting_down = false end |
Instance Method Details
#start ⇒ Object
22 23 24 25 |
# File 'lib/cadence/activity/poller.rb', line 22 def start @shutting_down = false @thread = Thread.new(&method(:poll_loop)) end |
#stop ⇒ Object
27 28 29 30 |
# File 'lib/cadence/activity/poller.rb', line 27 def stop @shutting_down = true Cadence.logger.info('Shutting down activity poller') end |
#wait ⇒ Object
32 33 34 35 |
# File 'lib/cadence/activity/poller.rb', line 32 def wait thread.join thread_pool.shutdown end |