Class: LogStash::Inputs::Azure::NamedThreadFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/logstash/inputs/named_thread_factory.rb

Instance Method Summary collapse

Constructor Details

#initialize(name, id) ⇒ NamedThreadFactory

Returns a new instance of NamedThreadFactory.



8
9
10
11
12
# File 'lib/logstash/inputs/named_thread_factory.rb', line 8

def initialize(name, id)
  @name = name
  @id = id
  @counter = AtomicInteger.new(-1)
end

Instance Method Details

#newThread(runnable) ⇒ Object



14
15
16
# File 'lib/logstash/inputs/named_thread_factory.rb', line 14

def newThread(runnable)
  java.lang.Thread.new(runnable, @name + "-" + @counter.increment_and_get.to_s + "-" + @id.to_s)
end