X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=docs%2Fclasses%2FFixedThreadPool.html;h=5dff496fcdbe079d7bc3f674f45786369c13b47a;hb=6c525543a7ed67a926b7c1f4bf98985aaad1f088;hp=a6c4fffb39d155a9b7ac3334baa356f031036e1a;hpb=8bd0b5363ad2defbce7c1cc49e616c24ad135dde;p=poolifier.git diff --git a/docs/classes/FixedThreadPool.html b/docs/classes/FixedThreadPool.html index a6c4fffb..5dff496f 100644 --- a/docs/classes/FixedThreadPool.html +++ b/docs/classes/FixedThreadPool.html @@ -1,4 +1,4 @@ -FixedThreadPool | poolifier
+FixedThreadPool | poolifier
-
+
@@ -58,39 +58,35 @@

Properties

Accessors

Methods

-
afterPromiseWorkerResponseHook +
afterTaskExecutionHook afterWorkerSetup -beforePromiseWorkerResponseHook -chooseWorker +beforeTaskExecutionHook +chooseWorkerNode createAndSetupWorker createWorker destroy destroyWorker execute -findFreeWorker -getWorkerAverageTasksRunTime -getWorkerIndex -getWorkerRunningTasks -internalGetBusyStatus +findFreeWorkerNodeKey +internalBusy isMain registerWorkerMessageListener -removeWorker sendToWorker setWorkerChoiceStrategy setupHook @@ -101,7 +97,7 @@
-

Returns FixedThreadPool<Data, Response>

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

    emitter?: PoolEmitter
    -

    {@inheritDoc}

    +

    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.
    • +
    +
  • Defined in src/pools/abstract-pool.ts:41
  • filePath: string

    Path to the worker-file.

    -
    - -
    nextMessageId: number = 0
    -

    Id of the next message.

    -
    +
  • Defined in src/pools/abstract-pool.ts:76
  • numberOfWorkers: number

    Number of workers that this pool should manage.

    +
  • Defined in src/pools/abstract-pool.ts:75
  • Options for the pool.

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

    The promise map.

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

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

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

    Worker choice strategy instance implementing the worker choice algorithm.

    -

    Default to a strategy implementing a round robin algorithm.

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

    Worker choice strategy context referencing a worker choice algorithm implementation.

    +

    Default to a round robin algorithm.

    -
    - - -

    {@inheritDoc}

    +
  • Defined in src/pools/abstract-pool.ts:61
  • +
    + +
    workerNodes: WorkerNode<ThreadWorkerWithMessageChannel, Data>[] = []
    +

    Pool worker nodes.

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

    {@inheritDoc}

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

    @@ -218,260 +203,250 @@
    • get busy(): boolean
    • -

      {@inheritDoc}

      +

      Whether the pool is busy or not.

      +

      The pool busyness boolean status.

      Returns boolean

    -
    - -
    +
    + +
      +
    • get full(): boolean
    • +
    • +

      Whether the pool is full or not.

      +

      The pool filling boolean status.

      +
      +

      Returns boolean

    +
    + +
      +
    • get numberOfQueuedTasks(): number
    • +
    • +

      Number of tasks queued in the pool.

      +
      +

      Returns number

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

      {@inheritDoc}

      +

      Number of tasks running in the pool.

      Returns number

    +
  • Defined in src/pools/abstract-pool.ts:176
    • get type(): PoolType
    • -

      {@inheritDoc}

      +

      Pool type.

      +

      If it is 'dynamic', it provides the max property.

      Returns PoolType

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

    -
    - +
    +
    +
  • Defined in src/pools/abstract-pool.ts:327
  • Returns void

    -
    - +
  • Defined in src/pools/thread/fixed.ts:85
  • +
    +
    -
    - +
  • Defined in src/pools/abstract-pool.ts:316
  • +
    +
    +
  • Defined in src/pools/abstract-pool.ts:360
  • +
  • Defined in src/pools/abstract-pool.ts:422
  • +
  • Defined in src/pools/thread/fixed.ts:78
  • +
  • Defined in src/pools/abstract-pool.ts:279
  • Returns Promise<void>

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

      {@inheritDoc}

      -
      -
      -

      Parameters

      -
        -
      • -
        data: Data
      -

      Returns Promise<Response>

    -
    - -
    -
    - -
      - +
    • -

      {@inheritDoc}

      +

      Performs the task specified in the constructor with the data parameter.

      + +

      Returns

      Promise that will be resolved when the task is successfully completed.

      Parameters

      -

      Returns undefined | number

    +

    Returns Promise<Response>

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

      {@inheritDoc}

      +

      Finds a free worker node key based on the number of tasks the worker has applied.

      +

      If a worker is found with 0 running tasks, it is detected as free and its worker node key is returned.

      +

      If no free worker is found, -1 is returned.

      + +

      Returns

      A worker node key if there is one, -1 otherwise.

      -
      -

      Parameters

      -

      Returns number

    -
    - -
    -
    - +
  • Defined in src/pools/abstract-pool.ts:241
  • +
    +
    +
  • Defined in src/pools/abstract-pool.ts:236
  • +
  • Defined in src/pools/thread/fixed.ts:49
    • - +
    • -

      {@inheritDoc}

      +

      Registers a listener callback on the given worker.

      Type Parameters

      @@ -482,104 +457,96 @@ Can be overridden.

      Parameters

      • -
        messageChannel: ThreadWorkerWithMessageChannel
      • +
        messageChannel: ThreadWorkerWithMessageChannel
        +

        The worker which should register a listener.

        +
      • -
        listener: ((message: MessageValue<Message, unknown>) => void)
        +
        listener: ((message: MessageValue<Message, unknown>) => void)
        +

        The message listener callback.

        +
          • -
          • (message: MessageValue<Message, unknown>): void
          • +
          • (message: MessageValue<Message, unknown>): void
          • Parameters

            • -
              message: MessageValue<Message, unknown>
            +
            message: MessageValue<Message, unknown>

      Returns void

    Returns void

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

    +
  • Defined in src/pools/thread/fixed.ts:62
  • Returns void

    +
  • Defined in src/pools/abstract-pool.ts:209
  • +
  • Defined in src/pools/abstract-pool.ts:301
  • - +
    +
    -
    +
  • constructor
  • +
  • emitter
  • +
  • filePath
  • +
  • numberOfWorkers
  • +
  • opts
  • +
  • promiseResponseMap
  • +
  • workerChoiceStrategyContext
  • +
  • workerNodes
  • +
  • busy
  • +
  • full
  • +
  • numberOfQueuedTasks
  • +
  • numberOfRunningTasks
  • +
  • type
  • +
  • afterTaskExecutionHook
  • +
  • afterWorkerSetup
  • +
  • beforeTaskExecutionHook
  • +
  • chooseWorkerNode
  • +
  • createAndSetupWorker
  • +
  • createWorker
  • +
  • destroy
  • +
  • destroyWorker
  • +
  • execute
  • +
  • findFreeWorkerNodeKey
  • +
  • internalBusy
  • +
  • isMain
  • +
  • registerWorkerMessageListener
  • +
  • sendToWorker
  • +
  • setWorkerChoiceStrategy
  • +
  • setupHook
  • +
  • workerListener
  • + +

    Generated using TypeDoc

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