Class SyncWaiter

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

public final class SyncWaiter extends Object
Ожидатель завершения PendingCall с таймаутом.

Класс реализует трехфазное ожидание: сначала короткий spin, затем yield, затем park. Это позволяет не платить полный park latency в типичном hot path локального RPC, но все же не крутиться бесконечно, если ответ действительно задерживается.

Waiter for PendingCall completion with a timeout. It uses a three-phase strategy: short spin, then yield, then park. This avoids paying full park latency in the common hot path while still backing off when a response is genuinely delayed.

  • Constructor Summary

    Constructors
    Constructor
    Description
    Профиль по умолчанию для hot RPC на localhost или low-latency LAN.
    SyncWaiter(int spinLimit, int yieldLimit, long coldParkNs)
    Создает ожидатель с явными лимитами spin/yield/park фаз.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    await(PendingCall call, long timeoutNs)
    Ожидает завершения вызова до истечения таймаута.

    Methods inherited from class Object

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

    • SyncWaiter

      public SyncWaiter()
      Профиль по умолчанию для hot RPC на localhost или low-latency LAN.

      Default profile for hot RPC on localhost or a low-latency LAN.

    • SyncWaiter

      public SyncWaiter(int spinLimit, int yieldLimit, long coldParkNs)
      Создает ожидатель с явными лимитами spin/yield/park фаз.

      Creates a waiter with explicit spin, yield, and park phase limits.

      Parameters:
      spinLimit - максимальное число spin-итераций / maximum number of spin iterations
      yieldLimit - максимальное число yield-итераций / maximum number of yield iterations
      coldParkNs - длительность cold-park ожидания в наносекундах / cold park duration in nanoseconds
  • Method Details

    • await

      public boolean await(PendingCall call, long timeoutNs)
      Ожидает завершения вызова до истечения таймаута.

      Waits for a call to complete before the timeout expires.

      Parameters:
      call - ожидающий RPC-вызов / pending RPC call
      timeoutNs - таймаут ожидания в наносекундах / timeout in nanoseconds
      Returns:
      true, если вызов завершился в срок; false, если истек таймаут / true if the call completed in time; false on timeout