X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=docs%2Fclasses%2FFixedThreadPool.html;h=ced5f58c376f480fdd3deb799c070ee6f9341e06;hb=281812ea181d83c0a1e4de0066446e551ad1f95a;hp=131b63d5c406f1da8d3b3a69a7c30a0db8126710;hpb=c65efde664ab9e4dcd2ed9e827d8171e7e081359;p=poolifier.git diff --git a/docs/classes/FixedThreadPool.html b/docs/classes/FixedThreadPool.html index 131b63d5..ced5f58c 100644 --- a/docs/classes/FixedThreadPool.html +++ b/docs/classes/FixedThreadPool.html @@ -1,13 +1,13 @@ -
Optional
Readonly
emitter
Emitter on which events can be listened to.
+
+Optional
emitterEvent emitter integrated with async resource on which events can be listened to. +The async tracking tooling identifier is
poolifier:<PoolType>-<WorkerType>-pool
.Events that can currently be listened to:
-
-
+
+
+
+
'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.'busy'
: Emitted when the number of workers created in the pool has reached the maximum size expected and are executing concurrently their tasks quota.'full'
: Emitted when the pool is dynamic and the number of workers created has reached the maximum size expected.'destroy'
: Emitted when the pool is destroyed.'error'
: Emitted when an uncaught error occurs.'taskError'
: Emitted when an error occurs while executing a task.'backPressure'
: Emitted when all worker nodes have back pressure (i.e. their tasks queue is full: queue size >= maximum queue size).Protected
Readonly
file
+Protected
Optional
Readonly
maxDynamic pool maximum size property placeholder.
+Protected
Readonly
numberProtected
Readonly
optsProtected
promiseThe task 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
worker Nodes
+Readonly
workerReadonly
Internal
workerPool worker nodes.
Accessors
Protected
full@@ -247,7 +270,7 @@
info
@@ -259,31 +282,31 @@
Size
-Protected
max+- get maxSize(): number
-
The pool maximum size.
Returns number
Size
-Protected
min+- get minSize(): number
-
The pool minimum size.
Returns number
Private
ready@@ -295,7 +318,7 @@
Protected
type@@ -308,7 +331,7 @@
Private
utilization@@ -321,7 +344,7 @@
Protected
worker@@ -333,9 +356,40 @@
Methods
+add Task Function
++- add
Task Function(name, fn): Promise<boolean>
+-
+
+
+
+
+
Adds a task function to this pool. +If a task function with the same name already exists, it will be overwritten.
+Parameters
++-
+
+
+-
+
+
name: string
+The name of the task function.
+fn: TaskFunction<Data, Response>
+The task function.
+Returns Promise<boolean>
+ +true
if the task function was added,false
otherwise.Throws
https://nodejs.org/api/errors.html#class-typeerror If the
+ +name
parameter is not a string or an empty string.Throws
https://nodejs.org/api/errors.html#class-typeerror If the
+fn
parameter is not a function.Protected
after@@ -361,7 +415,7 @@ Can be overridden.
Protected
after@@ -382,7 +436,7 @@ Can be overridden.
Protected
before@@ -408,23 +462,7 @@ Can be overridden.
Dynamic Pool Size
-Protected
check-- check
Dynamic Pool Size(min, max): void
--
-
-
-
Parameters
---
-
--
-
min: number
max: number
Returns void
Protected
create@@ -437,7 +475,7 @@ Can be overridden.
Protected
create@@ -450,7 +488,7 @@ Can be overridden.
Protected
create@@ -463,7 +501,48 @@ Can be overridden.
Worker Message Listener
+Protected
deregister+- deregister
Worker Message Listener<Message>(workerNodeKey, listener): void
+-
+
+
+
+
+
+
Deregisters 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
+destroy
@@ -475,7 +554,7 @@ Can be overridden.
Protected
destroy@@ -495,32 +574,32 @@ Can be overridden.
enable Tasks Queue
Enables/disables the worker tasks queue in this pool.
+Enables/disables the worker node tasks queue in this pool.
Parameters
enable: boolean
-Whether to enable or disable the worker tasks queue.
+Whether to enable or disable the worker node tasks queue.
-Optional
tasksQueueOptions: TasksQueueOptionsThe worker tasks queue options.
+The worker node tasks queue options.
Returns void
execute
@@ -551,7 +630,21 @@ Can be overridden.
Worker Node As Not Ready
+Protected
flag+- flag
Worker Node As Not Ready(workerNodeKey): void
+-
+
+
+
Parameters
++-
+
workerNodeKey: number
Returns void
Protected
flush@@ -565,7 +658,7 @@ Can be overridden.
Returns void
Protected
get@@ -586,7 +679,49 @@ Can be overridden.
has Task Function
++- has
Task Function(name): boolean
+-
+
+
+
+
Whether the specified task function exists in this pool.
+Parameters
++-
+
+
name: string
+The name of the task function.
+Returns boolean
+ +true
if the task function exists,false
otherwise.has Worker Node Back Pressure
++- has
Worker Node Back Pressure(workerNodeKey): boolean
+
+
+
+
Internal
+Whether the worker node has back pressure (i.e. its tasks queue is full).
+Parameters
++-
+
+
workerNodeKey: number
+The worker node key.
+Returns boolean
+ +true
if the worker node has back pressure,false
otherwise.Protected
internal@@ -599,7 +734,7 @@ Can be overridden.
Protected
is@@ -611,7 +746,61 @@ Can be overridden.
list Task Function Names
++- list
Task Function Names(): string[]
+-
+
+
Lists the names of task function available in this pool.
+Returns string[]
The names of task function available in this pool.
+ + Once Worker Message Listener
+Protected
register+- register
Once Worker Message Listener<Message>(workerNodeKey, listener): void
+-
+
+
+
+
+
+
Registers once 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
+Protected
register@@ -652,7 +841,42 @@ Can be overridden.
remove Task Function
++- remove
Task Function(name): Promise<boolean>
+-
+
+
+
+
Removes a task function from this pool.
+Parameters
++-
+
+
name: string
+The name of the task function.
+Returns Promise<boolean>
+ +true
if the task function was removed,false
otherwise. Kill Message To Worker
+Protected
send+- send
Kill Message To Worker(workerNodeKey): Promise<void>
+-
+
+
+
Parameters
++-
+
workerNodeKey: number
Returns Promise<void>
Protected
send@@ -672,7 +896,7 @@ Can be overridden.
Protected
send@@ -702,27 +926,48 @@ Can be overridden.
set Default Task Function
++- set
Default Task Function(name): Promise<boolean>
+-
+
+
+
+
Sets the default task function in this pool.
+Parameters
++-
+
+
name: string
+The name of the task function.
+Returns Promise<boolean>
+ +true
if the default task function was set,false
otherwise.set Tasks Queue Options
Sets the worker tasks queue options in this pool.
+Sets the worker node tasks queue options in this pool.
Parameters
tasksQueueOptions: TasksQueueOptions
-The worker tasks queue options.
+The worker node tasks queue options.
Returns void
set Worker Choice Strategy
@@ -747,7 +992,7 @@ Can be overridden.
set Worker Choice Strategy Options
@@ -767,7 +1012,7 @@ Can be overridden.
Protected
setup@@ -780,40 +1025,41 @@ Can be overridden.
Listener
-Protected
worker-- worker
Listener(): ((message) => void)
+- Defined in src/pools/abstract-pool.ts:997
start
++- start(): void
-
-
-
+
+- start
+- worker
Message Listener
-
This method is the listener registered for each worker message.
+Starts the minimum number of workers in this pool.
Returns ((message) => void)
The listener function to execute when a message is received from a worker.
- ---
-
+-- (message): void
+
Returns void
+ Message Listener
+Protected
worker+- worker
Message Listener(message): void
-
-
-
-
+ - Defined in src/pools/abstract-pool.ts:1518
This method is the listener registered for each worker message.
+This method is the message listener registered on each worker.
Parameters
message: MessageValue<Response, unknown>
Returns void
The listener function to execute when a message is received from a worker.
- - +Returns void
-
+Settings
Settings
Member Visibility
Generated using TypeDoc
Generated using TypeDoc