Skip to content

Commit

Permalink
AR::ConPool - remove synchronization around connection cache.
Browse files Browse the repository at this point in the history
Renamed `@reserved_connections` -> `@thread_cached_conns`. New name
clearly conveys the purpose of the cache, which is to speed-up
`#connection` method.

The new `@thread_cached_conns` now also uses `Thread` objects as keys
(instead of previously `Thread.current.object_id`).

Since there is no longer any synchronization around
`@thread_cached_conns`, `disconnect!` and `clear_reloadable_connections!`
methods now pre-emptively obtain ownership (via `checkout`) of all
existing connections, before modifying internal data structures.

A private method `release` has been renamed `thread_conn_uncache` to
clear-up its purpose.

Fixed some brittle `thread.status == "sleep"` tests (threads can go
into sleep even without locks).
  • Loading branch information
thedarkone committed May 14, 2015
1 parent e92f5a9 commit 603fe20
Show file tree
Hide file tree
Showing 3 changed files with 436 additions and 84 deletions.
Loading

0 comments on commit 603fe20

Please sign in to comment.