Class TimedBuffer

  • All Implemented Interfaces:
    org.apache.activemq.artemis.utils.critical.CriticalComponent

    public final class TimedBuffer
    extends org.apache.activemq.artemis.utils.critical.CriticalComponentImpl
    • Constructor Summary

      Constructors 
      Constructor Description
      TimedBuffer​(org.apache.activemq.artemis.utils.critical.CriticalAnalyzer analyzer, int size, int timeout, boolean logRates)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addBytes​(org.apache.activemq.artemis.api.core.ActiveMQBuffer bytes, boolean sync, IOCallback callback)  
      void addBytes​(EncodingSupport bytes, boolean sync, IOCallback callback)  
      boolean checkSize​(int sizeChecked)
      Verify if the size fits the buffer
      void flush()  
      boolean flushBatch()
      Attempts to flush if !delayFlush and buffer is filled by any data.
      void setObserver​(TimedBufferObserver observer)  
      protected void sleep​(long sleepNanos)
      Sub classes (tests basically) can use this to override how the sleep is being done
      void start()  
      protected void startSpin()
      Sub classes (tests basically) can use this to override disabling spinning
      void stop()  
      protected void stopSpin()
      Sub classes (tests basically) can use this to override disabling spinning
      • Methods inherited from class org.apache.activemq.artemis.utils.critical.CriticalComponentImpl

        checkExpiration, getCriticalAnalyzer, measureCritical
      • Methods inherited from class java.lang.Object

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

      • TimedBuffer

        public TimedBuffer​(org.apache.activemq.artemis.utils.critical.CriticalAnalyzer analyzer,
                           int size,
                           int timeout,
                           boolean logRates)
    • Method Detail

      • start

        public void start()
      • stop

        public void stop()
      • checkSize

        public boolean checkSize​(int sizeChecked)
        Verify if the size fits the buffer
        Parameters:
        sizeChecked -
      • addBytes

        public void addBytes​(org.apache.activemq.artemis.api.core.ActiveMQBuffer bytes,
                             boolean sync,
                             IOCallback callback)
      • flush

        public void flush()
      • flushBatch

        public boolean flushBatch()
        Attempts to flush if !delayFlush and buffer is filled by any data.
        Returns:
        true when are flushed any bytes, false otherwise
      • sleep

        protected void sleep​(long sleepNanos)
        Sub classes (tests basically) can use this to override how the sleep is being done
        Parameters:
        sleepNanos -
      • stopSpin

        protected void stopSpin()
        Sub classes (tests basically) can use this to override disabling spinning
      • startSpin

        protected void startSpin()
        Sub classes (tests basically) can use this to override disabling spinning