Class Throttler.StreamThrottler
- java.lang.Object
-
- org.apache.manifoldcf.connectorcommon.throttler.Throttler.StreamThrottler
-
- All Implemented Interfaces:
IStreamThrottler
- Enclosing class:
- Throttler
protected static class Throttler.StreamThrottler extends java.lang.Object implements IStreamThrottler
Stream throttler implementation class. This basically stores some parameters and links back to ThrottlingGroup.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String[]
binNames
protected Throttler.ThrottlingGroup
parent
-
Fields inherited from interface org.apache.manifoldcf.connectorcommon.interfaces.IStreamThrottler
_rcsid
-
-
Constructor Summary
Constructors Constructor Description StreamThrottler(Throttler.ThrottlingGroup parent, java.lang.String[] binNames)
-
Method Summary
All Methods Instance Methods Concrete 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
-
parent
protected final Throttler.ThrottlingGroup parent
-
binNames
protected final java.lang.String[] binNames
-
-
Constructor Detail
-
StreamThrottler
public StreamThrottler(Throttler.ThrottlingGroup parent, java.lang.String[] binNames)
-
-
Method Detail
-
obtainReadPermission
public 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.- Specified by:
obtainReadPermission
in interfaceIStreamThrottler
- 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
public 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.- Specified by:
obtainReadPermission
in interfaceIStreamThrottler
- Parameters:
byteCount
- is the number of bytes to get permissions to read.breakCheck
- is the break check object.- Returns:
- true if the wait took place as planned, or false if the system is being shut down.
- Throws:
java.lang.InterruptedException
BreakException
-
releaseReadPermission
public 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.- Specified by:
releaseReadPermission
in interfaceIStreamThrottler
- Parameters:
origByteCount
- is the originally requested number of bytes to get permissions to read.actualByteCount
- is the number of bytes actually read.
-
closeStream
public void closeStream()
Note the stream being closed.- Specified by:
closeStream
in interfaceIStreamThrottler
-
-