X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=docs%2Fclasses%2FFixedThreadPool.html;h=75415733c11ac7dd30a0e691c695148dea229af0;hb=a34454964733f585af19a04f21f9e35eb18c77b1;hp=b8b8e4a84c8891535718d2298c9bdce134c0b3d3;hpb=3aaed019abde0022e986c1db05db9d5d7bc76594;p=poolifier.git diff --git a/docs/classes/FixedThreadPool.html b/docs/classes/FixedThreadPool.html index b8b8e4a8..75415733 100644 --- a/docs/classes/FixedThreadPool.html +++ b/docs/classes/FixedThreadPool.html @@ -6,7 +6,7 @@
Readonly
fileProtected
next
Id of the next message.
+Path to the worker-file.
Of Workers
-Readonly
number
-Readonly
optsOptions for the pool.
+Inherited from AbstractPool.opts
-- Defined in src/pools/abstract-pool.ts:81
Map
-Protected
promiseThe promise map.
+ Response Map
+Protected
promiseThe promise response map.
-
-
+
+
-key
: This is the message Id of each submitted task.value
: An object that contains the worker, the resolve function and the reject function.key
: The message id of each submitted task.value
: An object that contains the worker, the promise resolve and reject callbacks.When we receive a message from the worker we get a map entry and resolve/reject the promise based on the message.
+When we receive a message from the worker we get a map entry with the promise resolve/reject bound to the message.
Inherited from AbstractPool.promiseMap
+Inherited from AbstractPool.promiseResponseMap
-- Defined in src/pools/abstract-pool.ts:50
Protected
workerWorker choice strategy instance implementing the worker choice algorithm.
-Default to a strategy implementing a round robin algorithm.
+Worker choice strategy context referencing a worker choice algorithm implementation.
+Default to a round robin algorithm.
Inherited from AbstractPool.workerChoiceStrategyContext
-- Defined in src/pools/abstract-pool.ts:65
-Readonly
workers Nodes
+Readonly
workerInherit Doc
Inherited from AbstractPool.workers
+Inherited from AbstractPool.workerNodes
-- Defined in src/pools/abstract-pool.ts:31
Tasks Usage
-Readonly
workersInherit Doc
Inherited from AbstractPool.workersTasksUsage
--- Defined in src/pools/abstract-pool.ts:34
Accessors
Returns boolean
Overrides AbstractPool.busy
-- Defined in src/pools/thread/fixed.ts:95
number Of Running Tasks
--- get numberOfRunningTasks(): number
+- Defined in src/pools/thread/fixed.ts:105
full
++- get full(): boolean
-
+
+
Inherit Doc
Returns boolean
Overrides AbstractPool.full
++- Defined in src/pools/thread/fixed.ts:100
Of Queued Tasks
+Private
number+- get numberOfQueuedTasks(): number
+-
+
+
+
Number of tasks queued in the pool.
+Returns number
Inherited from AbstractPool.numberOfQueuedTasks
++- Defined in src/pools/abstract-pool.ts:166
Of Running Tasks
+Private
number+- get numberOfRunningTasks(): number
+-
+
Number of tasks running in the pool.
+Returns number
Inherited from AbstractPool.numberOfRunningTasks
-- Defined in src/pools/abstract-pool.ts:151
type
@@ -240,13 +253,13 @@
Returns PoolType
Overrides AbstractPool.type
-- Defined in src/pools/thread/fixed.ts:90
Methods
- Promise Worker Response Hook
+Protected
afterProtected
after-- after
Promise Worker Response Hook(message: MessageValue<Response, unknown>, promise: PromiseWorkerResponseWrapper<ThreadWorkerWithMessageChannel, Response>): void
+- after
Promise Response Hook(worker: ThreadWorkerWithMessageChannel, message: MessageValue<Response, unknown>): void
-
-
-
-
-
-
+- Defined in src/pools/abstract-pool.ts:307
Worker Setup
-
-- Defined in src/pools/thread/fixed.ts:85
+
+ Promise Response Hook
-
-- Defined in src/pools/abstract-pool.ts:236
+
+
-
-
+
+
+
+
-
-- Defined in src/pools/abstract-pool.ts:563
+
+ Tasks Queue By Worker
+
+
Hook executed after the worker task promise resolution. Can be overridden.
@@ -255,17 +268,17 @@ Can be overridden.Parameters
message: MessageValue<Response, unknown>
-The received message.
+worker: ThreadWorkerWithMessageChannel
+The worker.
promise: PromiseWorkerResponseWrapper<ThreadWorkerWithMessageChannel, Response>
-The Promise response.
+message: MessageValue<Response, unknown>
+The received message.
Returns void
Inherited from AbstractPool.afterPromiseWorkerResponseHook
+Inherited from AbstractPool.afterPromiseResponseHook
-- Defined in src/pools/abstract-pool.ts:260
Protected
after@@ -281,11 +294,11 @@ Can be overridden.
Returns void
Overrides AbstractPool.afterWorkerSetup
-- Defined in src/pools/thread/fixed.ts:80
Promise Worker Response Hook
+Protected
beforeProtected
before-- before
Promise Worker Response Hook(worker: ThreadWorkerWithMessageChannel): void
+- before
Promise Response Hook(workerNodeKey: number): void
-
-
-
-
-
-- Defined in src/pools/abstract-pool.ts:296
+
+ Worker Node
+
+
Hook executed before the worker task promise resolution. Can be overridden.
@@ -294,40 +307,40 @@ Can be overridden.Parameters
worker: ThreadWorkerWithMessageChannel
-The worker.
+workerNodeKey: number
+The worker node key.
Returns void
Inherited from AbstractPool.beforePromiseWorkerResponseHook
+Inherited from AbstractPool.beforePromiseResponseHook
-- Defined in src/pools/abstract-pool.ts:249
Worker
+Protected
chooseProtected
choose-- choose
Worker(): ThreadWorkerWithMessageChannel
+- choose
Worker Node(): [number, WorkerNode<ThreadWorkerWithMessageChannel, Data>]
-
-
-
-
+
+- Defined in src/pools/abstract-pool.ts:340
And Setup Worker
- create
And Setup Worker(): ThreadWorkerWithMessageChannel
-
-
+- Defined in src/pools/abstract-pool.ts:406
Worker
+- Defined in src/pools/thread/fixed.ts:78
+
+
+- Defined in src/pools/abstract-pool.ts:259
-
-
+
+
-
-
+
+
-
-- Defined in src/pools/abstract-pool.ts:551
+
+
-
-
Chooses a worker for the next task.
-The default implementation uses a round robin algorithm to distribute the load.
+Chooses a worker node for the next task.
+The default uses a round robin algorithm to distribute the load.
-Returns
Worker.
+Returns
[worker node key, worker node].
Returns ThreadWorkerWithMessageChannel
Inherited from AbstractPool.chooseWorker
+Returns [number, WorkerNode<ThreadWorkerWithMessageChannel, Data>]
Inherited from AbstractPool.chooseWorkerNode
-- Defined in src/pools/abstract-pool.ts:287
Protected
createCreates a new worker for this pool and sets it up completely.
+Creates a new worker and sets it up completely in the pool worker nodes.
Returns
New, completely set up worker.
Returns ThreadWorkerWithMessageChannel
Inherited from AbstractPool.createAndSetupWorker
-- Defined in src/pools/abstract-pool.ts:341
Protected
create@@ -338,7 +351,21 @@ Can be overridden.
Returns ThreadWorkerWithMessageChannel
Overrides AbstractPool.createWorker
-- Defined in src/pools/thread/fixed.ts:73
Task
+Protected
dequeue+- dequeue
Task(workerNodeKey: number): undefined | Task<Data>
+-
+
+
+
+
Parameters
++-
+
workerNodeKey: number
Returns undefined | Task<Data>
Inherited from AbstractPool.dequeueTask
++- Defined in src/pools/abstract-pool.ts:555
destroy
@@ -349,7 +376,7 @@ Can be overridden.
Returns Promise<void>
Inherited from AbstractPool.destroy
-- Defined in src/pools/abstract-pool.ts:219
destroy Worker
@@ -365,38 +392,27 @@ Can be overridden.
Returns Promise<void>
Overrides AbstractPool.destroyWorker
-- Defined in src/pools/thread/fixed.ts:49
execute
--- execute(data: Data): Promise<Response>
+- Defined in src/pools/thread/fixed.ts:54
Task
+Protected
enqueue+- enqueue
Task(workerNodeKey: number, task: Task<Data>): void
-
-
-
-
-
-
-
Inherit Doc
Parameters
data: Data
Returns Promise<Response>
Inherited from AbstractPool.execute
--- Defined in src/pools/abstract-pool.ts:205
find Free Worker
--- find
Free Worker(): false | ThreadWorkerWithMessageChannel
--
-
-
-
-
+-
+
Inherit Doc
Returns false | ThreadWorkerWithMessageChannel
Inherited from AbstractPool.findFreeWorker
+workerNodeKey: number
task: Task<Data>
Returns void
Inherited from AbstractPool.enqueueTask
-- Defined in src/pools/abstract-pool.ts:194
get Worker Average Tasks Run Time
+execute
-- get
Worker Average Tasks Run Time(worker: ThreadWorkerWithMessageChannel): undefined | number
+- execute(data: Data): Promise<Response>
-
@@ -404,68 +420,59 @@ Can be overridden.
-
-
Inherit Doc
Parameters
worker: ThreadWorkerWithMessageChannel
Returns undefined | number
Inherited from AbstractPool.getWorkerAverageTasksRunTime
+data: Data
Returns Promise<Response>
Inherited from AbstractPool.execute
-- Defined in src/pools/abstract-pool.ts:166
get Worker Index
+find Free Worker Node Key
-- get
Worker Index(worker: ThreadWorkerWithMessageChannel): number
+- find
Free Worker Node Key(): number
-
-
-
-
Inherit Doc
Parameters
---
-
worker: ThreadWorkerWithMessageChannel
Returns number
Inherited from AbstractPool.getWorkerIndex
+Inherited from AbstractPool.findFreeWorkerNodeKey
-- Defined in src/pools/abstract-pool.ts:156
get Worker Running Tasks
--- get
Worker Running Tasks(worker: ThreadWorkerWithMessageChannel): undefined | number
+- Defined in src/pools/abstract-pool.ts:229
Tasks Queue
+Protected
flush+- flush
Tasks Queue(workerNodeKey: number): void
-
-
-
-
-
-
-
Inherit Doc
Parameters
worker: ThreadWorkerWithMessageChannel
Returns undefined | number
Inherited from AbstractPool.getWorkerRunningTasks
+workerNodeKey: number
Returns void
Inherited from AbstractPool.flushTasksQueue
-- Defined in src/pools/abstract-pool.ts:161
Execute
+Protected
internalProtected
flush-- internal
Execute(worker: ThreadWorkerWithMessageChannel, messageId: number): Promise<Response>
+- flush
Tasks Queue By Worker(worker: ThreadWorkerWithMessageChannel): void
-
-
-
--
-
-
-
Parameters
worker: ThreadWorkerWithMessageChannel
messageId: number
Returns Promise<Response>
Inherited from AbstractPool.internalExecute
+worker: ThreadWorkerWithMessageChannel
Returns void
Inherited from AbstractPool.flushTasksQueueByWorker
-- Defined in src/pools/abstract-pool.ts:312
Get Busy Status
+Protected
internalProtected
internal-- internal
Get Busy Status(): boolean
+- internal
Busy(): boolean
-
-
Returns boolean
Inherited from AbstractPool.internalGetBusyStatus
+Inherited from AbstractPool.internalBusy
-- Defined in src/pools/abstract-pool.ts:186
Protected
is@@ -476,7 +483,7 @@ Can be overridden.
Returns boolean
Overrides AbstractPool.isMain
-- Defined in src/pools/thread/fixed.ts:44
register Worker Message Listener
@@ -510,25 +517,25 @@ Can be overridden.
Returns void
Overrides AbstractPool.registerWorkerMessageListener
-- Defined in src/pools/thread/fixed.ts:65
Worker
+Protected
removeProtected
remove-- remove
Worker(worker: ThreadWorkerWithMessageChannel): void
+- remove
Worker Node(worker: ThreadWorkerWithMessageChannel): void
-
-
-
-
+- Defined in src/pools/abstract-pool.ts:545
To Worker
+- Defined in src/pools/thread/fixed.ts:62
+
Removes the given worker from the pool.
+Removes the given worker from the pool worker nodes.
Parameters
worker: ThreadWorkerWithMessageChannel
-The worker that will be removed.
+The worker.
Returns void
Inherited from AbstractPool.removeWorker
+Inherited from AbstractPool.removeWorkerNode
-- Defined in src/pools/abstract-pool.ts:274
Protected
send@@ -546,11 +553,11 @@ Can be overridden.
Returns void
Overrides AbstractPool.sendToWorker
-- Defined in src/pools/thread/fixed.ts:57
set Worker Choice Strategy
-- set
Worker Choice Strategy(workerChoiceStrategy: "ROUND_ROBIN" | "LESS_RECENTLY_USED" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN"): void
+- set
Worker Choice Strategy(workerChoiceStrategy: "ROUND_ROBIN" | "LESS_USED" | "LESS_BUSY" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN"): void
-
@@ -558,29 +565,43 @@ Can be overridden.
-
-
Inherit Doc
Parameters
workerChoiceStrategy: "ROUND_ROBIN" | "LESS_RECENTLY_USED" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN"
workerChoiceStrategy: "ROUND_ROBIN" | "LESS_USED" | "LESS_BUSY" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN"
Returns void
Inherited from AbstractPool.setWorkerChoiceStrategy
-- Defined in src/pools/abstract-pool.ts:171
Protected
setupSetup hook that can be overridden by a Poolifier pool implementation -to run code before workers are created in the abstract constructor.
+Setup hook to run code before worker node are created in the abstract constructor. +Can be overridden
Returns void
Inherited from AbstractPool.setupHook
-- Defined in src/pools/abstract-pool.ts:234
Queue Length
+Protected
tasks+- tasks
Queue Length(workerNodeKey: number): number
+-
+
+
+
+
Parameters
++-
+
workerNodeKey: number
Returns number
Inherited from AbstractPool.tasksQueueLength
++- Defined in src/pools/abstract-pool.ts:559
Protected
workerThis function is the listener registered for each worker.
+This function is the listener registered for each worker message.
Returns
The listener function to execute when a message is received from a worker.
This function is the listener registered for each worker.
+This function is the listener registered for each worker message.
Returns
The listener function to execute when a message is received from a worker.
Returns void
Inherited from AbstractPool.workerListener
-- Defined in src/pools/abstract-pool.ts:365
@@ -631,37 +652,38 @@ to run code before workers are created in the abstract constructor.- constructor
- emitter?
- file
Path
-- next
Message Id
- number
Of Workers
- opts
-- promise
Map
+- promise
Response Map
- worker
Choice Strategy Context
-- workers
-- workers
Tasks Usage
+- worker
Nodes
- busy
-- number
Of Running Tasks
+- full
+- number
Of Queued Tasks
+- number
Of Running Tasks
- type
-- after
Promise Worker Response Hook
+- after
Promise Response Hook
- after
Worker Setup
-- before
Promise Worker Response Hook
-- choose
Worker
+- before
Promise Response Hook
+- choose
Worker Node
- create
And Setup Worker
- create
Worker
+- dequeue
Task
- destroy
- destroy
Worker
+- enqueue
Task
- execute
-- find
Free Worker
-- get
Worker Average Tasks Run Time
-- get
Worker Index
-- get
Worker Running Tasks
-- internal
Execute
-- internal
Get Busy Status
+- find
Free Worker Node Key
+- flush
Tasks Queue
+- flush
Tasks Queue By Worker
+- internal
Busy
- is
Main
- register
Worker Message Listener
-- remove
Worker
+- remove
Worker Node
- send
To Worker
- set
Worker Choice Strategy
- setup
Hook
+- tasks
Queue Length
- worker
Listener
Generated using TypeDoc