提交 2646c102 编写于 作者: C Charles Oliver Nutter

Use different name for main and thread connection variable.

Under JRuby, the updates of the one shared variable interleaved,
causing threads to pick up each others' connections. I'm amazed
this worked on MRI.
上级 98faa2a6
......@@ -184,14 +184,14 @@ def test_active_connection?
def test_checkout_behaviour
pool = ConnectionPool.new ActiveRecord::Base.connection_pool.spec
connection = pool.connection
assert_not_nil connection
main_connection = pool.connection
assert_not_nil main_connection
threads = []
4.times do |i|
threads << Thread.new(i) do
connection = pool.connection
assert_not_nil connection
connection.close
thread_connection = pool.connection
assert_not_nil thread_connection
thread_connection.close
end
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册