Class: Shoryuken::Manager
- Inherits:
-
Object
- Object
- Shoryuken::Manager
show all
- Includes:
- Util
- Defined in:
- lib/shoryuken/manager.rb
Constant Summary
collapse
- BATCH_LIMIT =
10
- MIN_DISPATCH_INTERVAL =
0.1
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods included from Util
#elapsed, #fire_event, #logger, #unparse_queues, #worker_name
Constructor Details
#initialize(group, fetcher, polling_strategy, concurrency, executor) ⇒ Manager
Returns a new instance of Manager.
11
12
13
14
15
16
17
18
19
20
21
|
# File 'lib/shoryuken/manager.rb', line 11
def initialize(group, fetcher, polling_strategy, concurrency, executor)
@group = group
@fetcher = fetcher
@polling_strategy = polling_strategy
@max_processors = concurrency
@busy_processors = Concurrent::AtomicFixnum.new(0)
@executor = executor
@running = Concurrent::AtomicBoolean.new(true)
@stop_new_dispatching = Concurrent::AtomicBoolean.new(false)
@dispatching_release_signal = ::Queue.new
end
|
Instance Attribute Details
#group ⇒ Object
Returns the value of attribute group.
9
10
11
|
# File 'lib/shoryuken/manager.rb', line 9
def group
@group
end
|
Instance Method Details
#await_dispatching_in_progress ⇒ Object
32
33
34
35
36
37
|
# File 'lib/shoryuken/manager.rb', line 32
def await_dispatching_in_progress
@dispatching_release_signal.pop
end
|
#running? ⇒ Boolean
39
40
41
|
# File 'lib/shoryuken/manager.rb', line 39
def running?
@running.true? && @executor.running?
end
|
#start ⇒ Object
23
24
25
26
|
# File 'lib/shoryuken/manager.rb', line 23
def start
fire_utilization_update_event
dispatch_loop
end
|
#stop_new_dispatching ⇒ Object
28
29
30
|
# File 'lib/shoryuken/manager.rb', line 28
def stop_new_dispatching
@stop_new_dispatching.make_true
end
|