Class SimpleWindow

  • All Implemented Interfaces:
    Window

    public class SimpleWindow
    extends Object
    implements Window
    • Constructor Detail

      • SimpleWindow

        public SimpleWindow​(int capacity)
        Creates a new simple window.
        Parameters:
        capacity - the window size/capacity
    • Method Detail

      • add

        public boolean add​(GoBackNArqData msg,
                           io.netty.channel.ChannelPromise promise)
        Description copied from interface: Window
        Adds the given msg to the window, if there is enough capacity.
        Specified by:
        add in interface Window
        Parameters:
        msg - the message to add
        promise - the write promise
        Returns:
        true, if the message could be added, false if the window has no capacity
      • remove

        public io.netty.channel.ChannelPromise remove()
        Description copied from interface: Window
        Removes the oldest message from the window.
        Specified by:
        remove in interface Window
        Returns:
        the write promise of the oldest message
      • size

        public int size()
        Specified by:
        size in interface Window
        Returns:
        the size of the window
      • getFreeSpace

        public int getFreeSpace()
        Specified by:
        getFreeSpace in interface Window
        Returns:
        the free space of the window
      • removeAndFailAll

        public void removeAndFailAll​(Throwable cause)
        Description copied from interface: Window
        Clears the window and let's fail all write promises.
        Specified by:
        removeAndFailAll in interface Window
        Parameters:
        cause - the cause of the failure