X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=docs%2Fclasses%2FFixedThreadPool.html;h=75f41dbfacfc286e76e82cd0faf227fc2fa63e22;hb=d5d8ef5b0645ff2e43010f981a768c48cd559854;hp=b8d02a3b8d2306644cd511e74b60732eaf82652f;hpb=15d6dfaf877ec6a99e2bde48cb3c8a9e8671c075;p=poolifier.git diff --git a/docs/classes/FixedThreadPool.html b/docs/classes/FixedThreadPool.html index b8d02a3b..75f41dbf 100644 --- a/docs/classes/FixedThreadPool.html +++ b/docs/classes/FixedThreadPool.html @@ -17,8 +17,6 @@
A thread pool with a fixed number of threads.
-It is possible to perform tasks in sync or asynchronous mode as you prefer.
-This pool selects the threads in a round robin fashion.
Author
Alessandro Pio Ardizio
@@ -30,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
@@ -80,9 +78,9 @@
after Task Execution Hook
-after Worker Setup
+after Worker Setup
before Task Execution Hook
-choose Worker Node
+create And Setup Dynamic Worker
create And Setup Worker
create Worker
destroy
@@ -91,7 +89,6 @@
execute
internal Busy
is Main
-register Worker Message Listener
send To Worker
set Tasks Queue Options
set Worker Choice Strategy
@@ -129,7 +126,7 @@
-
-
Methods
opts: PoolOptions<ThreadWorkerWithMessageChannel> = {}
+opts: ThreadPoolOptions = {}
Options for this fixed thread pool.
Properties
Protected
Readonly
fileProtected
Readonly
number
-Protected
Readonly
optsOptions for the pool.
+Options for this fixed thread pool.
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.
-Default to a round robin algorithm.
Nodes
-Readonly
workerPool worker nodes.
Accessors
Protected
full@@ -243,7 +239,7 @@
info
@@ -255,7 +251,7 @@
Protected
max@@ -267,7 +263,7 @@
Protected
min@@ -279,7 +275,7 @@
Protected
type@@ -292,7 +288,7 @@
Protected
worker@@ -304,7 +300,7 @@
Methods
Parameters
worker: ThreadWorkerWithMessageChannel
+worker: Worker
The worker.
message: MessageValue<Response, 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:699
Task Execution Hook
-
-- Defined in src/pools/abstract-pool.ts:490
+
+ 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-- before
Task Execution Hook(workerNodeKey): void
+- before
Task Execution Hook(workerNodeKey, task): void
-
+
+-
+
Hook executed before the worker task execution. Can be overridden.
@@ -369,75 +365,80 @@ Can be overridden.workerNodeKey: number
The worker node key.
task: Task<Data>
+The task to execute.
+Returns void
Worker Node
+Protected
chooseProtected
create-- choose
Worker Node(): number
+- create
And Setup Dynamic Worker(): Worker
-
-
-- Defined in src/pools/abstract-pool.ts:742
And Setup Worker
+- Defined in src/pools/abstract-pool.ts:709
Worker
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:73
- destroy(): Promise<void>
-
-
- Defined in src/pools/abstract-pool.ts:451
Worker
- destroy
Worker(worker): Promise<void>
-
-
-
-
@@ -445,7 +446,7 @@ Can be overridden.
+- Defined in src/pools/thread/fixed.ts:62
+- Defined in src/pools/abstract-pool.ts:357
+- Defined in src/pools/thread/fixed.ts:68
+- Defined in src/pools/abstract-pool.ts:369
+- Defined in src/pools/abstract-pool.ts:324
+- Defined in src/pools/abstract-pool.ts:346
Hook
- setup
Hook(): void
-
-
+- Defined in src/pools/abstract-pool.ts:474
Listener
+
+ - Defined in src/pools/abstract-pool.ts:769
@@ -725,9 +689,9 @@ Can be overridden
- type
- worker
- after
Task Execution Hook
-- after
Worker Setup
+- after
Worker Setup
- before
Task Execution Hook
-- choose
Worker Node
+- create
And Setup Dynamic Worker
- create
And Setup Worker
- create
Worker
- destroy
@@ -736,7 +700,6 @@ Can be overridden
- execute
- internal
Busy
- is
Main
-- register
Worker Message Listener
- send
To Worker
- set
Tasks Queue Options
- set
Worker Choice Strategy
@@ -759,36 +722,46 @@ Can be overridden
- Thread
Worker
- Worker
Choice Strategy Context
- Cluster
Pool Options
+- Event
Loop Utilization Measurement Statistics
- IPool
- IWorker
- IWorker
Choice Strategy
+- Measurement
Options
+- Measurement
Statistics
+- Measurement
Statistics Requirements
- Message
Value
- Pool
Info
- Pool
Options
- Promise
Response Wrapper
-- Required
Statistics
+- Strategy
Policy
- Task
+- Task
Error
+- Task
Performance
+- Task
Statistics
+- Task
Statistics Requirements
- Tasks
Queue Options
-- Tasks
Usage
+- Thread
Pool Options
- Worker
Choice Strategy Options
- Worker
Node
- Worker
Options
-- Draft
-- Error
Handler
+- Worker
Statistics
+- Worker
Usage
+- Error
Handler
- Exit
Handler
- Kill
Behavior
+- Measurement
- Message
Handler
- Online
Handler
- Pool
Event
- Pool
Type
- Task
Functions
-- Thread
Worker With Message Channel
- Worker
Async Function
- Worker
Choice Strategy
- Worker
Function
- Worker
Sync Function
- Worker
Type
- Kill
Behaviors
+- Measurements
- Pool
Events
- Pool
Types
- Worker
Choice Strategies
Returns a newly created worker.
+Creates a new worker.
Returns ThreadWorkerWithMessageChannel
+Returns Worker
Newly created worker.
+ +destroy
Shutdowns every current worker in this pool.
+Terminate 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
@@ -470,7 +471,7 @@ Can be overridden.
execute
@@ -483,7 +484,7 @@ Can be overridden.-
-
@@ -496,16 +497,20 @@ Can be overridden.
+- Defined in src/pools/abstract-pool.ts:417
Busy
- internal
Busy(): boolean
-
-
+- Defined in src/pools/abstract-pool.ts:408
Main
-
-
+- Defined in src/pools/thread/fixed.ts:57
To Worker
@@ -583,7 +547,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@@ -517,48 +522,7 @@ Can be overridden.
Overrides AbstractPool.isMain
-- Defined in src/pools/thread/fixed.ts:54
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, Worker | MessagePort>
Returns void
Returns void
-Overrides AbstractPool.registerWorkerMessageListener
--- Defined in src/pools/thread/fixed.ts:75
Protected
send@@ -570,12 +534,12 @@ Can be overridden.-
-
-
-
Parameters
worker: ThreadWorkerWithMessageChannel
+worker: Worker
The worker which should receive the message.
message: MessageValue<Data, Worker | MessagePort>
+message: MessageValue<Data, unknown>
The message.
Overrides AbstractPool.sendToWorker
-- Defined in src/pools/thread/fixed.ts:67
set Tasks Queue Options
@@ -603,7 +567,7 @@ Can be overridden.
Inherited from AbstractPool.setTasksQueueOptions
-- Defined in src/pools/abstract-pool.ts:337
set Worker Choice Strategy
@@ -615,7 +579,7 @@ Can be overridden.-
-
@@ -628,7 +592,7 @@ Can be overridden.
Parameters
workerChoiceStrategy: "ROUND_ROBIN" | "LEAST_USED" | "LEAST_BUSY" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN" | "INTERLEAVED_WEIGHTED_ROUND_ROBIN"
+workerChoiceStrategy: "ROUND_ROBIN" | "LEAST_USED" | "LEAST_BUSY" | "LEAST_ELU" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN" | "INTERLEAVED_WEIGHTED_ROUND_ROBIN"
The worker choice strategy.
Inherited from AbstractPool.setWorkerChoiceStrategy
-- Defined in src/pools/abstract-pool.ts:284
set Worker Choice Strategy Options
@@ -648,20 +612,20 @@ Can be overridden.
Inherited from AbstractPool.setWorkerChoiceStrategyOptions
-- Defined in src/pools/abstract-pool.ts:314
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:438
Protected
worker@@ -682,14 +646,14 @@ Can be overridden-
-
Parameters
message: MessageValue<Response, 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:629