public abstract class PersistenceBackend extends Object
| Modifier and Type | Field and Description |
|---|---|
protected AggregationScheduler |
aggregationScheduler |
protected boolean |
closed |
protected static Integer |
countFallback |
protected FallbackPersistenceBackend |
fallbackPersistence |
static Integer |
MAX_FALLBACK |
protected PersistenceBackendMonitor |
persistenceBackendMonitor |
| Modifier | Constructor and Description |
|---|---|
protected |
PersistenceBackend() |
protected |
PersistenceBackend(FallbackPersistenceBackend fallback) |
| Modifier and Type | Method and Description |
|---|---|
void |
account(Record record)
Persist the
#UsageRecord. |
protected void |
accountValidateAggregate(Record record,
boolean validate,
boolean aggregate) |
protected void |
accountWithFallback(Record... records) |
abstract void |
close() |
void |
flush(long timeout,
TimeUnit timeUnit) |
AggregationScheduler |
getAggregationScheduler() |
FallbackPersistenceBackend |
getFallbackPersistence() |
boolean |
isOpen() |
protected abstract void |
prepareConnection(PersistenceBackendConfiguration configuration)
Prepare the connection to persistence.
|
protected abstract void |
reallyAccount(Record record)
This method contains the code to save the
Record |
protected void |
setAggregationScheduler(AggregationScheduler aggregationScheduler) |
protected void |
setFallback(FallbackPersistenceBackend fallback) |
protected void |
setOpen() |
protected FallbackPersistenceBackend fallbackPersistence
protected AggregationScheduler aggregationScheduler
protected PersistenceBackendMonitor persistenceBackendMonitor
public static final Integer MAX_FALLBACK
protected static Integer countFallback
protected boolean closed
protected PersistenceBackend()
protected PersistenceBackend(FallbackPersistenceBackend fallback)
public FallbackPersistenceBackend getFallbackPersistence()
protected void setFallback(FallbackPersistenceBackend fallback)
fallback - the fallback to setpublic AggregationScheduler getAggregationScheduler()
protected void setAggregationScheduler(AggregationScheduler aggregationScheduler)
aggregationScheduler - the aggregationScheduler to setprotected abstract void prepareConnection(PersistenceBackendConfiguration configuration) throws Exception
configuration - The configuration to create the connectionException - if failsprotected abstract void reallyAccount(Record record) throws Exception
RecordExceptionprotected void accountWithFallback(Record... records)
records - protected void accountValidateAggregate(Record record, boolean validate, boolean aggregate)
record - validate - aggregate - public void account(Record record) throws InvalidValueException
#UsageRecord.
The Record is validated first, then accounted, in a separated thread.
So that the program can continue the execution.
If the persistence fails the class write that the record in a local file
so that the #UsageRecord can be recorder later.usageRecord - the #UsageRecord to persistInvalidValueException - if the Record Validation Failspublic boolean isOpen()
protected void setOpen()
Copyright © 2016. All Rights Reserved.