Fix strategy handling in pool options (#259)
[poolifier.git] / docs / interfaces / iworker.html
CommitLineData
5ea22628
JB
1<!doctype html>
2<html class="default no-js">
3<head>
4 <meta charset="utf-8">
5 <meta http-equiv="X-UA-Compatible" content="IE=edge">
6 <title>IWorker | poolifier</title>
7 <meta name="description" content="Documentation for poolifier">
8 <meta name="viewport" content="width=device-width, initial-scale=1">
9 <link rel="stylesheet" href="../assets/css/main.css">
10 <script async src="../assets/js/search.js" id="search-script"></script>
11</head>
12<body>
13<header>
14 <div class="tsd-page-toolbar">
15 <div class="container">
16 <div class="table-wrap">
17 <div class="table-cell" id="tsd-search" data-index="../assets/js/search.json" data-base="..">
18 <div class="field">
19 <label for="tsd-search-field" class="tsd-widget search no-caption">Search</label>
20 <input id="tsd-search-field" type="text" />
21 </div>
22 <ul class="results">
23 <li class="state loading">Preparing search index...</li>
24 <li class="state failure">The search index is not available</li>
25 </ul>
26 <a href="../index.html" class="title">poolifier</a>
27 </div>
28 <div class="table-cell" id="tsd-widgets">
29 <div id="tsd-filter">
30 <a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a>
31 <div class="tsd-filter-group">
32 <div class="tsd-select" id="tsd-filter-visibility">
33 <span class="tsd-select-label">All</span>
34 <ul class="tsd-select-list">
35 <li data-value="public">Public</li>
36 <li data-value="protected">Public/Protected</li>
37 <li data-value="private" class="selected">All</li>
38 </ul>
39 </div>
40 <input type="checkbox" id="tsd-filter-inherited" checked />
41 <label class="tsd-widget" for="tsd-filter-inherited">Inherited</label>
42 <input type="checkbox" id="tsd-filter-externals" checked />
43 <label class="tsd-widget" for="tsd-filter-externals">Externals</label>
44 </div>
45 </div>
46 <a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a>
47 </div>
48 </div>
49 </div>
50 </div>
51 <div class="tsd-page-title">
52 <div class="container">
53 <ul class="tsd-breadcrumb">
54 <li>
55 <a href="../index.html">poolifier</a>
56 </li>
57 <li>
58 <a href="iworker.html">IWorker</a>
59 </li>
60 </ul>
61 <h1>Interface IWorker</h1>
62 </div>
63 </div>
64</header>
65<div class="container container-main">
66 <div class="row">
67 <div class="col-8 col-content">
68 <section class="tsd-panel tsd-comment">
69 <div class="tsd-comment tsd-typography">
70 <div class="lead">
71 <p>Basic interface that describes the minimum required implementation of listener events for a pool-worker.</p>
72 </div>
73 </div>
74 </section>
75 <section class="tsd-panel tsd-hierarchy">
76 <h3>Hierarchy</h3>
77 <ul class="tsd-hierarchy">
78 <li>
79 <span class="target">IWorker</span>
80 </li>
81 </ul>
82 </section>
83 <section class="tsd-panel-group tsd-index-group">
84 <h2>Index</h2>
85 <section class="tsd-panel tsd-index-panel">
86 <div class="tsd-index-content">
87 <section class="tsd-index-section ">
88 <h3>Methods</h3>
89 <ul class="tsd-index-list">
90 <li class="tsd-kind-method tsd-parent-kind-interface"><a href="iworker.html#on" class="tsd-kind-icon">on</a></li>
91 <li class="tsd-kind-method tsd-parent-kind-interface"><a href="iworker.html#once" class="tsd-kind-icon">once</a></li>
92 </ul>
93 </section>
94 </div>
95 </section>
96 </section>
97 <section class="tsd-panel-group tsd-member-group ">
98 <h2>Methods</h2>
99 <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface">
100 <a name="on" class="tsd-anchor"></a>
101 <h3>on</h3>
102 <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-interface">
103 <li class="tsd-signature tsd-kind-icon">on<span class="tsd-signature-symbol">(</span>event<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">&quot;error&quot;</span>, handler<span class="tsd-signature-symbol">: </span><a href="../index.html#errorhandler" class="tsd-signature-type" data-tsd-kind="Type alias">ErrorHandler</a><span class="tsd-signature-symbol">&lt;</span><a href="iworker.html" class="tsd-signature-type" data-tsd-kind="Interface">IWorker</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
104 <li class="tsd-signature tsd-kind-icon">on<span class="tsd-signature-symbol">(</span>event<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">&quot;online&quot;</span>, handler<span class="tsd-signature-symbol">: </span><a href="../index.html#onlinehandler" class="tsd-signature-type" data-tsd-kind="Type alias">OnlineHandler</a><span class="tsd-signature-symbol">&lt;</span><a href="iworker.html" class="tsd-signature-type" data-tsd-kind="Interface">IWorker</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
105 <li class="tsd-signature tsd-kind-icon">on<span class="tsd-signature-symbol">(</span>event<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">&quot;exit&quot;</span>, handler<span class="tsd-signature-symbol">: </span><a href="../index.html#exithandler" class="tsd-signature-type" data-tsd-kind="Type alias">ExitHandler</a><span class="tsd-signature-symbol">&lt;</span><a href="iworker.html" class="tsd-signature-type" data-tsd-kind="Interface">IWorker</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
106 </ul>
107 <ul class="tsd-descriptions">
108 <li class="tsd-description">
109 <aside class="tsd-sources">
110 <ul>
7c0ba920 111 <li>Defined in <a href="https://github.com/jerome-benoit/poolifier/blob/7fb595d/src/pools/abstract-pool.ts#L46">src/pools/abstract-pool.ts:46</a></li>
5ea22628
JB
112 </ul>
113 </aside>
114 <div class="tsd-comment tsd-typography">
115 <div class="lead">
116 <p>Register a listener to the error event.</p>
117 </div>
118 </div>
119 <h4 class="tsd-parameters-title">Parameters</h4>
120 <ul class="tsd-parameters">
121 <li>
122 <h5>event: <span class="tsd-signature-type">&quot;error&quot;</span></h5>
123 <div class="tsd-comment tsd-typography">
124 <p><code>&#39;error&#39;</code>.</p>
125 </div>
126 </li>
127 <li>
128 <h5>handler: <a href="../index.html#errorhandler" class="tsd-signature-type" data-tsd-kind="Type alias">ErrorHandler</a><span class="tsd-signature-symbol">&lt;</span><a href="iworker.html" class="tsd-signature-type" data-tsd-kind="Interface">IWorker</a><span class="tsd-signature-symbol">&gt;</span></h5>
129 <div class="tsd-comment tsd-typography">
130 <p>The error handler.</p>
131 </div>
132 </li>
133 </ul>
134 <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
135 </li>
136 <li class="tsd-description">
137 <aside class="tsd-sources">
138 <ul>
7c0ba920 139 <li>Defined in <a href="https://github.com/jerome-benoit/poolifier/blob/7fb595d/src/pools/abstract-pool.ts#L53">src/pools/abstract-pool.ts:53</a></li>
5ea22628
JB
140 </ul>
141 </aside>
142 <div class="tsd-comment tsd-typography">
143 <div class="lead">
144 <p>Register a listener to the online event.</p>
145 </div>
146 </div>
147 <h4 class="tsd-parameters-title">Parameters</h4>
148 <ul class="tsd-parameters">
149 <li>
150 <h5>event: <span class="tsd-signature-type">&quot;online&quot;</span></h5>
151 <div class="tsd-comment tsd-typography">
152 <p><code>&#39;online&#39;</code>.</p>
153 </div>
154 </li>
155 <li>
156 <h5>handler: <a href="../index.html#onlinehandler" class="tsd-signature-type" data-tsd-kind="Type alias">OnlineHandler</a><span class="tsd-signature-symbol">&lt;</span><a href="iworker.html" class="tsd-signature-type" data-tsd-kind="Interface">IWorker</a><span class="tsd-signature-symbol">&gt;</span></h5>
157 <div class="tsd-comment tsd-typography">
158 <p>The online handler.</p>
159 </div>
160 </li>
161 </ul>
162 <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
163 </li>
164 <li class="tsd-description">
165 <aside class="tsd-sources">
166 <ul>
7c0ba920 167 <li>Defined in <a href="https://github.com/jerome-benoit/poolifier/blob/7fb595d/src/pools/abstract-pool.ts#L60">src/pools/abstract-pool.ts:60</a></li>
5ea22628
JB
168 </ul>
169 </aside>
170 <div class="tsd-comment tsd-typography">
171 <div class="lead">
172 <p>Register a listener to the exit event.</p>
173 </div>
174 </div>
175 <h4 class="tsd-parameters-title">Parameters</h4>
176 <ul class="tsd-parameters">
177 <li>
178 <h5>event: <span class="tsd-signature-type">&quot;exit&quot;</span></h5>
179 <div class="tsd-comment tsd-typography">
180 <p><code>&#39;exit&#39;</code>.</p>
181 </div>
182 </li>
183 <li>
184 <h5>handler: <a href="../index.html#exithandler" class="tsd-signature-type" data-tsd-kind="Type alias">ExitHandler</a><span class="tsd-signature-symbol">&lt;</span><a href="iworker.html" class="tsd-signature-type" data-tsd-kind="Interface">IWorker</a><span class="tsd-signature-symbol">&gt;</span></h5>
185 <div class="tsd-comment tsd-typography">
186 <p>The exit handler.</p>
187 </div>
188 </li>
189 </ul>
190 <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
191 </li>
192 </ul>
193 </section>
194 <section class="tsd-panel tsd-member tsd-kind-method tsd-parent-kind-interface">
195 <a name="once" class="tsd-anchor"></a>
196 <h3>once</h3>
197 <ul class="tsd-signatures tsd-kind-method tsd-parent-kind-interface">
198 <li class="tsd-signature tsd-kind-icon">once<span class="tsd-signature-symbol">(</span>event<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">&quot;exit&quot;</span>, handler<span class="tsd-signature-symbol">: </span><a href="../index.html#exithandler" class="tsd-signature-type" data-tsd-kind="Type alias">ExitHandler</a><span class="tsd-signature-symbol">&lt;</span><a href="iworker.html" class="tsd-signature-type" data-tsd-kind="Interface">IWorker</a><span class="tsd-signature-symbol">&gt;</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span></li>
199 </ul>
200 <ul class="tsd-descriptions">
201 <li class="tsd-description">
202 <aside class="tsd-sources">
203 <ul>
7c0ba920 204 <li>Defined in <a href="https://github.com/jerome-benoit/poolifier/blob/7fb595d/src/pools/abstract-pool.ts#L67">src/pools/abstract-pool.ts:67</a></li>
5ea22628
JB
205 </ul>
206 </aside>
207 <div class="tsd-comment tsd-typography">
208 <div class="lead">
209 <p>Register a listener to the exit event that will only performed once.</p>
210 </div>
211 </div>
212 <h4 class="tsd-parameters-title">Parameters</h4>
213 <ul class="tsd-parameters">
214 <li>
215 <h5>event: <span class="tsd-signature-type">&quot;exit&quot;</span></h5>
216 <div class="tsd-comment tsd-typography">
217 <p><code>&#39;exit&#39;</code>.</p>
218 </div>
219 </li>
220 <li>
221 <h5>handler: <a href="../index.html#exithandler" class="tsd-signature-type" data-tsd-kind="Type alias">ExitHandler</a><span class="tsd-signature-symbol">&lt;</span><a href="iworker.html" class="tsd-signature-type" data-tsd-kind="Interface">IWorker</a><span class="tsd-signature-symbol">&gt;</span></h5>
222 <div class="tsd-comment tsd-typography">
223 <p>The exit handler.</p>
224 </div>
225 </li>
226 </ul>
227 <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4>
228 </li>
229 </ul>
230 </section>
231 </section>
232 </div>
233 <div class="col-4 col-menu menu-sticky-wrap menu-highlight">
234 <nav class="tsd-navigation primary">
235 <ul>
236 <li class=" ">
237 <a href="../index.html">Exports</a>
238 </li>
239 </ul>
240 </nav>
241 <nav class="tsd-navigation secondary menu-sticky">
242 <ul class="before-current">
243 <li class=" tsd-kind-class tsd-has-type-parameter">
244 <a href="../classes/abstractworker.html" class="tsd-kind-icon">Abstract<wbr>Worker</a>
245 </li>
246 <li class=" tsd-kind-class tsd-has-type-parameter">
247 <a href="../classes/clusterworker.html" class="tsd-kind-icon">Cluster<wbr>Worker</a>
248 </li>
249 <li class=" tsd-kind-class tsd-has-type-parameter">
250 <a href="../classes/dynamicclusterpool.html" class="tsd-kind-icon">Dynamic<wbr>Cluster<wbr>Pool</a>
251 </li>
252 <li class=" tsd-kind-class tsd-has-type-parameter">
253 <a href="../classes/dynamicthreadpool.html" class="tsd-kind-icon">Dynamic<wbr>Thread<wbr>Pool</a>
254 </li>
255 <li class=" tsd-kind-class tsd-has-type-parameter">
256 <a href="../classes/fixedclusterpool.html" class="tsd-kind-icon">Fixed<wbr>Cluster<wbr>Pool</a>
257 </li>
258 <li class=" tsd-kind-class tsd-has-type-parameter">
259 <a href="../classes/fixedthreadpool.html" class="tsd-kind-icon">Fixed<wbr>Thread<wbr>Pool</a>
260 </li>
261 <li class=" tsd-kind-class tsd-has-type-parameter">
262 <a href="../classes/threadworker.html" class="tsd-kind-icon">Thread<wbr>Worker</a>
263 </li>
264 <li class=" tsd-kind-interface">
265 <a href="clusterpooloptions.html" class="tsd-kind-icon">Cluster<wbr>Pool<wbr>Options</a>
266 </li>
267 <li class=" tsd-kind-interface tsd-has-type-parameter">
268 <a href="ipool.html" class="tsd-kind-icon">IPool</a>
269 </li>
270 </ul>
271 <ul class="current">
272 <li class="current tsd-kind-interface">
273 <a href="iworker.html" class="tsd-kind-icon">IWorker</a>
274 <ul>
275 <li class=" tsd-kind-method tsd-parent-kind-interface">
276 <a href="iworker.html#on" class="tsd-kind-icon">on</a>
277 </li>
278 <li class=" tsd-kind-method tsd-parent-kind-interface">
279 <a href="iworker.html#once" class="tsd-kind-icon">once</a>
280 </li>
281 </ul>
282 </li>
283 </ul>
284 <ul class="after-current">
285 <li class=" tsd-kind-interface tsd-has-type-parameter">
286 <a href="pooloptions.html" class="tsd-kind-icon">Pool<wbr>Options</a>
287 </li>
288 <li class=" tsd-kind-interface">
289 <a href="workeroptions.html" class="tsd-kind-icon">Worker<wbr>Options</a>
290 </li>
291 <li class=" tsd-kind-type-alias tsd-has-type-parameter">
292 <a href="../index.html#errorhandler" class="tsd-kind-icon">Error<wbr>Handler</a>
293 </li>
294 <li class=" tsd-kind-type-alias tsd-has-type-parameter">
295 <a href="../index.html#exithandler" class="tsd-kind-icon">Exit<wbr>Handler</a>
296 </li>
297 <li class=" tsd-kind-type-alias">
298 <a href="../index.html#killbehavior" class="tsd-kind-icon">Kill<wbr>Behavior</a>
299 </li>
300 <li class=" tsd-kind-type-alias tsd-has-type-parameter">
301 <a href="../index.html#onlinehandler" class="tsd-kind-icon">Online<wbr>Handler</a>
302 </li>
303 <li class=" tsd-kind-type-alias">
304 <a href="../index.html#threadworkerwithmessagechannel" class="tsd-kind-icon">Thread<wbr>Worker<wbr>With<wbr>Message<wbr>Channel</a>
305 </li>
306 <li class=" tsd-kind-type-alias">
307 <a href="../index.html#workerchoicestrategy" class="tsd-kind-icon">Worker<wbr>Choice<wbr>Strategy</a>
308 </li>
309 <li class=" tsd-kind-variable">
310 <a href="../index.html#killbehaviors" class="tsd-kind-icon">Kill<wbr>Behaviors</a>
311 </li>
312 <li class=" tsd-kind-variable">
313 <a href="../index.html#workerchoicestrategies" class="tsd-kind-icon">Worker<wbr>Choice<wbr>Strategies</a>
314 </li>
315 </ul>
316 </nav>
317 </div>
318 </div>
319</div>
320<footer class="with-border-bottom">
321 <div class="container">
322 <h2>Legend</h2>
323 <div class="tsd-legend-group">
324 <ul class="tsd-legend">
325 <li class="tsd-kind-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li>
326 <li class="tsd-kind-method tsd-parent-kind-interface"><span class="tsd-kind-icon">Method</span></li>
327 </ul>
328 <ul class="tsd-legend">
329 <li class="tsd-kind-property tsd-parent-kind-class"><span class="tsd-kind-icon">Property</span></li>
330 <li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li>
331 </ul>
332 <ul class="tsd-legend">
333 <li class="tsd-kind-property tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited property</span></li>
334 <li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited method</span></li>
335 </ul>
336 <ul class="tsd-legend">
337 <li class="tsd-kind-property tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected property</span></li>
338 <li class="tsd-kind-method tsd-parent-kind-class tsd-is-protected"><span class="tsd-kind-icon">Protected method</span></li>
339 </ul>
340 <ul class="tsd-legend">
341 <li class="tsd-kind-method tsd-parent-kind-class tsd-is-private"><span class="tsd-kind-icon">Private method</span></li>
342 </ul>
343 </div>
344 </div>
345</footer>
346<div class="container tsd-generator">
347 <p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p>
348</div>
349<div class="overlay"></div>
350<script src="../assets/js/main.js"></script>
351</body>
352</html>