Parent

Class/Module Index [+]

Quicksearch

Celluloid::SupervisionGroup::Member

A member of the group

Attributes

actor[R]
name[R]

Public Class Methods

new(registry, klass, options = {}) click to toggle source
# File lib/celluloid/supervision_group.rb, line 110
def initialize(registry, klass, options = {})
  @registry = registry
  @klass = klass

  # Stringify keys :/
  options = options.inject({}) { |h,(k,v)| h[k.to_s] = v; h }

  @name = options['as']
  @block = options['block']
  @args = options['args'] ? Array(options['args']) : []
  @method = options['method'] || 'new_link'
  @pool = @method == 'pool_link'
  @pool_size = options['size'] if @pool

  start
end

Public Instance Methods

restart(reason) click to toggle source
# File lib/celluloid/supervision_group.rb, line 140
def restart(reason)
  @actor = nil
  @registry.delete(@name) if @name

  # Ignore supervisors that shut down cleanly
  return unless reason

  start
end
start() click to toggle source
# File lib/celluloid/supervision_group.rb, line 128
def start
  # when it is a pool, then we don't splat the args
  # and we need to extract the pool size if set
  if @pool
    options = {:args => @args}
    options[:size] = @pool_size if @pool_size
    @args = [options]
  end
  @actor = @klass.send(@method, *@args, &@block)
  @registry[@name] = @actor if @name
end
terminate() click to toggle source
# File lib/celluloid/supervision_group.rb, line 150
def terminate
  @actor.terminate if @actor
rescue DeadActorError, MailboxError
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.