Class 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.
    • 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 interface IStreamThrottler
        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 interface IStreamThrottler
        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 interface IStreamThrottler
        Parameters:
        origByteCount - is the originally requested number of bytes to get permissions to read.
        actualByteCount - is the number of bytes actually read.