Class TimingBufferSource
- java.lang.Object
-
- org.terracotta.offheapstore.buffersource.TimingBufferSource
-
- All Implemented Interfaces:
BufferSource
public class TimingBufferSource extends java.lang.Object implements BufferSource
-
-
Field Summary
Fields Modifier and Type Field Description private longcriticalNanosprivate BufferSourcedelegateprivate booleanhaltOnCriticalprivate static org.slf4j.LoggerLOGGERprivate longslowNanos
-
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.ByteBufferallocateBuffer(int size)Allocates a buffer of the given size.private static voidcommitSuicide(java.lang.String msg)Try to terminate the VM as soon as possible no matter the method and how abrupt it may be.
-
-
-
Field Detail
-
LOGGER
private static final org.slf4j.Logger LOGGER
-
delegate
private final BufferSource delegate
-
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:BufferSourceAllocates a buffer of the given size.If a suitable buffer cannot be allocated then
nullshould be returned. Implementations may place restrictions on the valid size value they will accept.- Specified by:
allocateBufferin interfaceBufferSource- 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.
-
-