All Superinterfaces:
PQEntry
All Known Implementing Classes:
FIFOBandwidthLimiter.NoopRequest, FIFOBandwidthLimiter.SimpleRequest
Enclosing class:
FIFOBandwidthLimiter

public static interface FIFOBandwidthLimiter.Request extends PQEntry
A bandwidth request, either inbound or outbound.
  • Method Details

    • getRequestTime

      long getRequestTime()
      When the request was made.
      Returns:
      the creation time in milliseconds from the System clock
    • getTotalRequested

      int getTotalRequested()
      How many bytes were requested.
      Returns:
      the size of the request in bytes
    • getPendingRequested

      int getPendingRequested()
      How many bytes were requested and haven't yet been allocated.
      Returns:
      the outstanding allocation in bytes, 0 when fully allocated
    • waitForNextAllocation

      void waitForNextAllocation()
      Block until we are allocated some more bytes. May return without allocating. Check getPendingRequested() > 0 in a loop.
    • abort

      void abort()
      We no longer want the data requested (the connection closed).
    • getAborted

      boolean getAborted()
      Whether this request was aborted.
      Returns:
      true if abort() has been called, so no more bytes will be allocated
    • setCompleteListener

      void setCompleteListener(FIFOBandwidthLimiter.CompleteListener lsnr)
      The listener notified when the request is complete.
      Parameters:
      lsnr - notified once fully allocated; null clears any previously set listener
    • attach

      void attach(Object obj)
      Only supported if the request is not satisfied.
      Parameters:
      obj - the caller's own state, returned by attachment()
    • attachment

      Object attachment()
      The attached object, or null.
      Returns:
      the object passed to attach(Object), or null if none was attached
    • getCompleteListener

      The listener notified when the request completes.
      Returns:
      the complete listener