diff --git a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb index e3f4c44f503c00d288b3ecdd6311130bbd9f4cd8..4b833d945fe29f2861b976a15df222ed6562d5f1 100644 --- a/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb +++ b/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb @@ -118,10 +118,16 @@ def any_waiting? end end - # Returns the number of threads currently waiting on this - # queue. - def num_waiting - synchronize do + if defined?(JRUBY_VERSION) + # Returns the number of threads currently waiting on this queue. + def num_waiting + synchronize do + @num_waiting + end + end + else + # Returns the number of threads currently waiting on this queue. + def num_waiting @num_waiting end end