roma-client 0.4.4 → 0.4.5
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.
- checksums.yaml +5 -5
- data/CHANGELOG.md +22 -15
- data/Gemfile +2 -0
- data/Gemfile.lock +34 -18
- data/README.md +4 -0
- data/lib/roma/client/client_pool.rb +15 -25
- data/lib/roma/client/client_rttable.rb +1 -2
- data/lib/roma/client/tools/showbalance.rb +0 -1
- data/lib/roma/client/version.rb +1 -1
- data/spec/roma/client/client_pool_spec.rb +133 -173
- data/spec/spec_helper.rb +9 -0
- metadata +3 -79
- data/doc/CHANGELOG_md.html +0 -119
- data/doc/README_md.html +0 -161
- data/doc/Roma.html +0 -95
- data/doc/Roma/Client.html +0 -95
- data/doc/Roma/Client/ClientPool.html +0 -716
- data/doc/Roma/Client/ClientRoutingTable.html +0 -495
- data/doc/Roma/Client/ConPool.html +0 -484
- data/doc/Roma/Client/Plugin.html +0 -95
- data/doc/Roma/Client/Plugin/Alist.html +0 -1276
- data/doc/Roma/Client/Plugin/Map.html +0 -531
- data/doc/Roma/Client/Plugin/MapCount.html +0 -401
- data/doc/Roma/Client/Proxy.html +0 -95
- data/doc/Roma/Client/Proxy/ClientHandler.html +0 -273
- data/doc/Roma/Client/Proxy/Conpool.html +0 -394
- data/doc/Roma/Client/Proxy/Daemon.html +0 -305
- data/doc/Roma/Client/Proxy/RomaHandler.html +0 -217
- data/doc/Roma/Client/RomaClient.html +0 -1339
- data/doc/Roma/Client/Sender.html +0 -482
- data/doc/Roma/Client/Stats.html +0 -162
- data/doc/Roma/Client/VERSION.html +0 -141
- data/doc/Roma/Logging.html +0 -95
- data/doc/Roma/Logging/RLogger.html +0 -786
- data/doc/Roma/Logging/RLogger/ExtLogDev.html +0 -159
- data/doc/Roma/Logging/RLogger/ExtShiftAge.html +0 -95
- data/doc/Roma/Logging/RLogger/ExtTrace.html +0 -109
- data/doc/Roma/Logging/RLogger/Severity.html +0 -139
- data/doc/Roma/Routing.html +0 -95
- data/doc/Roma/Routing/RoutingData.html +0 -912
- data/doc/Roma/Routing/RoutingData/RandomNodeListMaker.html +0 -311
- data/doc/created.rid +0 -20
- data/doc/css/fonts.css +0 -167
- data/doc/css/rdoc.css +0 -590
- data/doc/fonts/Lato-Light.ttf +0 -0
- data/doc/fonts/Lato-LightItalic.ttf +0 -0
- data/doc/fonts/Lato-Regular.ttf +0 -0
- data/doc/fonts/Lato-RegularItalic.ttf +0 -0
- data/doc/fonts/SourceCodePro-Bold.ttf +0 -0
- data/doc/fonts/SourceCodePro-Regular.ttf +0 -0
- data/doc/images/add.png +0 -0
- data/doc/images/arrow_up.png +0 -0
- data/doc/images/brick.png +0 -0
- data/doc/images/brick_link.png +0 -0
- data/doc/images/bug.png +0 -0
- data/doc/images/bullet_black.png +0 -0
- data/doc/images/bullet_toggle_minus.png +0 -0
- data/doc/images/bullet_toggle_plus.png +0 -0
- data/doc/images/date.png +0 -0
- data/doc/images/delete.png +0 -0
- data/doc/images/find.png +0 -0
- data/doc/images/loadingAnimation.gif +0 -0
- data/doc/images/macFFBgHack.png +0 -0
- data/doc/images/package.png +0 -0
- data/doc/images/page_green.png +0 -0
- data/doc/images/page_white_text.png +0 -0
- data/doc/images/page_white_width.png +0 -0
- data/doc/images/plugin.png +0 -0
- data/doc/images/ruby.png +0 -0
- data/doc/images/tag_blue.png +0 -0
- data/doc/images/tag_green.png +0 -0
- data/doc/images/transparent.png +0 -0
- data/doc/images/wrench.png +0 -0
- data/doc/images/wrench_orange.png +0 -0
- data/doc/images/zoom.png +0 -0
- data/doc/index.html +0 -210
- data/doc/js/darkfish.js +0 -161
- data/doc/js/jquery.js +0 -4
- data/doc/js/navigation.js +0 -142
- data/doc/js/navigation.js.gz +0 -0
- data/doc/js/search.js +0 -109
- data/doc/js/search_index.js +0 -1
- data/doc/js/search_index.js.gz +0 -0
- data/doc/js/searcher.js +0 -228
- data/doc/js/searcher.js.gz +0 -0
- data/doc/table_of_contents.html +0 -972
- data/lib/roma/client/routing/routing_data.rb +0 -241
@@ -1,484 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
|
3
|
-
<html>
|
4
|
-
<head>
|
5
|
-
<meta charset=" UTF-8">
|
6
|
-
|
7
|
-
<title>class Roma::Client::ConPool - ROMA documents</title>
|
8
|
-
|
9
|
-
<script type="text/javascript">
|
10
|
-
var rdoc_rel_prefix = "../../";
|
11
|
-
</script>
|
12
|
-
|
13
|
-
<script src="../../js/jquery.js"></script>
|
14
|
-
<script src="../../js/darkfish.js"></script>
|
15
|
-
|
16
|
-
<link href="../../css/fonts.css" rel="stylesheet">
|
17
|
-
<link href="../../css/rdoc.css" rel="stylesheet">
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
<body id="top" role="document" class="class">
|
22
|
-
<nav role="navigation">
|
23
|
-
<div id="project-navigation">
|
24
|
-
<div id="home-section" role="region" title="Quick navigation" class="nav-section">
|
25
|
-
<h2>
|
26
|
-
<a href="../../index.html" rel="home">Home</a>
|
27
|
-
</h2>
|
28
|
-
|
29
|
-
<div id="table-of-contents-navigation">
|
30
|
-
<a href="../../table_of_contents.html#pages">Pages</a>
|
31
|
-
<a href="../../table_of_contents.html#classes">Classes</a>
|
32
|
-
<a href="../../table_of_contents.html#methods">Methods</a>
|
33
|
-
</div>
|
34
|
-
</div>
|
35
|
-
|
36
|
-
<div id="search-section" role="search" class="project-section initially-hidden">
|
37
|
-
<form action="#" method="get" accept-charset="utf-8">
|
38
|
-
<div id="search-field-wrapper">
|
39
|
-
<input id="search-field" role="combobox" aria-label="Search"
|
40
|
-
aria-autocomplete="list" aria-controls="search-results"
|
41
|
-
type="text" name="search" placeholder="Search" spellcheck="false"
|
42
|
-
title="Type to search, Up and Down to navigate, Enter to load">
|
43
|
-
</div>
|
44
|
-
|
45
|
-
<ul id="search-results" aria-label="Search Results"
|
46
|
-
aria-busy="false" aria-expanded="false"
|
47
|
-
aria-atomic="false" class="initially-hidden"></ul>
|
48
|
-
</form>
|
49
|
-
</div>
|
50
|
-
|
51
|
-
</div>
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
<div id="class-metadata">
|
56
|
-
|
57
|
-
<div id="parent-class-section" class="nav-section">
|
58
|
-
<h3>Parent</h3>
|
59
|
-
|
60
|
-
|
61
|
-
<p class="link">Object
|
62
|
-
|
63
|
-
</div>
|
64
|
-
|
65
|
-
<div id="includes-section" class="nav-section">
|
66
|
-
<h3>Included Modules</h3>
|
67
|
-
|
68
|
-
<ul class="link-list">
|
69
|
-
|
70
|
-
|
71
|
-
<li><span class="include">Singleton</span>
|
72
|
-
|
73
|
-
|
74
|
-
</ul>
|
75
|
-
</div>
|
76
|
-
|
77
|
-
|
78
|
-
<!-- Method Quickref -->
|
79
|
-
<div id="method-list-section" class="nav-section">
|
80
|
-
<h3>Methods</h3>
|
81
|
-
|
82
|
-
<ul class="link-list" role="directory">
|
83
|
-
|
84
|
-
<li ><a href="#method-c-new">::new</a>
|
85
|
-
|
86
|
-
<li ><a href="#method-i-close_all">#close_all</a>
|
87
|
-
|
88
|
-
<li ><a href="#method-i-close_at">#close_at</a>
|
89
|
-
|
90
|
-
<li ><a href="#method-i-close_same_host">#close_same_host</a>
|
91
|
-
|
92
|
-
<li ><a href="#method-i-create_connection">#create_connection</a>
|
93
|
-
|
94
|
-
<li ><a href="#method-i-delete_connection">#delete_connection</a>
|
95
|
-
|
96
|
-
<li ><a href="#method-i-get_connection">#get_connection</a>
|
97
|
-
|
98
|
-
<li ><a href="#method-i-return_connection">#return_connection</a>
|
99
|
-
|
100
|
-
</ul>
|
101
|
-
</div>
|
102
|
-
|
103
|
-
</div>
|
104
|
-
</nav>
|
105
|
-
|
106
|
-
<main role="main" aria-labelledby="class-Roma::Client::ConPool">
|
107
|
-
<h1 id="class-Roma::Client::ConPool" class="class">
|
108
|
-
class Roma::Client::ConPool
|
109
|
-
</h1>
|
110
|
-
|
111
|
-
<section class="description">
|
112
|
-
|
113
|
-
</section>
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
<section id="5Buntitled-5D" class="documentation-section">
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
<section class="attribute-method-details" class="method-section">
|
127
|
-
<header>
|
128
|
-
<h3>Attributes</h3>
|
129
|
-
</header>
|
130
|
-
|
131
|
-
|
132
|
-
<div id="attribute-i-expire_time" class="method-detail">
|
133
|
-
<div class="method-heading attribute-method-heading">
|
134
|
-
<span class="method-name">expire_time</span><span
|
135
|
-
class="attribute-access-type">[RW]</span>
|
136
|
-
</div>
|
137
|
-
|
138
|
-
<div class="method-description">
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
</div>
|
143
|
-
</div>
|
144
|
-
|
145
|
-
<div id="attribute-i-maxlength" class="method-detail">
|
146
|
-
<div class="method-heading attribute-method-heading">
|
147
|
-
<span class="method-name">maxlength</span><span
|
148
|
-
class="attribute-access-type">[RW]</span>
|
149
|
-
</div>
|
150
|
-
|
151
|
-
<div class="method-description">
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
</div>
|
156
|
-
</div>
|
157
|
-
|
158
|
-
</section>
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
<section id="public-class-5Buntitled-5D-method-details" class="method-section">
|
163
|
-
<header>
|
164
|
-
<h3>Public Class Methods</h3>
|
165
|
-
</header>
|
166
|
-
|
167
|
-
|
168
|
-
<div id="method-c-new" class="method-detail ">
|
169
|
-
|
170
|
-
<div class="method-heading">
|
171
|
-
<span class="method-name">new</span><span
|
172
|
-
class="method-args">(maxlength = 10, expire_time = 60)</span>
|
173
|
-
|
174
|
-
<span class="method-click-advice">click to toggle source</span>
|
175
|
-
|
176
|
-
</div>
|
177
|
-
|
178
|
-
|
179
|
-
<div class="method-description">
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
<div class="method-source-code" id="new-source">
|
187
|
-
<pre><span class="ruby-comment"># File lib/roma/client/con_pool.rb, line 14</span>
|
188
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">maxlength</span> = <span class="ruby-value">10</span>, <span class="ruby-identifier">expire_time</span> = <span class="ruby-value">60</span>)
|
189
|
-
<span class="ruby-ivar">@pool</span> = {}
|
190
|
-
<span class="ruby-ivar">@maxlength</span> = <span class="ruby-identifier">maxlength</span>
|
191
|
-
<span class="ruby-ivar">@expire_time</span> = <span class="ruby-identifier">expire_time</span>
|
192
|
-
<span class="ruby-ivar">@lock</span> = <span class="ruby-constant">Mutex</span>.<span class="ruby-identifier">new</span>
|
193
|
-
<span class="ruby-keyword">end</span></pre>
|
194
|
-
</div>
|
195
|
-
|
196
|
-
</div>
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
</div>
|
202
|
-
|
203
|
-
|
204
|
-
</section>
|
205
|
-
|
206
|
-
<section id="public-instance-5Buntitled-5D-method-details" class="method-section">
|
207
|
-
<header>
|
208
|
-
<h3>Public Instance Methods</h3>
|
209
|
-
</header>
|
210
|
-
|
211
|
-
|
212
|
-
<div id="method-i-close_all" class="method-detail ">
|
213
|
-
|
214
|
-
<div class="method-heading">
|
215
|
-
<span class="method-name">close_all</span><span
|
216
|
-
class="method-args">()</span>
|
217
|
-
|
218
|
-
<span class="method-click-advice">click to toggle source</span>
|
219
|
-
|
220
|
-
</div>
|
221
|
-
|
222
|
-
|
223
|
-
<div class="method-description">
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
<div class="method-source-code" id="close_all-source">
|
231
|
-
<pre><span class="ruby-comment"># File lib/roma/client/con_pool.rb, line 55</span>
|
232
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">close_all</span>
|
233
|
-
<span class="ruby-ivar">@pool</span>.<span class="ruby-identifier">each_key</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">ap</span><span class="ruby-operator">|</span> <span class="ruby-identifier">close_at</span>(<span class="ruby-identifier">ap</span>) }
|
234
|
-
<span class="ruby-keyword">end</span></pre>
|
235
|
-
</div>
|
236
|
-
|
237
|
-
</div>
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
</div>
|
243
|
-
|
244
|
-
|
245
|
-
<div id="method-i-close_at" class="method-detail ">
|
246
|
-
|
247
|
-
<div class="method-heading">
|
248
|
-
<span class="method-name">close_at</span><span
|
249
|
-
class="method-args">(ap)</span>
|
250
|
-
|
251
|
-
<span class="method-click-advice">click to toggle source</span>
|
252
|
-
|
253
|
-
</div>
|
254
|
-
|
255
|
-
|
256
|
-
<div class="method-description">
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
<div class="method-source-code" id="close_at-source">
|
264
|
-
<pre><span class="ruby-comment"># File lib/roma/client/con_pool.rb, line 66</span>
|
265
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">close_at</span>(<span class="ruby-identifier">ap</span>)
|
266
|
-
<span class="ruby-keyword">return</span> <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@pool</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-identifier">ap</span>)
|
267
|
-
<span class="ruby-ivar">@lock</span>.<span class="ruby-identifier">synchronize</span> {
|
268
|
-
<span class="ruby-keyword">while</span>(<span class="ruby-ivar">@pool</span>[<span class="ruby-identifier">ap</span>].<span class="ruby-identifier">length</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>)
|
269
|
-
<span class="ruby-keyword">begin</span>
|
270
|
-
<span class="ruby-ivar">@pool</span>[<span class="ruby-identifier">ap</span>].<span class="ruby-identifier">shift</span>.<span class="ruby-identifier">close</span>
|
271
|
-
<span class="ruby-keyword">rescue</span> =<span class="ruby-operator">></span><span class="ruby-identifier">e</span>
|
272
|
-
<span class="ruby-keyword">end</span>
|
273
|
-
<span class="ruby-keyword">end</span>
|
274
|
-
<span class="ruby-ivar">@pool</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">ap</span>)
|
275
|
-
}
|
276
|
-
<span class="ruby-keyword">end</span></pre>
|
277
|
-
</div>
|
278
|
-
|
279
|
-
</div>
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
</div>
|
285
|
-
|
286
|
-
|
287
|
-
<div id="method-i-close_same_host" class="method-detail ">
|
288
|
-
|
289
|
-
<div class="method-heading">
|
290
|
-
<span class="method-name">close_same_host</span><span
|
291
|
-
class="method-args">(ap)</span>
|
292
|
-
|
293
|
-
<span class="method-click-advice">click to toggle source</span>
|
294
|
-
|
295
|
-
</div>
|
296
|
-
|
297
|
-
|
298
|
-
<div class="method-description">
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
<div class="method-source-code" id="close_same_host-source">
|
306
|
-
<pre><span class="ruby-comment"># File lib/roma/client/con_pool.rb, line 59</span>
|
307
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">close_same_host</span>(<span class="ruby-identifier">ap</span>)
|
308
|
-
<span class="ruby-identifier">host</span>,<span class="ruby-identifier">port</span> = <span class="ruby-identifier">ap</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp">/[:_]/</span>)
|
309
|
-
<span class="ruby-ivar">@pool</span>.<span class="ruby-identifier">each_key</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">eap</span><span class="ruby-operator">|</span>
|
310
|
-
<span class="ruby-identifier">close_at</span>(<span class="ruby-identifier">eap</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">eap</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp">/[:_]/</span>)[<span class="ruby-value">0</span>] <span class="ruby-operator">==</span> <span class="ruby-identifier">host</span>
|
311
|
-
}
|
312
|
-
<span class="ruby-keyword">end</span></pre>
|
313
|
-
</div>
|
314
|
-
|
315
|
-
</div>
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
</div>
|
321
|
-
|
322
|
-
|
323
|
-
<div id="method-i-create_connection" class="method-detail ">
|
324
|
-
|
325
|
-
<div class="method-heading">
|
326
|
-
<span class="method-name">create_connection</span><span
|
327
|
-
class="method-args">(ap)</span>
|
328
|
-
|
329
|
-
<span class="method-click-advice">click to toggle source</span>
|
330
|
-
|
331
|
-
</div>
|
332
|
-
|
333
|
-
|
334
|
-
<div class="method-description">
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
<div class="method-source-code" id="create_connection-source">
|
342
|
-
<pre><span class="ruby-comment"># File lib/roma/client/con_pool.rb, line 46</span>
|
343
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">create_connection</span>(<span class="ruby-identifier">ap</span>)
|
344
|
-
<span class="ruby-identifier">addr</span>, <span class="ruby-identifier">port</span> = <span class="ruby-identifier">ap</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp">/[:_]/</span>)
|
345
|
-
<span class="ruby-constant">TCPSocket</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">addr</span>, <span class="ruby-identifier">port</span>)
|
346
|
-
<span class="ruby-keyword">end</span></pre>
|
347
|
-
</div>
|
348
|
-
|
349
|
-
</div>
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
</div>
|
355
|
-
|
356
|
-
|
357
|
-
<div id="method-i-delete_connection" class="method-detail ">
|
358
|
-
|
359
|
-
<div class="method-heading">
|
360
|
-
<span class="method-name">delete_connection</span><span
|
361
|
-
class="method-args">(ap)</span>
|
362
|
-
|
363
|
-
<span class="method-click-advice">click to toggle source</span>
|
364
|
-
|
365
|
-
</div>
|
366
|
-
|
367
|
-
|
368
|
-
<div class="method-description">
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
<div class="method-source-code" id="delete_connection-source">
|
376
|
-
<pre><span class="ruby-comment"># File lib/roma/client/con_pool.rb, line 51</span>
|
377
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">delete_connection</span>(<span class="ruby-identifier">ap</span>)
|
378
|
-
<span class="ruby-ivar">@pool</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">ap</span>)
|
379
|
-
<span class="ruby-keyword">end</span></pre>
|
380
|
-
</div>
|
381
|
-
|
382
|
-
</div>
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
</div>
|
388
|
-
|
389
|
-
|
390
|
-
<div id="method-i-get_connection" class="method-detail ">
|
391
|
-
|
392
|
-
<div class="method-heading">
|
393
|
-
<span class="method-name">get_connection</span><span
|
394
|
-
class="method-args">(ap)</span>
|
395
|
-
|
396
|
-
<span class="method-click-advice">click to toggle source</span>
|
397
|
-
|
398
|
-
</div>
|
399
|
-
|
400
|
-
|
401
|
-
<div class="method-description">
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
<div class="method-source-code" id="get_connection-source">
|
409
|
-
<pre><span class="ruby-comment"># File lib/roma/client/con_pool.rb, line 21</span>
|
410
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">get_connection</span>(<span class="ruby-identifier">ap</span>)
|
411
|
-
<span class="ruby-identifier">ret</span>,<span class="ruby-identifier">last</span> = <span class="ruby-ivar">@pool</span>[<span class="ruby-identifier">ap</span>].<span class="ruby-identifier">shift</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@pool</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-identifier">ap</span>) <span class="ruby-operator">&&</span> <span class="ruby-ivar">@pool</span>[<span class="ruby-identifier">ap</span>].<span class="ruby-identifier">length</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
|
412
|
-
<span class="ruby-keyword">if</span> <span class="ruby-identifier">ret</span> <span class="ruby-operator">&&</span> <span class="ruby-identifier">last</span> <span class="ruby-operator"><</span> <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span> <span class="ruby-operator">-</span> <span class="ruby-ivar">@expire_time</span>
|
413
|
-
<span class="ruby-identifier">ret</span>.<span class="ruby-identifier">close</span>
|
414
|
-
<span class="ruby-identifier">ret</span> = <span class="ruby-keyword">nil</span>
|
415
|
-
<span class="ruby-keyword">end</span>
|
416
|
-
<span class="ruby-identifier">ret</span> = <span class="ruby-identifier">create_connection</span>(<span class="ruby-identifier">ap</span>) <span class="ruby-keyword">unless</span> <span class="ruby-identifier">ret</span>
|
417
|
-
<span class="ruby-identifier">ret</span>
|
418
|
-
<span class="ruby-keyword">rescue</span>
|
419
|
-
<span class="ruby-keyword">nil</span>
|
420
|
-
<span class="ruby-keyword">end</span></pre>
|
421
|
-
</div>
|
422
|
-
|
423
|
-
</div>
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
</div>
|
429
|
-
|
430
|
-
|
431
|
-
<div id="method-i-return_connection" class="method-detail ">
|
432
|
-
|
433
|
-
<div class="method-heading">
|
434
|
-
<span class="method-name">return_connection</span><span
|
435
|
-
class="method-args">(ap, con)</span>
|
436
|
-
|
437
|
-
<span class="method-click-advice">click to toggle source</span>
|
438
|
-
|
439
|
-
</div>
|
440
|
-
|
441
|
-
|
442
|
-
<div class="method-description">
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
<div class="method-source-code" id="return_connection-source">
|
450
|
-
<pre><span class="ruby-comment"># File lib/roma/client/con_pool.rb, line 33</span>
|
451
|
-
<span class="ruby-keyword">def</span> <span class="ruby-identifier">return_connection</span>(<span class="ruby-identifier">ap</span>, <span class="ruby-identifier">con</span>)
|
452
|
-
<span class="ruby-keyword">if</span> <span class="ruby-ivar">@pool</span>.<span class="ruby-identifier">key?</span>(<span class="ruby-identifier">ap</span>) <span class="ruby-operator">&&</span> <span class="ruby-ivar">@pool</span>[<span class="ruby-identifier">ap</span>].<span class="ruby-identifier">length</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
|
453
|
-
<span class="ruby-keyword">if</span> <span class="ruby-ivar">@pool</span>[<span class="ruby-identifier">ap</span>].<span class="ruby-identifier">length</span> <span class="ruby-operator">></span> <span class="ruby-ivar">@maxlength</span>
|
454
|
-
<span class="ruby-identifier">con</span>.<span class="ruby-identifier">close</span>
|
455
|
-
<span class="ruby-keyword">else</span>
|
456
|
-
<span class="ruby-ivar">@pool</span>[<span class="ruby-identifier">ap</span>] <span class="ruby-operator"><<</span> [<span class="ruby-identifier">con</span>, <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>]
|
457
|
-
<span class="ruby-keyword">end</span>
|
458
|
-
<span class="ruby-keyword">else</span>
|
459
|
-
<span class="ruby-ivar">@pool</span>[<span class="ruby-identifier">ap</span>] = [[<span class="ruby-identifier">con</span>, <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>]]
|
460
|
-
<span class="ruby-keyword">end</span>
|
461
|
-
<span class="ruby-keyword">rescue</span>
|
462
|
-
<span class="ruby-keyword">end</span></pre>
|
463
|
-
</div>
|
464
|
-
|
465
|
-
</div>
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
</div>
|
471
|
-
|
472
|
-
|
473
|
-
</section>
|
474
|
-
|
475
|
-
</section>
|
476
|
-
</main>
|
477
|
-
|
478
|
-
|
479
|
-
<footer id="validator-badges" role="contentinfo">
|
480
|
-
<p><a href="http://validator.w3.org/check/referer">Validate</a>
|
481
|
-
<p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> 4.2.2.
|
482
|
-
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
|
483
|
-
</footer>
|
484
|
-
|