@@ -45,7 +45,7 @@ When the maximum number of threads is reached and workers are busy, an event is
+
Defined in src/pools/thread/dynamic.ts:15
@@ -81,18 +81,22 @@ When the maximum number of threads is reached and workers are busy, an event is
Methods
afterTaskExecutionHook
-
afterWorkerSetup
+
afterWorkerNodeSetup
beforeTaskExecutionHook
checkDynamicPoolSize
-
createAndSetupDynamicWorker
-
createAndSetupWorker
+
createAndSetupDynamicWorkerNode
+
createAndSetupWorkerNode
createWorker
destroy
-
destroyWorker
+
destroyWorkerNode
enableTasksQueue
execute
+
flushTasksQueue
+
getWorkerInfo
internalBusy
isMain
+
registerWorkerMessageListener
+
sendStartupMessageToWorker
sendToWorker
setTasksQueueOptions
setWorkerChoiceStrategy
@@ -143,7 +147,7 @@ When the maximum number of threads is reached and workers are busy, an event is
+
Defined in src/pools/thread/dynamic.ts:27
Properties
@@ -162,7 +166,7 @@ When the maximum number of threads is reached and workers are busy, an event is
+Defined in src/pools/abstract-pool.ts:64
Protected
Readonly
filePath
filePath: string
@@ -171,7 +175,7 @@ When the maximum number of threads is reached and workers are busy, an event is
+
Defined in src/pools/abstract-pool.ts:104
Protected
Readonly
max
max: number
@@ -179,7 +183,7 @@ When the maximum number of threads is reached and workers are busy, an event is
+Defined in src/pools/thread/dynamic.ts:29
Protected
Readonly
numberOfWorkers
numberOfWorkers: number
@@ -188,7 +192,7 @@ When the maximum number of threads is reached and workers are busy, an event is
+Defined in src/pools/abstract-pool.ts:103
Protected
Readonly
opts
@@ -197,11 +201,11 @@ When the maximum number of threads is reached and workers are busy, an event is
+
Defined in src/pools/thread/fixed.ts:48
Protected
promiseResponseMap
-
-
The execution response promise map.
+The task execution response promise map.
key
: The message id of each submitted task.value
: An object that contains the worker, the execution response promise resolve and reject callbacks.Protected
workerReadonly
workerAccessors
Protected
full@@ -257,7 +261,7 @@ When the maximum number of threads is reached and workers are busy, an event is
info
@@ -269,84 +273,87 @@ When the maximum number of threads is reached and workers are busy, an event is
Protected
maxPool maximum size.
+The pool maximum size.
Returns number
+Protected
minPool minimum size.
+The pool minimum size.
Returns number
+Private
readyReturns boolean
Protected
typePool type.
+The pool type.
If it is
'dynamic'
, it provides themax
property.Returns "fixed" | "dynamic"
Overrides FixedThreadPool.type
-- Defined in src/pools/thread/dynamic.ts:38
Private
utilizationGets the approximate pool utilization.
+The approximate pool utilization.
Returns number
The pool utilization.
Inherited from FixedThreadPool.utilization
-- Defined in src/pools/abstract-pool.ts:446
Protected
worker-- get worker(): "cluster" | "thread"
+- get worker(): "thread" | "cluster"
-
-
-
+- Defined in src/pools/thread/fixed.ts:125
Task Execution Hook
Gets the worker type.
+The worker type.
Returns "cluster" | "thread"
+Returns "thread" | "cluster"
Inherited from FixedThreadPool.worker
-- Defined in src/pools/thread/fixed.ts:81
Methods
Protected
after-- after
Task Execution Hook(worker, message): void
+- after
Task Execution Hook(workerNodeKey, message): void
-
-
-
-
@@ -368,28 +375,28 @@ Can be overridden.
-
-- Defined in src/pools/abstract-pool.ts:733
+
+ Worker Node Setup
Hook executed after the worker task execution. Can be overridden.
@@ -355,8 +362,8 @@ Can be overridden.Parameters
worker: Worker
-The worker.
+workerNodeKey: number
+The worker node key.
Inherited from FixedThreadPool.afterTaskExecutionHook
-- Defined in src/pools/abstract-pool.ts:716
Worker Setup
+Protected
afterProtected
after-- after
Worker Setup(worker): void
+- after
Worker Node Setup(workerNodeKey): void
-
-
-
-
-
+- Defined in src/pools/abstract-pool.ts:962
Task Execution Hook
+- Defined in src/pools/abstract-pool.ts:712
Dynamic Pool Size
-
-- Defined in src/pools/abstract-pool.ts:173
+
+ And Setup Dynamic Worker Node
Function that can be hooked up when a worker has been newly created and moved to the pool worker nodes. +
Method hooked up after a worker node has been newly created. Can be overridden.
Parameters
worker: Worker
-The newly created worker.
+workerNodeKey: number
+The newly created worker node key.
Returns void
Inherited from FixedThreadPool.afterWorkerSetup
+Inherited from FixedThreadPool.afterWorkerNodeSetup
-- Defined in src/pools/abstract-pool.ts:1024
Protected
before@@ -415,7 +422,7 @@ Can be overridden.
Inherited from FixedThreadPool.beforeTaskExecutionHook
-- Defined in src/pools/abstract-pool.ts:695
Protected
check@@ -431,33 +438,33 @@ Can be overridden.
Returns void
Inherited from FixedThreadPool.checkDynamicPoolSize
-- Defined in src/pools/abstract-pool.ts:173
And Setup Dynamic Worker
+Protected
createProtected
create-- create
And Setup Dynamic Worker(): Worker
+- create
And Setup Dynamic Worker Node(): number
-
-
-
-
-
-- Defined in src/pools/abstract-pool.ts:911
+
+ And Setup Worker Node
Creates a new dynamic worker and sets it up completely in the pool worker nodes.
+Creates a new, completely set up dynamic worker node.
Returns Worker
New, completely set up dynamic worker.
+Returns number
New, completely set up dynamic worker node key.
Inherited from FixedThreadPool.createAndSetupDynamicWorker
+Inherited from FixedThreadPool.createAndSetupDynamicWorkerNode
-- Defined in src/pools/abstract-pool.ts:976
And Setup Worker
+Protected
createProtected
create-- create
And Setup Worker(): Worker
+- create
And Setup Worker Node(): number
-
-
-
-
+- Defined in src/pools/abstract-pool.ts:871
Worker
+- Defined in src/pools/thread/fixed.ts:112
- destroy(): Promise<void>
-
-
-
-- Defined in src/pools/abstract-pool.ts:675
+
+ Worker Node
Creates a new worker and sets it up completely in the pool worker nodes.
+Creates a new, completely set up worker node.
Returns Worker
New, completely set up worker.
+Returns number
New, completely set up worker node key.
Inherited from FixedThreadPool.createAndSetupWorker
+Inherited from FixedThreadPool.createAndSetupWorkerNode
-- Defined in src/pools/abstract-pool.ts:937
Protected
create@@ -470,39 +477,39 @@ Can be overridden.
Inherited from FixedThreadPool.createWorker
-- Defined in src/pools/thread/fixed.ts:68
destroy
Terminates every current worker in this pool.
+Terminates all workers in this pool.
Returns Promise<void>
Inherited from FixedThreadPool.destroy
-- Defined in src/pools/abstract-pool.ts:650
Worker
+Protected
destroyProtected
destroy-- destroy
Worker(worker): Promise<void>
+- destroy
Worker Node(workerNodeKey): Promise<void>
-
-
-
-
-
+- Defined in src/pools/thread/fixed.ts:59
+- Defined in src/pools/abstract-pool.ts:571
Terminates the given worker.
+Terminates the worker node given its worker node key.
Parameters
worker: Worker
-A worker within
+workerNodes
.workerNodeKey: number
+The worker node key.
Returns Promise<void>
Inherited from FixedThreadPool.destroyWorker
+Inherited from FixedThreadPool.destroyWorkerNode
-- Defined in src/pools/thread/fixed.ts:57
enable Tasks Queue
@@ -527,7 +534,7 @@ Can be overridden.
Inherited from FixedThreadPool.enableTasksQueue
-- Defined in src/pools/abstract-pool.ts:555
execute
@@ -540,12 +547,12 @@ Can be overridden.-
-
+- Defined in src/pools/abstract-pool.ts:643
+
+
+
+
Busy
- internal
Busy(): boolean
-
-
+- Defined in src/pools/abstract-pool.ts:622
Main
+- Defined in src/pools/thread/fixed.ts:54
+
+
+
+
To Worker
-Optional
data: DataThe task input data for the specified worker function. This can only be structured-cloneable data.
+The task input data for the specified task function. This can only be structured-cloneable data.
-Optional
name: stringThe name of the worker function to execute. If not specified, the default worker function will be executed.
+The name of the task function to execute. If not specified, the default task function will be executed.
Returns Promise<Response>
Promise that will be fulfilled when the task is completed.
@@ -553,20 +560,55 @@ Can be overridden.Inherited from FixedThreadPool.execute
-- Defined in src/pools/abstract-pool.ts:615
Tasks Queue
+Protected
flush+- flush
Tasks Queue(workerNodeKey): void
+-
+
+
+
+
Parameters
++-
+
workerNodeKey: number
Returns void
Inherited from FixedThreadPool.flushTasksQueue
++- Defined in src/pools/abstract-pool.ts:1174
Worker Info
+Protected
get+- get
Worker Info(workerNodeKey): WorkerInfo
+-
+
+
+
+
+
Gets the worker information given its worker node key.
+Parameters
++-
+
+
workerNodeKey: number
+The worker node key.
+Returns WorkerInfo
The worker information.
+ +Inherited from FixedThreadPool.getWorkerInfo
++- Defined in src/pools/abstract-pool.ts:1113
Protected
internalWhether worker nodes are executing at least one task.
+Whether worker nodes are executing concurrently their tasks quota or not.
Returns boolean
Worker nodes busyness boolean status.
Inherited from FixedThreadPool.internalBusy
-- Defined in src/pools/abstract-pool.ts:606
Protected
is@@ -578,20 +620,81 @@ Can be overridden.
Inherited from FixedThreadPool.isMain
-- Defined in src/pools/thread/fixed.ts:52
Worker Message Listener
+Protected
register+- register
Worker Message Listener<Message>(workerNodeKey, listener): void
+-
+
+
+
+
+
+
+
Registers a listener callback on the worker given its worker node key.
+Type Parameters
++-
+
Message
Parameters
++-
+
+
+-
+
+
+
workerNodeKey: number
+The worker node key.
+listener: ((message) => void)
+The message listener callback.
++-
+
+- (message): void
+-
+
+
+
Parameters
++-
+
message: MessageValue<Message, unknown>
Returns void
Returns void
+Inherited from FixedThreadPool.registerWorkerMessageListener
++- Defined in src/pools/thread/fixed.ts:102
Startup Message To Worker
+Protected
send+- send
Startup Message To Worker(workerNodeKey): void
+-
+
+
+
+
+
Sends the startup message to worker given its worker node key.
+Parameters
++-
+
+
workerNodeKey: number
+The worker node key.
+Returns void
+Inherited from FixedThreadPool.sendStartupMessageToWorker
++- Defined in src/pools/thread/fixed.ts:86
Protected
send-- send
To Worker(worker, message): void
+- send
To Worker(workerNodeKey, message): void
-
-
-
-
-
@@ -603,7 +706,7 @@ Can be overridden.
+- Defined in src/pools/thread/fixed.ts:76
+- Defined in src/pools/abstract-pool.ts:583
+- Defined in src/pools/abstract-pool.ts:541
+- Defined in src/pools/abstract-pool.ts:560
Hook
+- Defined in src/pools/abstract-pool.ts:696
Listener
- worker
Listener(): ((message) => void)
-
-
- (message): void
-
-
+- Defined in src/pools/abstract-pool.ts:1045
@@ -748,18 +851,22 @@ Can be overridden.
- utilization
- worker
- after
Task Execution Hook
-- after
Worker Setup
+- after
Worker Node Setup
- before
Task Execution Hook
- check
Dynamic Pool Size
-- create
And Setup Dynamic Worker
-- create
And Setup Worker
+- create
And Setup Dynamic Worker Node
+- create
And Setup Worker Node
- create
Worker
- destroy
-- destroy
Worker
+- destroy
Worker Node
- enable
Tasks Queue
- execute
+- flush
Tasks Queue
+- get
Worker Info
- internal
Busy
- is
Main
+- register
Worker Message Listener
+- send
Startup Message To Worker
- send
To Worker
- set
Tasks Queue Options
- set
Worker Choice Strategy
@@ -767,7 +874,7 @@ Can be overridden.
- setup
Hook
- worker
Listener
-
Sends a message to the given worker.
+Sends a message to worker given its worker node key.
Parameters
worker: Worker
-The worker which should receive the message.
+workerNodeKey: number
+The worker node key.
Inherited from FixedThreadPool.sendToWorker
-- Defined in src/pools/thread/fixed.ts:63
set Tasks Queue Options
@@ -623,7 +726,7 @@ Can be overridden.
Inherited from FixedThreadPool.setTasksQueueOptions
-- Defined in src/pools/abstract-pool.ts:567
set Worker Choice Strategy
@@ -648,7 +751,7 @@ Can be overridden.
Inherited from FixedThreadPool.setWorkerChoiceStrategy
-- Defined in src/pools/abstract-pool.ts:525
set Worker Choice Strategy Options
@@ -668,7 +771,7 @@ Can be overridden.
Inherited from FixedThreadPool.setWorkerChoiceStrategyOptions
-- Defined in src/pools/abstract-pool.ts:544
Protected
setup@@ -681,13 +784,13 @@ Can be overridden.
Inherited from FixedThreadPool.setupHook
-- Defined in src/pools/abstract-pool.ts:679
Protected
workerThis function is the listener registered for each worker message.
+This method is the listener registered for each worker message.
Returns ((message) => void)
The listener function to execute when a message is received from a worker.
@@ -696,7 +799,7 @@ Can be overridden.This function is the listener registered for each worker message.
+This method is the listener registered for each worker message.
Parameters
@@ -709,7 +812,7 @@ Can be overridden.Inherited from FixedThreadPool.workerListener
-- Defined in src/pools/abstract-pool.ts:1075