Permalink
Browse files

cleanup and comment

  • Loading branch information...
1 parent 2621bcd commit ee2f79687eff9d0a05a13a5a54ac837a167d199e @nickethier nickethier committed Jun 8, 2012
Showing with 4 additions and 10 deletions.
  1. +2 −1 lib/logstash/agent.rb
  2. +0 −2 lib/logstash/inputs/base.rb
  3. +2 −7 lib/logstash/inputs/threadable.rb
@@ -323,10 +323,11 @@ def start_input(input)
t = 0
# inputs should write directly to output queue if there are no filters.
input_target = @filters.length > 0 ? @filter_queue : @output_queue
+ # check to see if input supports multiple threads
if input.threadable
@logger.debug("Threadable input", :plugin => input)
+ # start up extra threads if need be
(input.threads-1).times do
- #input_thread = input.class.new(input.raw_params.clone)
input_thread = input.clone
@logger.debug("Starting thread", :plugin => input, :thread => (t+=1))
@plugins[input_thread] = Thread.new(input_thread, input_target) do |*args|
@@ -54,14 +54,12 @@ class LogStash::Inputs::Base < LogStash::Plugin
config :add_field, :validate => :hash, :default => {}
attr_accessor :params
- attr_accessor :raw_params
attr_accessor :threadable
public
def initialize(params)
super
@threadable = false
- @raw_params = params.clone
config_init(params)
@tags ||= []
end # def initialize
@@ -1,19 +1,14 @@
require "logstash/namespace"
-require "logstash/event"
-require "logstash/plugin"
-require "logstash/logging"
-require "logstash/config/mixin"
require "logstash/inputs/base"
-# This is the base class for logstash inputs.
+# This is the threadable class for logstash inputs.
+# Use this class in your inputs if it can support multiple threads
class LogStash::Inputs::Threadable < LogStash::Inputs::Base
# Set this to the number of threads you want this input to spawn.
# This is the same as declaring the input multiple times
config :threads, :validate => :number, :default => 1
- attr_accessor :threadable
-
def initialize(params)
super
@threadable = true

0 comments on commit ee2f796

Please sign in to comment.