X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=docs%2Fclasses%2FFixedThreadPool.html;h=0c2313590675148ee628b14fd3b4b1c0cd22cbb7;hb=71a64eca52278c2396cf7cb6e6c53fce3704f5ab;hp=f49b2039eedc493d0f921e005b1f62a95a5b7611;hpb=fe9f25b5ac98c7c7fccd1849a200c5054a77cf03;p=poolifier.git diff --git a/docs/classes/FixedThreadPool.html b/docs/classes/FixedThreadPool.html index f49b2039..0c231359 100644 --- a/docs/classes/FixedThreadPool.html +++ b/docs/classes/FixedThreadPool.html @@ -1,11 +1,13 @@ FixedThreadPool | poolifier
-
+
@@ -18,10 +20,6 @@

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

Since

0.0.1

@@ -30,9 +28,13 @@

Type Parameters

  • -

    Data = unknown

  • +

    Data = unknown

    +

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

    +
  • -

    Response = unknown

+

Response = unknown

+

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

+

Hierarchy

+
  • Defined in src/pools/thread/fixed.ts:29
  • @@ -56,37 +58,32 @@

    Properties

    Accessors

    Methods

    -
    afterWorkerSetup +
    afterPromiseResponseHook +afterWorkerSetup +beforePromiseResponseHook chooseWorker createAndSetupWorker createWorker -decreaseWorkersTasks destroy destroyWorker execute -findFreeWorker -getWorkerIndex -getWorkerRunningTasks -increaseWorkersTask -internalExecute -internalGetBusyStatus +findFreeWorkerKey +internalBusy isMain registerWorkerMessageListener removeWorker @@ -100,7 +97,7 @@

    Returns FixedThreadPool<Data, Response>

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

    -
    emitter?: PoolEmitter
    +
    emitter?: PoolEmitter

    Inherit Doc

    +
  • Defined in src/pools/abstract-pool.ts:32
  • -
    filePath: string
    -
    - -
    max?: number
    -
    -

    Inherit Doc

    -
    - -
    nextMessageId: number = 0
    -

    Id of the next message.

    +
    filePath: string
    +

    Path to the worker-file.

    +
  • Defined in src/pools/abstract-pool.ts:67
  • -
    numberOfWorkers: number
    +
  • Defined in src/pools/abstract-pool.ts:66
  • -
    -
    - -
    promiseMap: Map<number, PromiseWorkerResponseWrapper<ThreadWorkerWithMessageChannel, Response>> = ...
    -

    The promise map.

    +
  • Defined in src/pools/abstract-pool.ts:68
  • +
    + +
    promiseResponseMap: Map<string, PromiseResponseWrapper<ThreadWorkerWithMessageChannel, Response>> = ...
    +

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

    -
    - -
    tasks: Map<ThreadWorkerWithMessageChannel, number> = ...
    -
    -

    Inherit Doc

    +
  • Defined in src/pools/abstract-pool.ts:42
  • workerChoiceStrategyContext: WorkerChoiceStrategyContext<ThreadWorkerWithMessageChannel, Data, Response>
    -

    Worker 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.

    +
  • Defined in src/pools/abstract-pool.ts:52
  • - +
    workers: WorkerType<ThreadWorkerWithMessageChannel>[] = []

    Inherit Doc

    +
  • Defined in src/pools/abstract-pool.ts:29
  • Accessors

    @@ -224,18 +203,29 @@

    Returns boolean

    -
    - -
    +
    + +
    +
    + +
      +
    • get numberOfRunningTasks(): number
    • +
    • +

      Number of tasks concurrently running in the pool.

      +

      Returns number

    +
  • Defined in src/pools/abstract-pool.ts:163
  • +
  • Defined in src/pools/thread/fixed.ts:95
  • Methods

    +
    + +
      + +
    • +

      Hook executed after the worker task promise resolution. +Can be overridden.

      +
      +
      +

      Parameters

      +
      +

      Returns void

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

      Hook executed before the worker task promise resolution. +Can be overridden.

      +
      +
      +

      Parameters

      +
        +
      • +
        workerKey: number
        +

        The worker key.

        +
      +

      Returns void

    +
  • Defined in src/pools/abstract-pool.ts:309
  • +
  • Defined in src/pools/abstract-pool.ts:355
  • -
    - -
    +
  • Defined in src/pools/thread/fixed.ts:78
  • +
  • Defined in src/pools/abstract-pool.ts:233
  • +
  • Defined in src/pools/thread/fixed.ts:54
  • -
    - -
    -
    - +
  • Defined in src/pools/abstract-pool.ts:217
  • +
    +
    -
    - -
    -
    - -
    -
    - -
    -
    - +
  • Defined in src/pools/abstract-pool.ts:210
  • +
    +
      - +
    • Returns boolean

    +
  • Defined in src/pools/abstract-pool.ts:202
  • +
  • Defined in src/pools/thread/fixed.ts:49
  • +
  • Defined in src/pools/thread/fixed.ts:70
  • Returns void

    +
  • Defined in src/pools/abstract-pool.ts:478
  • +
  • Defined in src/pools/thread/fixed.ts:62
    • - +
    • Inherit Doc

      @@ -542,11 +490,11 @@

      Parameters

      • -
        workerChoiceStrategy: "ROUND_ROBIN" | "LESS_RECENTLY_USED"
    +
    workerChoiceStrategy: "ROUND_ROBIN" | "LESS_USED" | "LESS_BUSY" | "FAIR_SHARE" | "WEIGHTED_ROUND_ROBIN"

    Returns void

    +
  • Defined in src/pools/abstract-pool.ts:178
  • +
  • Defined in src/pools/abstract-pool.ts:254
  • +
  • Defined in src/pools/abstract-pool.ts:384