gene_pool 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +5 -0
- data/VERSION +1 -1
- data/gene_pool.gemspec +2 -2
- data/lib/gene_pool.rb +15 -8
- metadata +3 -3
data/History.txt
CHANGED
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.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.
|
|
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-
|
|
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=#{
|
|
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=#{
|
|
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=#{
|
|
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
|
-
@
|
|
125
|
+
@mutex.synchronize do
|
|
126
|
+
@connections.each { |connection| yield connection }
|
|
127
|
+
end
|
|
126
128
|
end
|
|
127
129
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
with =
|
|
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
|
-
-
|
|
9
|
-
version: 1.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-
|
|
17
|
+
date: 2010-09-12 00:00:00 -04:00
|
|
18
18
|
default_executable:
|
|
19
19
|
dependencies: []
|
|
20
20
|
|