X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=docs%2Fclasses%2FDynamicThreadPool.html;h=65b16ce6ec109670211a9043b87adb74be7868b8;hb=88cc2183d9bd9b572aa1fdef7b3e8020dbb4db39;hp=fd6d398842d6c89feb735642dfc65d1e933a0ace;hpb=2493c34370d0839614058bb55254fd7aec91b664;p=poolifier.git
diff --git a/docs/classes/DynamicThreadPool.html b/docs/classes/DynamicThreadPool.html
index fd6d3988..65b16ce6 100644
--- a/docs/classes/DynamicThreadPool.html
+++ b/docs/classes/DynamicThreadPool.html
@@ -1,11 +1,11 @@
-
DynamicThreadPool | poolifier - v4.0.11 Class DynamicThreadPool<Data, Response> set Default Task Function set Default Task Function ( name ) : Promise < boolean > Returns Promise < boolean > set Tasks Queue Options set Tasks Queue Options ( tasksQueueOptions ) : void Returns void set Worker Choice Strategy set Worker Choice Strategy ( workerChoiceStrategy , workerChoiceStrategyOptions ? ) : void Parameters workerChoiceStrategy : "ROUND_ROBIN" | "LEAST_USED" | "LEAST_BUSY" | "LEAST_ELU" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN" | "INTERLEAVED_WEIGHTED_ROUND_ROBIN" Optional
workerChoiceStrategyOptions : WorkerChoiceStrategyOptions Returns void set Worker Choice Strategy Options set Worker Choice Strategy Options ( workerChoiceStrategyOptions ) : boolean Returns boolean Protected
setup Hook setup Hook ( ) : void Returns void Protected
shall Create Dynamic Worker shall Create Dynamic Worker ( ) : boolean Returns void Protected
shall Create Dynamic Worker start start ( ) : void Returns void Protected
Readonly
worker Message Listener worker Message Listener ( message ) : void Returns void
\ No newline at end of file
+start start ( ) : void Returns void Protected
Readonly
worker Message Listener worker Message Listener ( message ) : void Returns void
\ No newline at end of file
A thread pool with a dynamic number of threads, but a guaranteed minimum number of threads.
+- Preparing search index...
- The search index is not available
poolifier - v4.0.12Class DynamicThreadPool<Data, Response>
A thread pool with a dynamic number of threads, but a guaranteed minimum number of threads.
This thread pool creates new threads when the others are busy, up to the maximum number of threads. When the maximum number of threads is reached and workers are busy, an event is emitted. If you want to listen to this event, use the pool's
emitter
.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
Maximum number of threads that can be created by this pool.
Path to an implementation of a
ThreadWorker
file, which can be relative or absolute.Options for this dynamic thread pool.
-Returns DynamicThreadPool<Data, Response>
Properties
Optional
emitterPool event emitter integrated with async resource. +
Returns DynamicThreadPool<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:
@@ -72,73 +72,73 @@ 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 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 strategies context referencing worker choice algorithms implementation.
-Readonly
Internal
workerPool worker nodes.
-Accessors
Protected
busyWhether the pool is busy or not.
+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.
The pool busyness boolean status.
-Returns boolean
Protected
emptyThe pool emptiness boolean status.
-Returns boolean
Protected
fullWhether the pool is full or not.
+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.
+Returns boolean
info
Pool information.
+Returns PoolInfo
Private
readyThe pool readiness boolean status.
+Returns boolean
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: 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.
+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
isReturns whether the worker is the main worker or not.
+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
Protected
registerRegisters once a listener callback on the worker given its worker node key.
+list Task Functions Properties
Returns TaskFunctionProperties[]
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: readonly 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 boolean
Inherit Doc
Protected
setupSetup hook to execute code before worker nodes are created in the abstract constructor. +
Returns void