Class PendingCallPool

java.lang.Object
ru.pathcreator.pyc.rpc.core.internal.PendingCallPool

public final class PendingCallPool extends Object
Пул переиспользуемых PendingCall объектов.

Пул построен на lock-free очереди Agrona. В нормальном режиме слот берется из пула и после завершения вызова возвращается обратно. Если пул временно пуст во время прогрева или всплеска нагрузки, создается новый слот.

Pool of reusable PendingCall objects backed by an Agrona lock-free queue. Under normal load a slot is borrowed and returned. If the pool is temporarily empty during warmup or a burst, a new slot is created.

  • Constructor Summary

    Constructors
    Constructor
    Description
    PendingCallPool(int capacity)
    Создает пул с заранее выделенными слотами.
  • Method Summary

    Modifier and Type
    Method
    Description
    Берет слот из пула или создает новый при временном переполнении.
    void
    Сбрасывает слот и возвращает его в пул.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • PendingCallPool

      public PendingCallPool(int capacity)
      Создает пул с заранее выделенными слотами.

      Creates a pool with preallocated slots.

      Parameters:
      capacity - количество заранее созданных слотов / number of preallocated slots
  • Method Details

    • acquire

      public PendingCall acquire()
      Берет слот из пула или создает новый при временном переполнении.

      Acquires a slot from the pool or creates a new one on temporary overflow.

      Returns:
      слот ожидающего RPC-вызова / pending RPC call slot
    • release

      public void release(PendingCall call)
      Сбрасывает слот и возвращает его в пул.

      Resets a slot and returns it to the pool.

      Parameters:
      call - слот для возврата / slot to return