110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
|
# File 'lib/logstash/plugin_mixins/jdbc/scheduler.rb', line 110
def start_work_thread
prev_thread_count = @scheduler.work_threads.size
ret = super()
work_threads = @scheduler.work_threads(:__all_no_cache__)
while prev_thread_count == work_threads.size Thread.pass
work_threads = @scheduler.work_threads(:__all_no_cache__)
end
work_thread_name_prefix = @scheduler.work_thread_name_prefix
work_threads.sort! do |t1, t2|
if t1[:name].nil?
t2[:name].nil? ? 0 : +1 elsif t2[:name].nil?
t1[:name].nil? ? 0 : -1
else
t1[:name] <=> t2[:name]
end
end
work_threads.each_with_index do |thread, i|
unless thread[:name]
thread[:name] = "#{work_thread_name_prefix}#{sprintf('%02i', i)}"
thread.name = thread[:name] if thread.respond_to?(:name=)
end
end
ret
end
|