X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=docs%2Fclasses%2FFixedThreadPool.html;h=d445cf31251afe513d01b71c9107de6296c55238;hb=b667be1103b9362ae29d094de05f812468464d4f;hp=b7987bd07ca1ec7ccc8afae94ec2a1dee62ea126;hpb=d61f24ac46792cfab91a154667f24fc57c90e66e;p=poolifier.git diff --git a/docs/classes/FixedThreadPool.html b/docs/classes/FixedThreadPool.html index b7987bd0..d445cf31 100644 --- a/docs/classes/FixedThreadPool.html +++ b/docs/classes/FixedThreadPool.html @@ -1,13 +1,15 @@ -FixedThreadPool | poolifier
+FixedThreadPool | poolifier - v2.6.8
-
+
  • The search index is not available
  • poolifier - v2.6.8 +
    -
    +
    • poolifier
    • @@ -15,34 +17,35 @@

      Class FixedThreadPool<Data, Response>

    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.

    - -

    Template

    of data sent to the worker. This can only be serializable data.

    - -

    Template

    of response of execution. This can only be serializable data.

    - -

    Author

    Alessandro Pio Ardizio

    +
    +
    +

    Author

    Alessandro Pio Ardizio

    -

    Since

    0.0.1

    +

    Since

    0.0.1

    -
    +

    Type Parameters

    -
      +
      • -

        Data = unknown

      • +

        Data = unknown

        +

        Type of data sent to the worker. This can only be structured-cloneable data.

        +
        +
      • -

        Response = unknown

    +

    Response = unknown

    +

    Type of execution response. This can only be structured-cloneable data.

    +
    +

    Hierarchy

    @@ -50,589 +53,626 @@

    Constructors

    -
    - -
      - +
      + +
        +
      • Constructs a new poolifier fixed thread pool.

        -
        +

        Type Parameters

        -
          +
          • -

            Data = unknown

          • +

            Data = unknown

          • -

            Response = unknown

        +

        Response = unknown

      Parameters

      • -
        numberOfThreads: number
        +
        numberOfThreads: number

        Number of threads for this pool.

        -
      • +
      +
    • -
      filePath: string
      +
      filePath: string

      Path to an implementation of a ThreadWorker file, which can be relative or absolute.

      -
    • +
    +
  • -
    opts: PoolOptions<ThreadWorkerWithMessageChannel> = {}
    +
    opts: ThreadPoolOptions = {}

    Options for this fixed thread pool.

    -
  • -

    Returns FixedThreadPool<Data, Response>

    +
    +

    Returns FixedThreadPool<Data, Response>

    +
    +
  • Defined in src/pools/thread/fixed.ts:48
  • Properties

    -
    - -
    emitter?: PoolEmitter
    -
    -

    Inherit Doc

    -
    - -
    filePath: string
    -
    - -
    max?: number
    -
    -

    Inherit Doc

    -
    - -
    nextMessageId: number = 0
    -

    Id of the next message.

    -
    -
    - -
    numberOfWorkers: number
    -
    - -
    -
    - -
    promiseMap: Map<number, PromiseWorkerResponseWrapper<ThreadWorkerWithMessageChannel, Response>> = ...
    -

    The promise 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.
    • +
      + +
      emitter?: PoolEmitter
      +

      Emitter on which events can be listened to.

      +

      Events that can currently be listened to:

      +
        +
      • 'full': Emitted when the pool is dynamic and full.
      • +
      • 'busy': Emitted when the pool is busy.
      • +
      • 'error': Emitted when an uncaught error occurs.
      • +
      • 'taskError': Emitted when an error occurs while executing a task.
      -

      When we receive a message from the worker we get a map entry and resolve/reject the promise based on the message.

      -
      -
      - -
      workerChoiceStrategyContext: WorkerChoiceStrategyContext<ThreadWorkerWithMessageChannel, Data, Response>
      -

      Worker choice strategy instance implementing the worker choice algorithm.

      -

      Default to a strategy implementing a round robin algorithm.

      -
      -
      - - -
      -

      Inherit Doc

    +
    +
    + +
    filePath: string
    +

    Path to the worker file.

    +
    +
    +
    + +
    numberOfWorkers: number
    +

    Number of workers that this pool should manage.

    +
    +
    -
    - -
    workersTasksUsage: Map<ThreadWorkerWithMessageChannel, TasksUsage> = ...
    -
    -

    Inherit Doc

    +
    + + +

    Options for this fixed thread pool.

    +
    +
    +
    + +
    promiseResponseMap: Map<string, PromiseResponseWrapper<Worker, Response>> = ...
    +

    The 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.
  • + +

    When we receive a message from the worker, we get a map entry with the promise resolve/reject bound to the message id.

    + +
    +
    + +
    workerChoiceStrategyContext: WorkerChoiceStrategyContext<Worker, Data, Response>
    +

    Worker choice strategy context referencing a worker choice algorithm implementation.

    +
    +
    +
    + +
    workerNodes: WorkerNode<Worker, Data>[] = []
    +

    Pool worker nodes.

    +
    +

    Accessors

    -
    - -
    +
    + +
    -
    - -
    +
    + +
    +
    + +
    +
    + +
    +
    + +
    +
  • Defined in src/pools/thread/fixed.ts:81
  • +
    + +
    +
    + +

    Methods

    -
    - -
    +
    + +
    -
    - - +

    Returns void

    +
    +
    + +
    -
    - -
    -
    - -
    -
    - -
    -
    - -
    -
    - - +

    Returns void

    +
    +
    + +
    -
    - -
    +
    + +
    -
    - -
    +
    + +
    -
    - -
    +
    + +
    -
    - -
    +
    + +
    -
    - - +

    Returns Promise<void>

    +
    +
    + +
    -
    - -
    -
    - - +

    Returns void

    +
    +
    + +
    -
    - - +

    Returns Promise<Response>

    Promise that will be fulfilled when the task is completed.

    + +
    +
    + +
    -
    - -
    +
    + +
    -
    - -
    +
    + +
    -
    - - +

    Returns void

    +
    +
    + +
    -
    - - +

    Returns void

    +
    +
    + +
    -
    - - +

    Returns void

    +
    +
    + +
    -
    - - +

    Returns void

    +
    +
    + +
    -
    - -
    +
    + + +
    - +
    +
    +
    +

    On This Page

    - -
    +
  • constructor
  • +
  • emitter
  • +
  • filePath
  • +
  • numberOfWorkers
  • +
  • opts
  • +
  • promiseResponseMap
  • +
  • workerChoiceStrategyContext
  • +
  • workerNodes
  • +
  • busy
  • +
  • full
  • +
  • info
  • +
  • maxSize
  • +
  • minSize
  • +
  • type
  • +
  • utilization
  • +
  • worker
  • +
  • afterTaskExecutionHook
  • +
  • afterWorkerSetup
  • +
  • beforeTaskExecutionHook
  • +
  • createAndSetupDynamicWorker
  • +
  • createAndSetupWorker
  • +
  • createWorker
  • +
  • destroy
  • +
  • destroyWorker
  • +
  • enableTasksQueue
  • +
  • execute
  • +
  • internalBusy
  • +
  • isMain
  • +
  • sendToWorker
  • +
  • setTasksQueueOptions
  • +
  • setWorkerChoiceStrategy
  • +
  • setWorkerChoiceStrategyOptions
  • +
  • setupHook
  • +
  • workerListener
  • + +

    Generated using TypeDoc

    -
    \ No newline at end of file +
    \ No newline at end of file