Class: Sonar::Connector::SeppukuConnector

Inherits:
Base
  • Object
show all
Defined in:
lib/sonar_connector/connectors/seppuku_connector.rb

Overview

Suicide connector.Submits a command to cause the death of the entire connector framework. The connector will then get restarted by god or by the Windows service wrapper.

Instance Attribute Summary collapse

Attributes inherited from Base

#connector, #connector_dir, #connector_filestore, #filestore, #log, #name, #queue, #raw_config, #repeat_delay, #run, #source_connectors, #state

Instance Method Summary collapse

Methods inherited from Base

#cleanup, #initialize, #load_state, #prepare, #read_state, #run_loop, #run_once, #save_state, #start, #switch_to_log_file, #to_s

Constructor Details

This class inherits a constructor from Sonar::Connector::Base

Instance Attribute Details

#run_countObject

Returns the value of attribute run_count.



8
9
10
# File 'lib/sonar_connector/connectors/seppuku_connector.rb', line 8

def run_count
  @run_count
end

Instance Method Details

#actionObject



14
15
16
17
18
19
20
21
22
# File 'lib/sonar_connector/connectors/seppuku_connector.rb', line 14

def action
  
  if @run_count > 0 
    log.info "切腹! #{name} committing honourable suicide and terminating the connector service."
    queue << Sonar::Connector::CommitSeppukuCommand.new
  end
  
  @run_count += 1
end

#parse(config) ⇒ Object



10
11
12
# File 'lib/sonar_connector/connectors/seppuku_connector.rb', line 10

def parse(config)
  @run_count = 0
end