Interface FlushStrategy


  • public interface FlushStrategy
    Allows to configure a strategy for when flushes should be happening.
    • Method Detail

      • shouldFlushNow

        boolean shouldFlushNow​(int numPackets,
                               int numBytes)
        Returns true if a flush should happen now, false otherwise.
        Parameters:
        numPackets - the number of packets that were written since the last flush.
        numBytes - the number of bytes that were written since the last flush.
        Returns:
        true if a flush should be done now, false otherwise.
      • afterNumBytes

        static FlushStrategy afterNumBytes​(int bytes)
        Implementation that flushes after a number of bytes.
        Parameters:
        bytes - the number of bytes after which we should issue a flush.
        Returns:
        the FlushStrategy.
      • afterNumPackets

        static FlushStrategy afterNumPackets​(int packets)
        Implementation that flushes after a number of packets.
        Parameters:
        packets - the number of packets after which we should issue a flush.
        Returns:
        the FlushStrategy.