Class TimingBufferSource

  • All Implemented Interfaces:
    BufferSource

    public class TimingBufferSource
    extends java.lang.Object
    implements BufferSource
    • Constructor Summary

      Constructors 
      Constructor Description
      TimingBufferSource​(BufferSource source, long slow, java.util.concurrent.TimeUnit slowUnit, long critical, java.util.concurrent.TimeUnit criticalUnit, boolean haltOnCritical)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.nio.ByteBuffer allocateBuffer​(int size)
      Allocates a buffer of the given size.
      private static void commitSuicide​(java.lang.String msg)
      Try to terminate the VM as soon as possible no matter the method and how abrupt it may be.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • LOGGER

        private static final org.slf4j.Logger LOGGER
      • slowNanos

        private final long slowNanos
      • criticalNanos

        private final long criticalNanos
      • haltOnCritical

        private final boolean haltOnCritical
    • Constructor Detail

      • TimingBufferSource

        public TimingBufferSource​(BufferSource source,
                                  long slow,
                                  java.util.concurrent.TimeUnit slowUnit,
                                  long critical,
                                  java.util.concurrent.TimeUnit criticalUnit,
                                  boolean haltOnCritical)
    • Method Detail

      • allocateBuffer

        public java.nio.ByteBuffer allocateBuffer​(int size)
        Description copied from interface: BufferSource
        Allocates a buffer of the given size.

        If a suitable buffer cannot be allocated then null should be returned. Implementations may place restrictions on the valid size value they will accept.

        Specified by:
        allocateBuffer in interface BufferSource
        Parameters:
        size - required buffer size
        Returns:
        a buffer of the required size
      • commitSuicide

        private static void commitSuicide​(java.lang.String msg)
        Try to terminate the VM as soon as possible no matter the method and how abrupt it may be.
        Parameters:
        msg - an error message which may end up being reported.