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:

  • (Object)

    the current value of restart



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

def restart
  @restart
end

#terminatedObject

Returns the value of attribute terminated.



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

def terminated
  @terminated
end

#threadObject

Returns the value of attribute thread.



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

def thread
  @thread
end

#typeObject

Returns the value of attribute type

Returns:

  • (Object)

    the current value of type



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

def type
  @type
end

#workerObject

Returns the value of attribute worker

Returns:

  • (Object)

    the current value of worker



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

def worker
  @worker
end

Instance Method Details

#alive?Boolean

Returns:

  • (Boolean)


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

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

#needs_restart?Boolean

Returns:

  • (Boolean)


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

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