move (God::Task)

    # File lib/god/task.rb, line 146
        def move(to_state)
          if Thread.current != self.driver.thread
            # called from outside Driver

            # send an async message to Driver
            self.driver.message(:move, [to_state])
          else
            # called from within Driver

            # record original info
            orig_to_state = to_state
            from_state = self.state

            # log
            msg = "#{self.name} move '#{from_state}' to '#{to_state}'"
            applog(self, :info, msg)

            # cleanup from current state
            self.driver.clear_events
            self.metrics[from_state].each { |m| m.disable }
            if to_state == :unmonitored
              self.metrics[nil].each { |m| m.disable }
            end

            # perform action
            self.action(to_state)

            # enable simple mode
            if [:start, :restart].include?(to_state) && self.metrics[to_state].empty?
              to_state = :up
            end

            # move to new state
            self.metrics[to_state].each { |m| m.enable }

            # if no from state, enable lifecycle metric
            if from_state == :unmonitored
              self.metrics[nil].each { |m| m.enable }
            end

            # set state
            self.state = to_state

            # broadcast to interested TriggerConditions
            Trigger.broadcast(self, :state_change, [from_state, orig_to_state])

            # log
            msg = "#{self.name} moved '#{from_state}' to '#{to_state}'"
            applog(self, :info, msg)
          end

          self
        end