I'm running on JRuby 1.6.7 with Rails 3.0.2. I have a few methods that call REST services.
It would be nice to execute them concurrently, so instead of each one taking 2 seconds to return totaling 6 seconds. I'll get the data back in about 2 seconds.
I can't use Fibers because the following calls use blocking io and cannot be modified so I cannot code them to work 'cooperatively'. I'm trying to use preemptive threads.
I have a simple call inside a thread as follows.
Thread.new do
callrest1()
end
Though I get the following error when this code executes inside the thread. I'm guessing it cannot find the correct files/classes because its in a new thread? Any ideas?
Expected /home/joe/ruby/analysis/app/models/dashboard/reports.rb to define Dashboard::Reports Rails.root: /home/joe/ruby/analysis
Application Trace | Framework Trace | Full Trace
activesupport (3.0.5) lib/active_support/dependencies.rb:492:in `load_missing_constant'
activesupport (3.0.5) lib/active_support/dependencies.rb:183:in `const_missing'
org/jruby/RubyArray.java:1615:in `each'
activesupport (3.0.5) lib/active_support/dependencies.rb:181:in `const_missing'
activesupport (3.0.5) lib/active_support/dependencies.rb:503:in `load_missing_constant'
activesupport (3.0.5) lib/active_support/dependencies.rb:183:in `const_missing'
org/jruby/RubyArray.java:1615:in `each'
activesupport (3.0.5) lib/active_support/dependencies.rb:181:in `const_missing'
app/controllers/dashboard/index_controller.rb:297:in `generateReport'
app/controllers/dashboard/index_controller.rb:223:in `index'