@InterfaceAudience.Private @InterfaceStability.Evolving public class SpillableMemoryChannel extends FileChannel
SpillableMemoryChannel will use main memory for buffering events until it has reached capacity. Thereafter file channel will be used as overflow.
Modifier and Type | Class and Description |
---|---|
static class |
SpillableMemoryChannel.DrainOrderQueue |
Modifier and Type | Field and Description |
---|---|
static String |
AVG_EVENT_SIZE
Estimated average size of events expected to be in the channel
|
static String |
BYTE_CAPACITY
max number of bytes used for all events in the queue.
|
static String |
BYTE_CAPACITY_BUFFER_PERCENTAGE
percent of buffer between byteCapacity and the estimated event size.
|
static String |
CAPACITY
file channel capacity overridden by Spillable Channel
|
protected ChannelCounter |
channelCounter |
static int |
defaultMemoryCapacity |
static int |
defaultOverflowCapacity |
static int |
defaultOverflowDeactivationThreshold |
static int |
defaultOverflowTimeout |
SpillableMemoryChannel.DrainOrderQueue |
drainOrder |
static String |
KEEP_ALIVE
file channel setting that is overriden by Spillable Channel
|
static String |
MEMORY_CAPACITY
Max number of events to be stored in memory
|
ArrayDeque<Event> |
memQueue |
static String |
OVERFLOW_CAPACITY
max number of events in overflow.
|
static String |
OVERFLOW_DEACTIVATION_THRESHOLD
Internal use only.
|
static String |
OVERFLOW_TIMEOUT
Seconds to wait before enabling disk overflow when memory fills up
|
transactionCapacity
Constructor and Description |
---|
SpillableMemoryChannel() |
Modifier and Type | Method and Description |
---|---|
void |
configure(Context context)
Read parameters from context
memoryCapacity = total number of events allowed at one time in the memory queue.
|
protected BasicTransactionSemantics |
createTransaction()
Called to create new
Transaction objects, which must
extend BasicTransactionSemantics . |
int |
getMaxMemQueueSize() |
int |
getMemoryCapacity() |
protected Integer |
getOverflowCapacity() |
int |
getOverflowTimeout() |
protected int |
getTotalStored() |
protected boolean |
isOverflowDisabled() |
int |
queueSize() |
void |
start()
Starts a service or component.
|
void |
stop()
Stops a service or component.
|
getDepth, getTransactionCapacity, isOpen, setName, toString
getTransaction, initialize, put, take
getLifecycleState, getName
public static final String MEMORY_CAPACITY
public static final String OVERFLOW_TIMEOUT
public static final String OVERFLOW_DEACTIVATION_THRESHOLD
public static final String BYTE_CAPACITY_BUFFER_PERCENTAGE
public static final String BYTE_CAPACITY
public static final String OVERFLOW_CAPACITY
public static final String KEEP_ALIVE
public static final String CAPACITY
public static final String AVG_EVENT_SIZE
public static final int defaultMemoryCapacity
public static final int defaultOverflowCapacity
public static final int defaultOverflowTimeout
public static final int defaultOverflowDeactivationThreshold
public ArrayDeque<Event> memQueue
protected ChannelCounter channelCounter
public final SpillableMemoryChannel.DrainOrderQueue drainOrder
protected int getTotalStored()
public int getMemoryCapacity()
public int getOverflowTimeout()
public int getMaxMemQueueSize()
protected Integer getOverflowCapacity()
protected boolean isOverflowDisabled()
public int queueSize()
public void configure(Context context)
configure
in interface Configurable
configure
in class FileChannel
public void start()
LifecycleAware
Starts a service or component.
Implementations should determine the result of any start logic and effect
the return value of LifecycleAware.getLifecycleState()
accordingly.
start
in interface LifecycleAware
start
in class FileChannel
public void stop()
LifecycleAware
Stops a service or component.
Implementations should determine the result of any stop logic and effect
the return value of LifecycleAware.getLifecycleState()
accordingly.
stop
in interface LifecycleAware
stop
in class FileChannel
protected BasicTransactionSemantics createTransaction()
BasicChannelSemantics
Called to create new Transaction
objects, which must
extend BasicTransactionSemantics
. Each object is used
for only one transaction, but is stored in a thread-local and
retrieved by getTransaction
for the duration of that
transaction.
createTransaction
in class FileChannel
Copyright © 2009–2019 Apache Software Foundation. All rights reserved.