Class CorrelationIdAllocator

java.lang.Object
io.kroxylicious.proxy.internal.CorrelationIdAllocator

@ThreadSafe public class CorrelationIdAllocator extends Object
Allocates integer correlation IDs from a bounded circular range [minInc, maxExc).

Each call to allocateId() returns the next available ID. When the allocated value reaches maxExc - 1, subsequent allocations wrap back to minInc.

  • Method Details

    • allocateId

      public int allocateId()
      Returns the next correlation ID in the range, wrapping to minInc after maxExc - 1.
      Returns:
      the allocated correlation ID
    • inRange

      public boolean inRange(int id)
      Parameters:
      id - id
      Returns:
      true if this id is part of the range this allocator will allocate from