Class: Proletariat::PoolableActor
- Inherits:
-
Concurrent::Actor::Utils::AbstractWorker
- Object
- Concurrent::Actor::Utils::AbstractWorker
- Proletariat::PoolableActor
- Includes:
- ActorCommon
- Defined in:
- lib/proletariat/concurrency/poolable_actor.rb
Overview
Public: Interface abstraction for a pool of Concurrent::Actor instances.
Class Method Summary collapse
Instance Method Summary collapse
Methods included from ActorCommon
Class Method Details
.pool(pool_size, suffix = '') ⇒ Object
18 19 20 21 22 23 |
# File 'lib/proletariat/concurrency/poolable_actor.rb', line 18 def self.pool(pool_size, suffix = '') Concurrent::Actor::Utils:: Pool.spawn!("#{to_s}_pool", pool_size) do |b, i| spawn(name: "#{to_s}_#{i}_#{suffix}", supervise: true, args: [b]) end end |
Instance Method Details
#on_message(message) ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/proletariat/concurrency/poolable_actor.rb', line 8 def () if respond_to?(:work_method) send work_method, else work end ensure @balancer << :subscribe end |