Interface IStreamThrottler
-
- All Known Implementing Classes:
Throttler.StreamThrottler
public interface IStreamThrottler
An 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 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.
-
-
-
Field Detail
-
_rcsid
static final java.lang.String _rcsid
- See Also:
- Constant Field Values
-
-
Method Detail
-
obtainReadPermission
boolean obtainReadPermission(int byteCount) throws java.lang.InterruptedException
Obtain 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, BreakException
Obtain 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
BreakException
-
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.
-
-