X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=docs%2Fclasses%2FFixedThreadPool.html;h=59591f905702ae11a28af5f2ff0d6b8e7da44592;hb=222387cba569774821d225147ac6f35f4f1bc696;hp=93b36ac679bac48e2729dc165c2e6697ed121f6b;hpb=aac8863d208eadcb0ecb33dc44d045c26f5a444f;p=poolifier.git diff --git a/docs/classes/FixedThreadPool.html b/docs/classes/FixedThreadPool.html index 93b36ac6..59591f90 100644 --- a/docs/classes/FixedThreadPool.html +++ b/docs/classes/FixedThreadPool.html @@ -1,4 +1,4 @@ -
A thread pool with a fixed number of threads.
-It is possible to perform tasks in sync or asynchronous mode as you prefer.
Author
Alessandro Pio Ardizio
@@ -29,24 +28,24 @@Data = unknown
-Type of data sent to the worker. This can only be serializable data.
+Type of data sent to the worker. This can only be structured-cloneable data.
Response = unknown
-Type of execution response. This can only be serializable data.
+Type of execution response. This can only be structured-cloneable data.
Hierarchy
-- AbstractPool<ThreadWorkerWithMessageChannel, Data, Response>
+
- AbstractPool<Worker, Data, Response>
- FixedThreadPool
- DynamicThreadPool
@@ -73,15 +72,18 @@ info max Size
min Size
+ready
type
+utilization
worker
Methods
Properties
Emitter on which events can be listened to.
Events that can currently be listened to:
-
-
+
+
+
@@ -154,7 +156,7 @@ +'full'
: Emitted when the pool is dynamic and full.'busy'
: Emitted when the pool is busy.'full'
: Emitted when the pool is dynamic and the number of workers created has reached the maximum size expected.'ready'
: Emitted when the number of workers created in the pool has reached the minimum size expected and are ready.'busy'
: Emitted when the number of workers created in the pool has reached the maximum size expected and are executing at least one task.'error'
: Emitted when an uncaught error occurs.'taskError'
: Emitted when an error occurs while executing a task.Protected
Readonly
fileProtected
Readonly
numberProtected
Readonly
opts Response Map
-Protected
promiseThe execution response promise map.
key
: The message id of each submitted task. Choice Strategy Context
-Protected
workerWorker choice strategy context referencing a worker choice algorithm implementation.
Nodes
-Readonly
workerPool worker nodes.
Accessors
Protected
full@@ -241,7 +243,7 @@
info
@@ -253,7 +255,7 @@
Protected
max@@ -265,7 +267,7 @@
Protected
min@@ -277,7 +279,16 @@
+Private
ready+- get ready(): boolean
+-
+
Returns boolean
Protected
type@@ -290,7 +301,20 @@
+Private
utilization+- get utilization(): number
+-
+
+
Gets the approximate pool utilization.
+Returns number
The pool utilization.
+ +Protected
worker@@ -302,7 +326,7 @@
Methods
Parameters
worker: ThreadWorkerWithMessageChannel
+worker: Worker
The worker.
message: MessageValue<Response, unknown, Worker | MessagePort>
+message: MessageValue<Response, unknown>
The received message.
Worker Setup
-Protected
after+- after
Worker Setup(worker): void
-
-
-
-
- Defined in src/pools/abstract-pool.ts:1024
Task Execution Hook
-
-- Defined in src/pools/abstract-pool.ts:695
+
+
+
+ And Setup Dynamic Worker
Function that can be hooked up when a worker has been newly created and moved to the pool worker nodes.
-Can be used to update the
+maxListeners
or binding themain-worker
<->worker
connection if not bind by default.Function that can be hooked up when a worker has been newly created and moved to the pool worker nodes. +Can be overridden.
Parameters
worker: ThreadWorkerWithMessageChannel
+worker: Worker
The newly created worker.
Returns void
+Protected
before@@ -377,70 +401,86 @@ Can be overridden.
Worker Node
+Protected
choose Dynamic Pool Size
+Protected
check+- check
Dynamic Pool Size(min, max): void
+-
+
+
+
Parameters
++-
+
+-
+
min: number
max: number
Returns void
Protected
create-- choose
Worker Node(): number
+- create
And Setup Dynamic Worker(): Worker
-
-
-- Defined in src/pools/abstract-pool.ts:976
And Setup Worker
+- Defined in src/pools/abstract-pool.ts:937
Worker
+ - Worker
Types
+- available
Parallelism
Chooses a worker node for the next task.
-The default worker choice strategy uses a round robin algorithm to distribute the load.
+Creates a new dynamic worker and sets it up completely in the pool worker nodes.
Returns number
The worker node key
+Returns Worker
New, completely set up dynamic worker.
+Protected
create-- create
And Setup Worker(): ThreadWorkerWithMessageChannel
+- create
And Setup Worker(): Worker
-
-
Creates a new worker and sets it up completely in the pool worker nodes.
Returns ThreadWorkerWithMessageChannel
New, completely set up worker.
+Returns Worker
New, completely set up worker.
Protected
create-- create
Worker(): ThreadWorkerWithMessageChannel
+- create
Worker(): Worker
-
-
-- Defined in src/pools/thread/fixed.ts:68
- destroy(): Promise<void>
-
-
- Defined in src/pools/abstract-pool.ts:650
Worker
- destroy
Worker(worker): Promise<void>
-
-
-
-
@@ -448,7 +488,7 @@ Can be overridden.
+- Defined in src/pools/thread/fixed.ts:57
+- Defined in src/pools/abstract-pool.ts:555
+- Defined in src/pools/thread/fixed.ts:63
+- Defined in src/pools/abstract-pool.ts:567
+- Defined in src/pools/abstract-pool.ts:525
+- Defined in src/pools/abstract-pool.ts:544
Hook
- setup
Hook(): void
-
-
+- Defined in src/pools/abstract-pool.ts:679
Listener
+
+ - Defined in src/pools/abstract-pool.ts:1075
@@ -725,12 +728,15 @@ Can be overridden
- info
- max
Size
- min
Size
+- ready
- type
+- utilization
- worker
- after
Task Execution Hook
-- after
Worker Setup
+- after
Worker Setup
- before
Task Execution Hook
-- choose
Worker Node
+- check
Dynamic Pool Size
+- create
And Setup Dynamic Worker
- create
And Setup Worker
- create
Worker
- destroy
@@ -739,7 +745,6 @@ Can be overridden
- execute
- internal
Busy
- is
Main
-- register
Worker Message Listener
- send
To Worker
- set
Tasks Queue Options
- set
Worker Choice Strategy
@@ -747,7 +752,7 @@ Can be overridden
- setup
Hook
- worker
Listener
-
Returns a newly created worker.
+Creates a new worker.
Returns ThreadWorkerWithMessageChannel
+Returns Worker
Newly created worker.
+ +destroy
Shutdowns every current worker in this pool.
+Terminates every current worker in this pool.
Returns Promise<void>
+Protected
destroyShutdowns the given worker.
+Terminates the given worker.
Parameters
worker: ThreadWorkerWithMessageChannel
+worker: Worker
A worker within
workerNodes
.enable Tasks Queue
@@ -473,7 +513,7 @@ Can be overridden.
execute
@@ -486,7 +526,7 @@ Can be overridden.-
-
@@ -499,16 +539,20 @@ Can be overridden.
+- Defined in src/pools/abstract-pool.ts:615
Busy
- internal
Busy(): boolean
-
-
+- Defined in src/pools/abstract-pool.ts:606
Main
-
-
+- Defined in src/pools/thread/fixed.ts:52
To Worker
@@ -586,7 +589,7 @@ Can be overridden.
-Optional
data: DataThe task input data for the specified worker function. This can only be serializable data.
+The task input data for the specified worker function. This can only be structured-cloneable data.
Protected
internalReturns boolean
Protected
is@@ -520,48 +564,7 @@ Can be overridden.
Overrides AbstractPool.isMain
-- Defined in src/pools/thread/fixed.ts:65
Worker Message Listener
-Protected
register-- register
Worker Message Listener<Message>(worker, listener): void
--
-
-
-
-
-
-
-
Registers a listener callback on the given worker.
-Type Parameters
---
-
Message
Parameters
---
-
-
--
-
-
-
worker: ThreadWorkerWithMessageChannel
-The worker which should register a listener.
-listener: ((message) => void)
-The message listener callback.
---
-
-- (message): void
--
-
-
-
Parameters
---
-
message: MessageValue<Message, unknown, Worker | MessagePort>
Returns void
Returns void
-Overrides AbstractPool.registerWorkerMessageListener
--- Defined in src/pools/thread/fixed.ts:86
Protected
send@@ -573,12 +576,12 @@ Can be overridden.-
-
-
-
Parameters
worker: ThreadWorkerWithMessageChannel
+worker: Worker
The worker which should receive the message.
message: MessageValue<Data, unknown, Worker | MessagePort>
+message: MessageValue<Data, unknown>
The message.
Overrides AbstractPool.sendToWorker
-- Defined in src/pools/thread/fixed.ts:78
set Tasks Queue Options
@@ -606,7 +609,7 @@ Can be overridden.
Inherited from AbstractPool.setTasksQueueOptions
-- Defined in src/pools/abstract-pool.ts:348
set Worker Choice Strategy
@@ -631,7 +634,7 @@ Can be overridden.
Inherited from AbstractPool.setWorkerChoiceStrategy
-- Defined in src/pools/abstract-pool.ts:303
set Worker Choice Strategy Options
@@ -651,20 +654,20 @@ Can be overridden.
Inherited from AbstractPool.setWorkerChoiceStrategyOptions
-- Defined in src/pools/abstract-pool.ts:325
Protected
setupSetup hook to execute code before worker node are created in the abstract constructor. -Can be overridden
+Setup hook to execute code before worker nodes are created in the abstract constructor. +Can be overridden.
Returns void
Inherited from AbstractPool.setupHook
-- Defined in src/pools/abstract-pool.ts:449
Protected
worker@@ -685,14 +688,14 @@ Can be overridden-
-
Parameters
message: MessageValue<Response, unknown, Worker | MessagePort>
message: MessageValue<Response, unknown>
Returns void
The listener function to execute when a message is received from a worker.
Inherited from AbstractPool.workerListener
-- Defined in src/pools/abstract-pool.ts:716
Generated using TypeDoc