Method: ServiceState#setState

Defined in:
lib/filesystemwatcher/servicestate.rb

#setState(newState) ⇒ Object

All methods, inside this class or not, should use this method to change the state of the JobRunner

Parameters:

  • newState

    The new state value



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/filesystemwatcher/servicestate.rb', line 34

def setState(newState)
  @stateMutex.synchronize {
    if newState == CONFIGURED then
  @configured = true
    else
  @state = newState
  if isStarted? then
 @startTime = Time.now()
  elsif isStopped?
 @stopTime = Time.now()
  end
    end
  }
  
  if defined?(@stateCallback) then
    @stateCallback.call(newState)
  end
end