X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=docs%2Fclasses%2FFixedThreadPool.html;h=a8a146abe8658f0b6216b71fcce58846195cfa66;hb=2905914e6e410cff2a1f8a75c8184abf701d7a16;hp=f7036d73f6eec5f3376a9304850e0bf531399971;hpb=e159532bc99166fb928b43493814cb80c0c47d54;p=poolifier.git diff --git a/docs/classes/FixedThreadPool.html b/docs/classes/FixedThreadPool.html index f7036d73..a8a146ab 100644 --- a/docs/classes/FixedThreadPool.html +++ b/docs/classes/FixedThreadPool.html @@ -1,16 +1,16 @@ -
Optional
workerChoiceStrategyOptions: WorkerChoiceStrategyOptionsProtected
setupProtected
shallProtected
shallProtected
Readonly
workerThis method is the message listener registered on each worker.
-Generated using TypeDoc
Protected
Readonly
workerThis method is the message listener registered on each worker.
+The message received from the worker.
+
A thread pool with a fixed number of threads.
+- Preparing search index...
- The search index is not available
poolifier - v4.0.15Class FixedThreadPool<Data, Response>
A thread pool with a fixed number of threads.
Author
Alessandro Pio Ardizio
Since
0.0.1
Type Parameters
Type of data sent to the worker. This can only be structured-cloneable data.
Type of execution response. This can only be structured-cloneable data.
-Hierarchy (view full)
Index
Constructors
Hierarchy (view full)
Index
Constructors
Properties
Accessors
Type Parameters
Parameters
Number of threads for this pool.
Path to an implementation of a
ThreadWorker
file, which can be relative or absolute.Options for this fixed thread pool.
-Optional
maximumNumberOfThreads: numberReturns FixedThreadPool<Data, Response>
Properties
Optional
emitterPool event emitter integrated with async resource. +
Optional
maximumNumberOfThreads: numberThe maximum number of threads for this pool.
+Returns FixedThreadPool<Data, Response>
Properties
Optional
emitterPool event emitter integrated with async resource. The async tracking tooling identifier is
poolifier:<PoolType>-<WorkerType>-pool
.Events that can currently be listened to:
@@ -69,72 +71,76 @@ The async tracking tooling identifier is
-poolifier:<PoolType>-<Wo
'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
filePath to the worker file.
-Protected
Optional
Readonly
maximumMaximum number of workers that this pool manages.
-Protected
Readonly
minimumMinimum number of workers that this pool manages.
-Protected
Readonly
optsOptions for the pool.
-Protected
promiseThe task execution response promise map:
+Protected
Readonly
filePath to the worker file.
+Protected
Optional
Readonly
maximumMaximum number of workers that this pool manages.
+Protected
Readonly
minimumMinimum number of workers that this pool manages.
+Protected
Readonly
optsOptions for the pool.
+Protected
promiseThe 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.value
: An object that contains task's worker node key, execution response promise resolve and reject callbacks, async resource.When we receive a message from the worker, we get a map entry with the promise resolve/reject bound to the message id.
-Protected
Optional
workerWorker choice strategy context referencing a worker choice algorithm implementation.
-Readonly
Internal
workerPool worker nodes.
-Accessors
Protected
busyWhether the pool is busy or not.
-The pool busyness boolean status.
-Returns boolean
Protected
emptyThe pool emptiness boolean status.
-Returns boolean
Protected
fullWhether the pool is full or not.
-The pool filling boolean status.
-Returns boolean
info
Pool information.
-Returns PoolInfo
Private
readyThe pool readiness boolean status.
-Returns boolean
Protected
typeThe pool type.
+Protected
Optional
workerWorker choice strategies context referencing worker choice algorithms implementation.
+Readonly
Internal
workerPool worker nodes.
+Accessors
Protected
busyWhether the pool is busy or not.
+Returns boolean
The pool busyness boolean status.
+Protected
emptyWhether the pool is empty or not.
+Returns boolean
The pool emptiness boolean status.
+Protected
fullWhether the pool is full or not.
+Returns boolean
The pool fullness boolean status.
+info
Pool information.
+Returns PoolInfo
Private
readyWhether the pool is ready or not.
+Returns boolean
The pool readiness boolean status.
+Protected
typeThe pool type.
If it is
-'dynamic'
, it provides themax
property.Returns "fixed" | "dynamic"
Private
utilizationThe approximate pool utilization.
+Returns "fixed" | "dynamic"
Private
utilizationThe approximate pool utilization.
Returns number
The pool utilization.
-Protected
workerThe worker type.
-Returns "thread" | "cluster"
Methods
add Task Function
Parameters
Returns Promise<boolean>
Inherit Doc
Protected
afterHook executed after the worker task execution. +
Protected
workerThe worker type.
+Returns "thread" | "cluster"
Methods
add Task Function
Parameters
Returns Promise<boolean>
Inherit Doc
Protected
afterHook executed after the worker task execution. Can be overridden.
Parameters
The worker node key.
The received message.
-Returns void
Protected
afterMethod hooked up after a worker node has been newly created. +
Returns void
Protected
afterMethod hooked up after a worker node has been newly created. Can be overridden.
Parameters
The newly created worker node key.
-Returns void
Protected
beforeHook executed before the worker task execution. +
Returns void
Protected
beforeHook executed before the worker task execution. Can be overridden.
Parameters
The worker node key.
The task to execute.
-Returns void
Protected
checkEmits dynamic worker creation events.
-Returns void
Protected
createCreates a new, completely set up dynamic worker node.
+Returns void
Protected
checkEmits dynamic worker creation events.
+Returns void
Protected
createCreates a new, completely set up dynamic worker node.
Returns number
New, completely set up dynamic worker node key.
-Protected
createCreates a new, completely set up worker node.
+Protected
createCreates a new, completely set up worker node.
Returns number
New, completely set up worker node key.
-Protected
deregisterDeregisters a listener callback on the worker given its worker node key.
+Protected
deregisterDeregisters a listener callback on the worker given its worker node key.
Type Parameters
Parameters
The worker node key.
The message listener callback.
-Parameters
Returns void
Returns void
destroy
Returns Promise<void>
Inherit Doc
Protected
destroyTerminates the worker node given its worker node key.
+Parameters
Returns void
Returns void
destroy
Returns Promise<void>
Inherit Doc
Protected
destroyTerminates the worker node given its worker node key.
Parameters
The worker node key.
-Returns Promise<void>
enable Tasks Queue
Parameters
Optional
tasksQueueOptions: TasksQueueOptionsReturns void
Inherit Doc
execute
Parameters
Optional
data: DataOptional
name: stringOptional
transferList: TransferListItem[]Returns Promise<Response>
Inherit Doc
Protected
flagParameters
Returns void
Protected
flushParameters
Returns number
Protected
getGets the worker information given its worker node key.
+Returns Promise<void>
enable Tasks Queue
Parameters
Optional
tasksQueueOptions: TasksQueueOptionsReturns void
Inherit Doc
execute
Parameters
Optional
data: DataOptional
name: stringOptional
transferList: readonly TransferListItem[]Returns Promise<Response>
Inherit Doc
Protected
flagParameters
Returns void
Protected
flushParameters
Returns number
Protected
getGets the worker information given its worker node key.
Parameters
The worker node key.
Returns undefined | WorkerInfo
The worker information.
-has Task Function
Parameters
Returns boolean
Inherit Doc
Protected
internalWhether worker nodes are executing concurrently their tasks quota or not.
+has Task Function
Parameters
Returns boolean
Inherit Doc
Protected
internalWhether worker nodes are executing concurrently their tasks quota or not.
Returns boolean
Worker nodes busyness boolean status.
-Protected
isShould return whether the worker is the main worker or not.
-Returns boolean
list Task Function Names
Returns string[]
Inherit Doc
Protected
registerRegisters once a listener callback on the worker given its worker node key.
+Protected
isReturns whether the worker is the main worker or not.
+Returns boolean
+true
if the worker is the main worker,false
otherwise.list Task Functions Properties
Returns TaskFunctionProperties[]
Inherit Doc
map Execute
Parameters
Optional
name: stringOptional
transferList: readonly TransferListItem[]Returns Promise<Response[]>
Inherit Doc
Protected
registerRegisters once a listener callback on the worker given its worker node key.
Type Parameters
Parameters
The worker node key.
The message listener callback.
-Parameters
Returns void
Returns void
Protected
registerRegisters a listener callback on the worker given its worker node key.
+Parameters
Returns void
Returns void
Protected
registerRegisters a listener callback on the worker given its worker node key.
Type Parameters
Parameters
The worker node key.
The message listener callback.
-Parameters
Returns void
Returns void
remove Task Function
Parameters
Returns Promise<boolean>
Inherit Doc
Protected
sendSends the startup message to worker given its worker node key.
+Parameters
Returns void
Returns void
remove Task Function
Parameters
Returns Promise<boolean>
Inherit Doc
Protected
sendSends the startup message to worker given its worker node key.
Parameters
The worker node key.
-Returns void
Protected
sendSends a message to worker given its worker node key.
+Returns void
Protected
sendSends a message to worker given its worker node key.
Parameters
The worker node key.
The message.
-Optional
transferList: TransferListItem[]The optional array of transferable objects.
-Returns void
set Default Task Function
Parameters
Returns Promise<boolean>
Inherit Doc
set Tasks Queue Options
Parameters
Returns void
Inherit Doc
set Worker Choice Strategy
Parameters
Optional
workerChoiceStrategyOptions: WorkerChoiceStrategyOptionsReturns void
Inherit Doc
set Worker Choice Strategy Options
Parameters
Returns void
Inherit Doc
Protected
setupSetup hook to execute code before worker nodes are created in the abstract constructor. +
Optional
transferList: readonly TransferListItem[]The optional array of transferable objects.
+Returns void