public abstract class AggregationScheduler extends Object implements Runnable
| Modifier and Type | Field and Description |
|---|---|
static String |
AGGREGATION_SCHEDULER_TIME |
static String |
BUFFER_RECORD_NUMBER |
static String |
BUFFER_RECORD_TIME |
protected Map<String,List<Record>> |
bufferedRecords |
static int |
DELAY |
static Integer |
delaySet |
protected ScheduledFuture<?> |
future |
static int |
INITIAL_DELAY |
static Integer |
initialDelaySet |
static org.slf4j.Logger |
logger |
protected static int |
MAX_RECORDS_NUMBER
Define the MAX number of Record to buffer.
|
protected static int |
maxRecordsNumberSet |
protected static long |
OLD_RECORD_MAX_TIME_ELAPSED
The Max amount of time elapsed form last record before after that the
buffered record are persisted even if TODO Get from configuration
|
protected static long |
OldRecordMaxTimeElapsedSet |
protected PersistenceExecutor |
persistenceExecutor |
static long |
TIME_LOAD_CONFIGURATION
The time for first
|
static long |
TIME_RELOAD_CONFIGURATION
The Max amount of time for reload a configuration TODO Get from
configuration
|
static TimeUnit |
TIME_UNIT |
protected int |
totalBufferedRecords |
| Modifier | Constructor and Description |
|---|---|
protected |
AggregationScheduler(PersistenceExecutor persistenceExecutor) |
| Modifier and Type | Method and Description |
|---|---|
void |
aggregate(Record record,
PersistenceExecutor persistenceExecutor)
Get an usage records and try to aggregate with other buffered Usage
Record.
|
protected void |
aggregate(Record record,
PersistenceExecutor persistenceExecutor,
boolean forceFlush) |
protected void |
clear() |
void |
flush(PersistenceExecutor persistenceExecutor) |
static AggregatedRecord |
getAggregatedRecord(Record record) |
protected static AggregatedRecord |
instantiateAggregatedRecord(Record record) |
protected abstract boolean |
isTimeToPersist(int maxRecordNumber,
long oldRecordMaxTime) |
protected void |
madeAggregation(Record record) |
static AggregationScheduler |
newInstance(PersistenceExecutor persistenceExecutor) |
static AggregationScheduler |
newInstance(PersistenceExecutor persistenceExecutor,
PersistenceBackendConfiguration configuration) |
protected void |
reallyFlush(PersistenceExecutor persistenceExecutor) |
protected void |
reloadConfiguration() |
void |
run() |
protected abstract void |
schedulerSpecificClear() |
public static org.slf4j.Logger logger
protected int totalBufferedRecords
protected final PersistenceExecutor persistenceExecutor
public static final int INITIAL_DELAY
public static Integer initialDelaySet
public static final int DELAY
public static Integer delaySet
public static final TimeUnit TIME_UNIT
public static final String AGGREGATION_SCHEDULER_TIME
public static final String BUFFER_RECORD_TIME
public static final String BUFFER_RECORD_NUMBER
public static long TIME_RELOAD_CONFIGURATION
public static long TIME_LOAD_CONFIGURATION
protected static final int MAX_RECORDS_NUMBER
protected static int maxRecordsNumberSet
protected static final long OLD_RECORD_MAX_TIME_ELAPSED
protected static long OldRecordMaxTimeElapsedSet
protected ScheduledFuture<?> future
protected AggregationScheduler(PersistenceExecutor persistenceExecutor)
public static AggregationScheduler newInstance(PersistenceExecutor persistenceExecutor)
public static AggregationScheduler newInstance(PersistenceExecutor persistenceExecutor, PersistenceBackendConfiguration configuration) throws NumberFormatException, Exception
NumberFormatExceptionExceptionprotected static AggregatedRecord instantiateAggregatedRecord(Record record) throws Exception
Exceptionpublic static AggregatedRecord getAggregatedRecord(Record record) throws Exception
Exceptionprotected void madeAggregation(Record record)
public void flush(PersistenceExecutor persistenceExecutor) throws Exception
Exceptionprotected abstract void schedulerSpecificClear()
protected void clear()
protected void aggregate(Record record, PersistenceExecutor persistenceExecutor, boolean forceFlush) throws Exception
Exceptionprotected void reallyFlush(PersistenceExecutor persistenceExecutor) throws Exception
Exceptionpublic void aggregate(Record record, PersistenceExecutor persistenceExecutor) throws Exception
singleRecord - the Usage Record To BufferException - if failsprotected abstract boolean isTimeToPersist(int maxRecordNumber,
long oldRecordMaxTime)
Copyright © 2016. All Rights Reserved.