protected static class Throttler.StreamThrottler extends java.lang.Object implements IStreamThrottler
Modifier and Type | Field and Description |
---|---|
protected java.lang.String[] |
binNames |
protected Throttler.ThrottlingGroup |
parent |
_rcsid
Constructor and Description |
---|
StreamThrottler(Throttler.ThrottlingGroup parent,
java.lang.String[] binNames) |
Modifier and Type | Method and Description |
---|---|
void |
closeStream()
Note the stream being closed.
|
boolean |
obtainReadPermission(int byteCount)
Obtain permission to read a block of bytes.
|
boolean |
obtainReadPermission(int byteCount,
IBreakCheck breakCheck)
Obtain permission to read a block of bytes.
|
void |
releaseReadPermission(int origByteCount,
int actualByteCount)
Note the completion of the read of a block of bytes.
|
protected final Throttler.ThrottlingGroup parent
protected final java.lang.String[] binNames
public StreamThrottler(Throttler.ThrottlingGroup parent, java.lang.String[] binNames)
public boolean obtainReadPermission(int byteCount) throws java.lang.InterruptedException
obtainReadPermission
in interface IStreamThrottler
byteCount
- is the number of bytes to get permissions to read.java.lang.InterruptedException
public boolean obtainReadPermission(int byteCount, IBreakCheck breakCheck) throws java.lang.InterruptedException, BreakException
obtainReadPermission
in interface IStreamThrottler
byteCount
- is the number of bytes to get permissions to read.breakCheck
- is the break check object.java.lang.InterruptedException
BreakException
public void releaseReadPermission(int origByteCount, int actualByteCount)
releaseReadPermission
in interface IStreamThrottler
origByteCount
- is the originally requested number of bytes to get permissions to read.actualByteCount
- is the number of bytes actually read.public void closeStream()
closeStream
in interface IStreamThrottler