- All Superinterfaces:
PQEntry
- All Known Implementing Classes:
FIFOBandwidthLimiter.NoopRequest, FIFOBandwidthLimiter.SimpleRequest
- Enclosing class:
FIFOBandwidthLimiter
A bandwidth request, either inbound or outbound.
Method Summary
All MethodsModifier and TypeMethodDescriptionvoidabort()We no longer want the data requested (the connection closed).voidOnly supported if the request is not satisfied.The attached object, or null.booleanWhether this request was aborted.The listener notified when the request completes.intHow many bytes were requested and haven't yet been allocated.longWhen the request was made.intHow many bytes were requested.voidThe listener notified when the request is complete.voidBlock until we are allocated some more bytes.Methods inherited from interface PQEntry
getPriority, getSeqNum, setSeqNumModifier and TypeMethodDescriptionintHigher is higher priority.longNeeded to ensure FIFO ordering within a single priority.voidsetSeqNum(long num) Set the sequence number for FIFO ordering.
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
The listener notified when the request is complete.- Parameters:
lsnr- notified once fully allocated; null clears any previously set listener
attach
Only supported if the request is not satisfied.- Parameters:
obj- the caller's own state, returned byattachment()
attachment
Object attachment()The attached object, or null.- Returns:
- the object passed to
attach(Object), or null if none was attached
getCompleteListener
FIFOBandwidthLimiter.CompleteListener getCompleteListener()The listener notified when the request completes.- Returns:
- the complete listener