boogaloo 0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +2 -0
- data/DEBUGGING +4 -0
- data/MIT-LICENSE +7 -0
- data/README +106 -0
- data/RUNNING_UNIT_TESTS +5 -0
- data/Rakefile +44 -0
- data/bin/boogaloo +159 -0
- data/doc/classes/Boogaloo.html +149 -0
- data/doc/classes/Boogaloo/Cache.html +121 -0
- data/doc/classes/Boogaloo/Cache/Base.html +664 -0
- data/doc/classes/Boogaloo/Cache/Persistent.html +122 -0
- data/doc/classes/Boogaloo/Cache/Temporary.html +439 -0
- data/doc/classes/Boogaloo/Client.html +111 -0
- data/doc/classes/Boogaloo/Client/Connection.html +228 -0
- data/doc/classes/Boogaloo/Config.html +540 -0
- data/doc/classes/Boogaloo/ServiceGateway.html +176 -0
- data/doc/classes/Boogaloo/ServiceRequest.html +210 -0
- data/doc/classes/Boogaloo/ThreadPool.html +205 -0
- data/doc/classes/Boogaloo/WorkerThread.html +239 -0
- data/doc/created.rid +1 -0
- data/doc/files/DEBUGGING.html +113 -0
- data/doc/files/MIT-LICENSE.html +129 -0
- data/doc/files/README.html +261 -0
- data/doc/files/examples/boogaloo_conf.html +130 -0
- data/doc/files/lib/boogaloo/cache/base_rb.html +101 -0
- data/doc/files/lib/boogaloo/cache/persistent_rb.html +108 -0
- data/doc/files/lib/boogaloo/cache/temporary_rb.html +101 -0
- data/doc/files/lib/boogaloo/client/connection_rb.html +101 -0
- data/doc/files/lib/boogaloo/config_rb.html +109 -0
- data/doc/files/lib/boogaloo/service_gateway_rb.html +110 -0
- data/doc/files/lib/boogaloo/service_request_rb.html +108 -0
- data/doc/files/lib/boogaloo/thread_pool_rb.html +101 -0
- data/doc/files/lib/boogaloo/util_rb.html +240 -0
- data/doc/files/lib/boogaloo/version_rb.html +114 -0
- data/doc/files/lib/boogaloo/worker_thread_rb.html +101 -0
- data/doc/fr_class_index.html +38 -0
- data/doc/fr_file_index.html +41 -0
- data/doc/fr_method_index.html +67 -0
- data/doc/index.html +24 -0
- data/doc/rdoc-style.css +208 -0
- data/examples/boogaloo.conf +17 -0
- data/lib/boogaloo/cache/base.rb +222 -0
- data/lib/boogaloo/cache/persistent.rb +15 -0
- data/lib/boogaloo/cache/temporary.rb +173 -0
- data/lib/boogaloo/client/connection.rb +55 -0
- data/lib/boogaloo/config.rb +206 -0
- data/lib/boogaloo/service_gateway.rb +37 -0
- data/lib/boogaloo/service_request.rb +39 -0
- data/lib/boogaloo/thread_pool.rb +40 -0
- data/lib/boogaloo/util.rb +29 -0
- data/lib/boogaloo/version.rb +1 -0
- data/lib/boogaloo/worker_thread.rb +46 -0
- data/test/test_persistent_cache.rb +99 -0
- data/test/test_service_gateway.rb +27 -0
- data/test/test_synchronicity.rb +29 -0
- data/test/test_temporary_cache.rb +42 -0
- metadata +113 -0
@@ -0,0 +1,176 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Class: Boogaloo::ServiceGateway</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Class</strong></td>
|
53
|
+
<td class="class-name-in-header">Boogaloo::ServiceGateway</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/lib/boogaloo/service_gateway_rb.html">
|
59
|
+
lib/boogaloo/service_gateway.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
<tr class="top-aligned-row">
|
66
|
+
<td><strong>Parent:</strong></td>
|
67
|
+
<td>
|
68
|
+
Object
|
69
|
+
</td>
|
70
|
+
</tr>
|
71
|
+
</table>
|
72
|
+
</div>
|
73
|
+
<!-- banner header -->
|
74
|
+
|
75
|
+
<div id="bodyContent">
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<div id="contextContent">
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
</div>
|
84
|
+
|
85
|
+
<div id="method-list">
|
86
|
+
<h3 class="section-bar">Methods</h3>
|
87
|
+
|
88
|
+
<div class="name-list">
|
89
|
+
<a href="#M000039">new</a>
|
90
|
+
</div>
|
91
|
+
</div>
|
92
|
+
|
93
|
+
</div>
|
94
|
+
|
95
|
+
|
96
|
+
<!-- if includes -->
|
97
|
+
|
98
|
+
<div id="section">
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
<!-- if method_list -->
|
108
|
+
<div id="methods">
|
109
|
+
<h3 class="section-bar">Public Class methods</h3>
|
110
|
+
|
111
|
+
<div id="method-M000039" class="method-detail">
|
112
|
+
<a name="M000039"></a>
|
113
|
+
|
114
|
+
<div class="method-heading">
|
115
|
+
<a href="#M000039" class="method-signature">
|
116
|
+
<span class="method-name">new</span><span class="method-args">(pool, services)</span>
|
117
|
+
</a>
|
118
|
+
</div>
|
119
|
+
|
120
|
+
<div class="method-description">
|
121
|
+
<p>
|
122
|
+
Initialize a new service gateway.
|
123
|
+
</p>
|
124
|
+
<p>
|
125
|
+
Parameters:
|
126
|
+
</p>
|
127
|
+
<table>
|
128
|
+
<tr><td valign="top"><tt>pool</tt>:</td><td>A reference to a <a href="ThreadPool.html">ThreadPool</a>
|
129
|
+
|
130
|
+
</td></tr>
|
131
|
+
<tr><td valign="top"><tt>services</tt>:</td><td>A Hash of instance_name/instance pairs.
|
132
|
+
|
133
|
+
</td></tr>
|
134
|
+
</table>
|
135
|
+
<p><a class="source-toggle" href="#"
|
136
|
+
onclick="toggleCode('M000039-source');return false;">[Source]</a></p>
|
137
|
+
<div class="method-source-code" id="M000039-source">
|
138
|
+
<pre>
|
139
|
+
<span class="ruby-comment cmt"># File lib/boogaloo/service_gateway.rb, line 15</span>
|
140
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">pool</span>, <span class="ruby-identifier">services</span>)
|
141
|
+
|
142
|
+
<span class="ruby-identifier">services</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">name</span>, <span class="ruby-identifier">instance</span><span class="ruby-operator">|</span>
|
143
|
+
|
144
|
+
<span class="ruby-identifier">instance_variable_set</span>(<span class="ruby-value str">"@"</span><span class="ruby-operator">+</span><span class="ruby-identifier">name</span>, <span class="ruby-identifier">instance</span>)
|
145
|
+
|
146
|
+
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">instance_eval</span> <span class="ruby-keyword kw">do</span>
|
147
|
+
|
148
|
+
<span class="ruby-identifier">define_method</span>(<span class="ruby-identifier">name</span>) <span class="ruby-keyword kw">do</span>
|
149
|
+
|
150
|
+
<span class="ruby-constant">Boogaloo</span><span class="ruby-operator">::</span><span class="ruby-constant">ServiceRequest</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">instance_variable_get</span>(<span class="ruby-value str">"@"</span><span class="ruby-operator">+</span><span class="ruby-identifier">name</span>), <span class="ruby-identifier">pool</span>)
|
151
|
+
|
152
|
+
<span class="ruby-keyword kw">end</span>
|
153
|
+
|
154
|
+
<span class="ruby-keyword kw">end</span>
|
155
|
+
|
156
|
+
<span class="ruby-keyword kw">end</span>
|
157
|
+
|
158
|
+
<span class="ruby-keyword kw">end</span>
|
159
|
+
</pre>
|
160
|
+
</div>
|
161
|
+
</div>
|
162
|
+
</div>
|
163
|
+
|
164
|
+
|
165
|
+
</div>
|
166
|
+
|
167
|
+
|
168
|
+
</div>
|
169
|
+
|
170
|
+
|
171
|
+
<div id="validator-badges">
|
172
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
173
|
+
</div>
|
174
|
+
|
175
|
+
</body>
|
176
|
+
</html>
|
@@ -0,0 +1,210 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Class: Boogaloo::ServiceRequest</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Class</strong></td>
|
53
|
+
<td class="class-name-in-header">Boogaloo::ServiceRequest</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/lib/boogaloo/service_request_rb.html">
|
59
|
+
lib/boogaloo/service_request.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
<tr class="top-aligned-row">
|
66
|
+
<td><strong>Parent:</strong></td>
|
67
|
+
<td>
|
68
|
+
Object
|
69
|
+
</td>
|
70
|
+
</tr>
|
71
|
+
</table>
|
72
|
+
</div>
|
73
|
+
<!-- banner header -->
|
74
|
+
|
75
|
+
<div id="bodyContent">
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<div id="contextContent">
|
80
|
+
|
81
|
+
<div id="description">
|
82
|
+
<p>
|
83
|
+
Handles server requests using threads from the thread pool.
|
84
|
+
</p>
|
85
|
+
|
86
|
+
</div>
|
87
|
+
|
88
|
+
|
89
|
+
</div>
|
90
|
+
|
91
|
+
<div id="method-list">
|
92
|
+
<h3 class="section-bar">Methods</h3>
|
93
|
+
|
94
|
+
<div class="name-list">
|
95
|
+
<a href="#M000038">method_missing</a>
|
96
|
+
<a href="#M000037">new</a>
|
97
|
+
</div>
|
98
|
+
</div>
|
99
|
+
|
100
|
+
</div>
|
101
|
+
|
102
|
+
|
103
|
+
<!-- if includes -->
|
104
|
+
|
105
|
+
<div id="section">
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
<!-- if method_list -->
|
115
|
+
<div id="methods">
|
116
|
+
<h3 class="section-bar">Public Class methods</h3>
|
117
|
+
|
118
|
+
<div id="method-M000037" class="method-detail">
|
119
|
+
<a name="M000037"></a>
|
120
|
+
|
121
|
+
<div class="method-heading">
|
122
|
+
<a href="#M000037" class="method-signature">
|
123
|
+
<span class="method-name">new</span><span class="method-args">(obj, pool)</span>
|
124
|
+
</a>
|
125
|
+
</div>
|
126
|
+
|
127
|
+
<div class="method-description">
|
128
|
+
<p>
|
129
|
+
Initialize a new <a href="ServiceRequest.html">ServiceRequest</a> instance.
|
130
|
+
</p>
|
131
|
+
<p>
|
132
|
+
Parameters:
|
133
|
+
</p>
|
134
|
+
<table>
|
135
|
+
<tr><td valign="top"><tt>obj</tt>:</td><td>The service instance for which to handle the request.
|
136
|
+
|
137
|
+
</td></tr>
|
138
|
+
<tr><td valign="top"><tt>pool</tt>:</td><td>A reference to the thread pool.
|
139
|
+
|
140
|
+
</td></tr>
|
141
|
+
</table>
|
142
|
+
<p><a class="source-toggle" href="#"
|
143
|
+
onclick="toggleCode('M000037-source');return false;">[Source]</a></p>
|
144
|
+
<div class="method-source-code" id="M000037-source">
|
145
|
+
<pre>
|
146
|
+
<span class="ruby-comment cmt"># File lib/boogaloo/service_request.rb, line 14</span>
|
147
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">obj</span>, <span class="ruby-identifier">pool</span>)
|
148
|
+
|
149
|
+
<span class="ruby-ivar">@obj</span> = <span class="ruby-identifier">obj</span>
|
150
|
+
<span class="ruby-ivar">@pool</span> = <span class="ruby-identifier">pool</span>
|
151
|
+
|
152
|
+
<span class="ruby-keyword kw">end</span>
|
153
|
+
</pre>
|
154
|
+
</div>
|
155
|
+
</div>
|
156
|
+
</div>
|
157
|
+
|
158
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
159
|
+
|
160
|
+
<div id="method-M000038" class="method-detail">
|
161
|
+
<a name="M000038"></a>
|
162
|
+
|
163
|
+
<div class="method-heading">
|
164
|
+
<a href="#M000038" class="method-signature">
|
165
|
+
<span class="method-name">method_missing</span><span class="method-args">(meth, *a, &b)</span>
|
166
|
+
</a>
|
167
|
+
</div>
|
168
|
+
|
169
|
+
<div class="method-description">
|
170
|
+
<p>
|
171
|
+
Forward method calls to the service instance via a <a
|
172
|
+
href="WorkerThread.html">WorkerThread</a>.
|
173
|
+
</p>
|
174
|
+
<p><a class="source-toggle" href="#"
|
175
|
+
onclick="toggleCode('M000038-source');return false;">[Source]</a></p>
|
176
|
+
<div class="method-source-code" id="M000038-source">
|
177
|
+
<pre>
|
178
|
+
<span class="ruby-comment cmt"># File lib/boogaloo/service_request.rb, line 22</span>
|
179
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">method_missing</span>(<span class="ruby-identifier">meth</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">a</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">b</span>)
|
180
|
+
|
181
|
+
(<span class="ruby-identifier">t_start</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">$debug</span>
|
182
|
+
<span class="ruby-identifier">worker</span> = <span class="ruby-ivar">@pool</span>.<span class="ruby-identifier">pop</span>
|
183
|
+
<span class="ruby-identifier">debug</span>(<span class="ruby-node">"Waited #{"%.5f" % (Time.now - t_start)} seconds for available WorkerThread"</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">$debug</span> <span class="ruby-keyword kw">and</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">t_start</span>.<span class="ruby-identifier">nil?</span>
|
184
|
+
<span class="ruby-identifier">worker</span>.<span class="ruby-identifier">use_instance</span>(<span class="ruby-ivar">@obj</span>)
|
185
|
+
<span class="ruby-identifier">ret</span> = <span class="ruby-identifier">worker</span>.<span class="ruby-identifier">perform</span>(<span class="ruby-identifier">meth</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">a</span>)
|
186
|
+
<span class="ruby-ivar">@pool</span>.<span class="ruby-identifier">push</span> <span class="ruby-identifier">worker</span>
|
187
|
+
|
188
|
+
<span class="ruby-identifier">raise</span> <span class="ruby-identifier">ret</span> <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">ret</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">NoMethodError</span>) <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">ret</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">TypeError</span>))
|
189
|
+
|
190
|
+
<span class="ruby-identifier">ret</span>
|
191
|
+
|
192
|
+
<span class="ruby-keyword kw">end</span>
|
193
|
+
</pre>
|
194
|
+
</div>
|
195
|
+
</div>
|
196
|
+
</div>
|
197
|
+
|
198
|
+
|
199
|
+
</div>
|
200
|
+
|
201
|
+
|
202
|
+
</div>
|
203
|
+
|
204
|
+
|
205
|
+
<div id="validator-badges">
|
206
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
207
|
+
</div>
|
208
|
+
|
209
|
+
</body>
|
210
|
+
</html>
|
@@ -0,0 +1,205 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Class: Boogaloo::ThreadPool</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Class</strong></td>
|
53
|
+
<td class="class-name-in-header">Boogaloo::ThreadPool</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../../files/lib/boogaloo/thread_pool_rb.html">
|
59
|
+
lib/boogaloo/thread_pool.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
<tr class="top-aligned-row">
|
66
|
+
<td><strong>Parent:</strong></td>
|
67
|
+
<td>
|
68
|
+
Queue
|
69
|
+
</td>
|
70
|
+
</tr>
|
71
|
+
</table>
|
72
|
+
</div>
|
73
|
+
<!-- banner header -->
|
74
|
+
|
75
|
+
<div id="bodyContent">
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<div id="contextContent">
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
</div>
|
84
|
+
|
85
|
+
<div id="method-list">
|
86
|
+
<h3 class="section-bar">Methods</h3>
|
87
|
+
|
88
|
+
<div class="name-list">
|
89
|
+
<a href="#M000040">new</a>
|
90
|
+
<a href="#M000041">shutdown</a>
|
91
|
+
</div>
|
92
|
+
</div>
|
93
|
+
|
94
|
+
</div>
|
95
|
+
|
96
|
+
|
97
|
+
<!-- if includes -->
|
98
|
+
|
99
|
+
<div id="section">
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
<!-- if method_list -->
|
109
|
+
<div id="methods">
|
110
|
+
<h3 class="section-bar">Public Class methods</h3>
|
111
|
+
|
112
|
+
<div id="method-M000040" class="method-detail">
|
113
|
+
<a name="M000040"></a>
|
114
|
+
|
115
|
+
<div class="method-heading">
|
116
|
+
<a href="#M000040" class="method-signature">
|
117
|
+
<span class="method-name">new</span><span class="method-args">(threads)</span>
|
118
|
+
</a>
|
119
|
+
</div>
|
120
|
+
|
121
|
+
<div class="method-description">
|
122
|
+
<p>
|
123
|
+
Initailize a new thread pool.
|
124
|
+
</p>
|
125
|
+
<p>
|
126
|
+
Parameters:
|
127
|
+
</p>
|
128
|
+
<table>
|
129
|
+
<tr><td valign="top"><tt>threads</tt>:</td><td>The number of threads to populate the pool with.
|
130
|
+
|
131
|
+
</td></tr>
|
132
|
+
</table>
|
133
|
+
<p><a class="source-toggle" href="#"
|
134
|
+
onclick="toggleCode('M000040-source');return false;">[Source]</a></p>
|
135
|
+
<div class="method-source-code" id="M000040-source">
|
136
|
+
<pre>
|
137
|
+
<span class="ruby-comment cmt"># File lib/boogaloo/thread_pool.rb, line 10</span>
|
138
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">threads</span>)
|
139
|
+
|
140
|
+
<span class="ruby-keyword kw">super</span>()
|
141
|
+
|
142
|
+
<span class="ruby-ivar">@threads</span> = <span class="ruby-identifier">threads</span>
|
143
|
+
|
144
|
+
<span class="ruby-keyword kw">for</span> <span class="ruby-identifier">i</span> <span class="ruby-keyword kw">in</span> <span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-ivar">@threads</span>
|
145
|
+
|
146
|
+
<span class="ruby-identifier">push</span>(<span class="ruby-constant">Boogaloo</span><span class="ruby-operator">::</span><span class="ruby-constant">WorkerThread</span>.<span class="ruby-identifier">new</span>)
|
147
|
+
|
148
|
+
<span class="ruby-keyword kw">end</span>
|
149
|
+
|
150
|
+
<span class="ruby-keyword kw">end</span>
|
151
|
+
</pre>
|
152
|
+
</div>
|
153
|
+
</div>
|
154
|
+
</div>
|
155
|
+
|
156
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
157
|
+
|
158
|
+
<div id="method-M000041" class="method-detail">
|
159
|
+
<a name="M000041"></a>
|
160
|
+
|
161
|
+
<div class="method-heading">
|
162
|
+
<a href="#M000041" class="method-signature">
|
163
|
+
<span class="method-name">shutdown</span><span class="method-args">()</span>
|
164
|
+
</a>
|
165
|
+
</div>
|
166
|
+
|
167
|
+
<div class="method-description">
|
168
|
+
<p>
|
169
|
+
Shutdown the pool.
|
170
|
+
</p>
|
171
|
+
<p><a class="source-toggle" href="#"
|
172
|
+
onclick="toggleCode('M000041-source');return false;">[Source]</a></p>
|
173
|
+
<div class="method-source-code" id="M000041-source">
|
174
|
+
<pre>
|
175
|
+
<span class="ruby-comment cmt"># File lib/boogaloo/thread_pool.rb, line 25</span>
|
176
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">shutdown</span>
|
177
|
+
|
178
|
+
<span class="ruby-keyword kw">for</span> <span class="ruby-identifier">i</span> <span class="ruby-keyword kw">in</span> <span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-ivar">@threads</span>
|
179
|
+
|
180
|
+
<span class="ruby-identifier">worker</span> = <span class="ruby-identifier">pop</span>
|
181
|
+
<span class="ruby-identifier">worker</span>.<span class="ruby-identifier">exit</span>
|
182
|
+
|
183
|
+
<span class="ruby-keyword kw">end</span>
|
184
|
+
|
185
|
+
<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span> <span class="ruby-operator">?</span> <span class="ruby-keyword kw">true</span> <span class="ruby-operator">:</span> <span class="ruby-keyword kw">false</span>
|
186
|
+
|
187
|
+
<span class="ruby-keyword kw">end</span>
|
188
|
+
</pre>
|
189
|
+
</div>
|
190
|
+
</div>
|
191
|
+
</div>
|
192
|
+
|
193
|
+
|
194
|
+
</div>
|
195
|
+
|
196
|
+
|
197
|
+
</div>
|
198
|
+
|
199
|
+
|
200
|
+
<div id="validator-badges">
|
201
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
202
|
+
</div>
|
203
|
+
|
204
|
+
</body>
|
205
|
+
</html>
|