data_objects 0.10.9 → 0.10.10
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/ChangeLog.markdown +6 -0
- data/lib/data_objects/connection.rb +4 -13
- data/lib/data_objects/pooling.rb +25 -21
- data/lib/data_objects/version.rb +1 -1
- metadata +2 -2
data/ChangeLog.markdown
CHANGED
|
@@ -119,7 +119,7 @@ module DataObjects
|
|
|
119
119
|
|
|
120
120
|
# Create a Command object of the right subclass using the given text
|
|
121
121
|
def create_command(text)
|
|
122
|
-
concrete_command.new(self, text)
|
|
122
|
+
self.class.concrete_command.new(self, text)
|
|
123
123
|
end
|
|
124
124
|
|
|
125
125
|
def extension
|
|
@@ -132,19 +132,10 @@ module DataObjects
|
|
|
132
132
|
DataObjects::const_get(self.class.name.split('::')[-2])
|
|
133
133
|
end
|
|
134
134
|
|
|
135
|
-
def concrete_command
|
|
136
|
-
@concrete_command
|
|
137
|
-
|
|
138
|
-
class << self
|
|
139
|
-
private
|
|
140
|
-
def concrete_command
|
|
141
|
-
@concrete_command
|
|
142
|
-
end
|
|
143
|
-
end
|
|
144
|
-
|
|
145
|
-
@concrete_command = DataObjects::const_get(self.class.name.split('::')[-2]).const_get('Command')
|
|
146
|
-
end
|
|
135
|
+
def self.concrete_command
|
|
136
|
+
@concrete_command ||= DataObjects::const_get(self.name.split('::')[-2]).const_get('Command')
|
|
147
137
|
end
|
|
148
138
|
|
|
149
139
|
end
|
|
140
|
+
|
|
150
141
|
end
|
data/lib/data_objects/pooling.rb
CHANGED
|
@@ -98,33 +98,37 @@ module DataObjects
|
|
|
98
98
|
end
|
|
99
99
|
|
|
100
100
|
def self.included(target)
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
101
|
+
lock.synchronize do
|
|
102
|
+
unless target.respond_to? :__pools
|
|
103
|
+
target.class_eval do
|
|
104
|
+
class << self
|
|
105
|
+
alias __new new
|
|
106
|
+
end
|
|
105
107
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
108
|
+
@__pools = {}
|
|
109
|
+
@__pool_lock = Mutex.new
|
|
110
|
+
@__pool_wait = ConditionVariable.new
|
|
109
111
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
112
|
+
def self.__pool_lock
|
|
113
|
+
@__pool_lock
|
|
114
|
+
end
|
|
113
115
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
116
|
+
def self.__pool_wait
|
|
117
|
+
@__pool_wait
|
|
118
|
+
end
|
|
117
119
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
120
|
+
def self.new(*args)
|
|
121
|
+
(@__pools[args] ||= __pool_lock.synchronize { Pool.new(self.pool_size, self, args) }).new
|
|
122
|
+
end
|
|
121
123
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
124
|
+
def self.__pools
|
|
125
|
+
@__pools
|
|
126
|
+
end
|
|
125
127
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
+
def self.pool_size
|
|
129
|
+
8
|
|
130
|
+
end
|
|
131
|
+
end
|
|
128
132
|
end
|
|
129
133
|
end
|
|
130
134
|
end
|
data/lib/data_objects/version.rb
CHANGED