T - public class BufferedActor<T extends BufferedActor.ReusableActionContainer> extends Object
Second intention is provide garbage-free style of metrics collection. If underling data-structure does not perform memory allocation on each update, then BufferedActor will help to organize message passing in the way that does not require node allocation when placing task to the buffer.
Implementation details:
maxBatchSize actions at once.
| Modifier and Type | Class and Description |
|---|---|
static class |
BufferedActor.ReusableActionContainer |
| Constructor and Description |
|---|
BufferedActor(Supplier<T> actionFactory,
int bufferSize,
int minBatchSize,
int maxBatchSize) |
| Modifier and Type | Method and Description |
|---|---|
void |
clear() |
void |
doExclusivelyOrSchedule(BufferedActor.ReusableActionContainer action) |
T |
getActionFromPool() |
long |
getOverflowedCount() |
void |
processAllScheduledActions() |
public BufferedActor(Supplier<T> actionFactory, int bufferSize, int minBatchSize, int maxBatchSize)
actionFactory - factory which used to populate action pool, pool is always populated to maximum during initializationbufferSize - the size of queue for incoming requestsminBatchSize - maxBatchSize - specifies how many actions one thread is allowed to perform in single batch,
intent of this parameter is to avoid live lock of exclusive lock ownerpublic final T getActionFromPool()
public void doExclusivelyOrSchedule(BufferedActor.ReusableActionContainer action)
public long getOverflowedCount()
public void processAllScheduledActions()
public void clear()
Copyright © 2020. All rights reserved.