Interface IStreamThrottler
-
- All Known Implementing Classes:
Throttler.StreamThrottler
public interface IStreamThrottlerAn IConnectionThrottler object is meant to be embedded in an InputStream. It is not thread-local, and does not require access to a thread context. It thus also does not throw ManifoldCFExceptions. It is thus suitable for use in background threads, etc. These objects are typically created by IFetchThrottler objects - they are not meant to be created directly.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String_rcsid
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidcloseStream()Note the stream being closed.booleanobtainReadPermission(int byteCount)Obtain permission to read a block of bytes.booleanobtainReadPermission(int byteCount, IBreakCheck breakCheck)Obtain permission to read a block of bytes.voidreleaseReadPermission(int origByteCount, int actualByteCount)Note the completion of the read of a block of bytes.
-
-
-
Field Detail
-
_rcsid
static final java.lang.String _rcsid
- See Also:
- Constant Field Values
-
-
Method Detail
-
obtainReadPermission
boolean obtainReadPermission(int byteCount) throws java.lang.InterruptedExceptionObtain permission to read a block of bytes. This method may wait until it is OK to proceed. The throttle group, bin names, etc are already known to this specific interface object, so it is unnecessary to include them here.- Parameters:
byteCount- is the number of bytes to get permissions to read.- Returns:
- true if the wait took place as planned, or false if the system is being shut down.
- Throws:
java.lang.InterruptedException
-
obtainReadPermission
boolean obtainReadPermission(int byteCount, IBreakCheck breakCheck) throws java.lang.InterruptedException, BreakExceptionObtain permission to read a block of bytes. This method may wait until it is OK to proceed. The throttle group, bin names, etc are already known to this specific interface object, so it is unnecessary to include them here.- Parameters:
byteCount- is the number of bytes to get permissions to read.- Returns:
- true if the wait took place as planned, or false if the system is being shut down.
- Throws:
java.lang.InterruptedExceptionBreakException
-
releaseReadPermission
void releaseReadPermission(int origByteCount, int actualByteCount)Note the completion of the read of a block of bytes. Call this after obtainReadPermission() was successfully called, and bytes were successfully read.- Parameters:
origByteCount- is the originally requested number of bytes to get permissions to read.actualByteCount- is the number of bytes actually read.
-
closeStream
void closeStream()
Note the stream being closed.
-
-