Class TimedBuffer
- java.lang.Object
-
- org.apache.activemq.artemis.utils.critical.CriticalComponentImpl
-
- org.apache.activemq.artemis.core.io.buffer.TimedBuffer
-
- All Implemented Interfaces:
CriticalComponent
public final class TimedBuffer extends CriticalComponentImpl
-
-
Field Summary
Fields Modifier and Type Field Description protected static intCRITICAL_PATH_ADD_BYTESprotected static intCRITICAL_PATH_CHECK_SIZEprotected static intCRITICAL_PATH_FLUSHprotected static intCRITICAL_PATH_SET_OBSERVERprotected static intCRITICAL_PATH_STARTprotected static intCRITICAL_PATH_STOPprotected static intCRITICAL_PATHS
-
Constructor Summary
Constructors Constructor Description TimedBuffer(CriticalAnalyzer analyzer, int size, int timeout, boolean logRates)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddBytes(ActiveMQBuffer bytes, boolean sync, IOCallback callback)voidaddBytes(EncodingSupport bytes, boolean sync, IOCallback callback)booleancheckSize(int sizeChecked)Verify if the size fits the buffervoidflush()booleanflushBatch()Attempts to flush if!delayFlushandbufferis filled by any data.voidsetObserver(TimedBufferObserver observer)protected voidsleep(long sleepNanos)Sub classes (tests basically) can use this to override how the sleep is being donevoidstart()protected voidstartSpin()Sub classes (tests basically) can use this to override disabling spinningvoidstop()protected voidstopSpin()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
-
-
-
-
Field Detail
-
CRITICAL_PATHS
protected static final int CRITICAL_PATHS
- See Also:
- Constant Field Values
-
CRITICAL_PATH_FLUSH
protected static final int CRITICAL_PATH_FLUSH
- See Also:
- Constant Field Values
-
CRITICAL_PATH_STOP
protected static final int CRITICAL_PATH_STOP
- See Also:
- Constant Field Values
-
CRITICAL_PATH_START
protected static final int CRITICAL_PATH_START
- See Also:
- Constant Field Values
-
CRITICAL_PATH_CHECK_SIZE
protected static final int CRITICAL_PATH_CHECK_SIZE
- See Also:
- Constant Field Values
-
CRITICAL_PATH_ADD_BYTES
protected static final int CRITICAL_PATH_ADD_BYTES
- See Also:
- Constant Field Values
-
CRITICAL_PATH_SET_OBSERVER
protected static final int CRITICAL_PATH_SET_OBSERVER
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
TimedBuffer
public TimedBuffer(CriticalAnalyzer analyzer, int size, int timeout, boolean logRates)
-
-
Method Detail
-
start
public void start()
-
stop
public void stop()
-
setObserver
public void setObserver(TimedBufferObserver observer)
-
checkSize
public boolean checkSize(int sizeChecked)
Verify if the size fits the buffer- Parameters:
sizeChecked-
-
addBytes
public void addBytes(ActiveMQBuffer bytes, boolean sync, IOCallback callback)
-
addBytes
public void addBytes(EncodingSupport bytes, boolean sync, IOCallback callback)
-
flush
public void flush()
-
flushBatch
public boolean flushBatch()
Attempts to flush if!delayFlushandbufferis filled by any data.- Returns:
truewhen are flushed any bytes,falseotherwise
-
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
-
-