gene_pool 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,8 @@
1
+ === 1.0.1 / 2010-09-12
2
+
3
+ * Bug Fixes
4
+ * Debug logging was NOT thread-safe
5
+
1
6
  == 1.0.0 / 2010-09-05
2
7
 
3
8
  * 1 major enhancement:
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0
1
+ 1.0.1
data/gene_pool.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{gene_pool}
8
- s.version = "1.0.0"
8
+ s.version = "1.0.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Brad Pardee"]
12
- s.date = %q{2010-09-08}
12
+ s.date = %q{2010-09-12}
13
13
  s.description = %q{Generic pooling library for creating a connection pool}
14
14
  s.email = %q{bradpardee@gmail.com}
15
15
  s.extra_rdoc_files = [
data/lib/gene_pool.rb CHANGED
@@ -58,7 +58,7 @@ class GenePool
58
58
  connection = renew(reserved_connection_placeholder)
59
59
  end
60
60
 
61
- @logger.debug "#{@name}: Checkout connection #{connection.object_id} self=#{self}" if @logger && @logger.debug?
61
+ @logger.debug "#{@name}: Checkout connection #{connection.object_id} self=#{dump}" if @logger && @logger.debug?
62
62
  return connection
63
63
  end
64
64
 
@@ -68,7 +68,7 @@ class GenePool
68
68
  @checked_out.delete(connection)
69
69
  @queue.signal
70
70
  end
71
- @logger.debug "#{@name}: Checkin connection #{connection.object_id} self=#{self}" if @logger && @logger.debug?
71
+ @logger.debug "#{@name}: Checkin connection #{connection.object_id} self=#{dump}" if @logger && @logger.debug?
72
72
  end
73
73
 
74
74
  # Create a scope for checking out a connection
@@ -95,7 +95,7 @@ class GenePool
95
95
  @checked_out.delete(connection)
96
96
  @queue.signal
97
97
  end
98
- @logger.debug "#{@name}: Removed connection #{connection.object_id} self=#{self}" if @logger && @logger.debug?
98
+ @logger.debug "#{@name}: Removed connection #{connection.object_id} self=#{dump}" if @logger && @logger.debug?
99
99
  end
100
100
 
101
101
  # If a connection needs to be renewed for some reason, reassign it here
@@ -122,13 +122,20 @@ class GenePool
122
122
 
123
123
  # Perform the given block for each connection, i.e., closing each connection.
124
124
  def each
125
- @connections.each { |connection| yield connection }
125
+ @mutex.synchronize do
126
+ @connections.each { |connection| yield connection }
127
+ end
126
128
  end
127
129
 
128
- def to_s
129
- conn = @connections.map{|c| c.object_id}.join(',')
130
- chk = @checked_out.map{|c| c.object_id}.join(',')
131
- with = @with_map.keys.map{|k| "#{k}=#{@with_map[k].object_id}"}.join(',')
130
+ private
131
+
132
+ def dump
133
+ conn = chk = with = nil
134
+ @mutex.synchronize do
135
+ conn = @connections.map{|c| c.object_id}.join(',')
136
+ chk = @checked_out.map{|c| c.object_id}.join(',')
137
+ with = @with_map.keys.map{|k| "#{k}=#{@with_map[k].object_id}"}.join(',')
138
+ end
132
139
  "connections=#{conn} checked_out=#{chk} with_map=#{with}"
133
140
  end
134
141
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 0
8
- - 0
9
- version: 1.0.0
8
+ - 1
9
+ version: 1.0.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Brad Pardee
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-09-08 00:00:00 -04:00
17
+ date: 2010-09-12 00:00:00 -04:00
18
18
  default_executable:
19
19
  dependencies: []
20
20