I am looking for how to properly start two simple threads in jruby.
In the following with two threads, the message within the first thread does not get printed. I can swap the two threads and the behavior (first thread does not print) persists: so it is not about the contents of the thread (which I stubbed out in any case)
input_before_mysql_phases_t = Thread.new do
sprint "input_before_mysql_phases completed"
end
mysql_phases_t = Thread.new do
sprint "mysql_phases completed"
end
sprint "awaiting completion of data fetch phases .."
sleep 5
sprint "data fetch phases completed"
Here is output: notice the message from the first thread is not printed.
=> #<Thread:0x72d006a7 run>
[2013-04-18T12:56:29+00:00] SCHEDULER: mysql_phases completed
irb(main):540:0> sprint "awaiting completion of data fetch phases .."
[2013-04-18T12:56:29+00:00] SCHEDULER: awaiting completion of data fetch phases ..
=> nil
irb(main):541:0> sleep 5
=> 5
irb(main):542:0> sprint "data fetch phases completed"
[2013-04-18T12:56:34+00:00] SCHEDULER: data fetch phases completed