Class: Concurrent::Supervisor::WorkerContext

Inherits:
Struct
  • Object
show all
Defined in:
lib/concurrent/supervisor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#restartObject

Returns the value of attribute restart

Returns:

  • the current value of restart



20
21
22
# File 'lib/concurrent/supervisor.rb', line 20

def restart
  @restart
end

#terminatedObject

Returns the value of attribute terminated.



22
23
24
# File 'lib/concurrent/supervisor.rb', line 22

def terminated
  @terminated
end

#threadObject

Returns the value of attribute thread.



21
22
23
# File 'lib/concurrent/supervisor.rb', line 21

def thread
  @thread
end

#typeObject

Returns the value of attribute type

Returns:

  • the current value of type



20
21
22
# File 'lib/concurrent/supervisor.rb', line 20

def type
  @type
end

#workerObject

Returns the value of attribute worker

Returns:

  • the current value of worker



20
21
22
# File 'lib/concurrent/supervisor.rb', line 20

def worker
  @worker
end

Instance Method Details

#alive?Boolean

Returns:



24
# File 'lib/concurrent/supervisor.rb', line 24

def alive?() return thread && thread.alive?; end

#needs_restart?Boolean

Returns:



26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/concurrent/supervisor.rb', line 26

def needs_restart?
  return false if thread && thread.alive?
  return false if terminated
  case self.restart
  when :permanent
    return true
  when :transient
    return thread.nil? || thread.status.nil?
  else #when :temporary
    return false
  end
end