public abstract class AccountingPersistence extends Object
| Modifier and Type | Field and Description |
|---|---|
protected AggregationScheduler |
aggregationScheduler |
protected FallbackPersistence |
fallback |
| Modifier | Constructor and Description |
|---|---|
protected |
AccountingPersistence() |
protected |
AccountingPersistence(FallbackPersistence fallback,
AggregationScheduler aggregationScheduler) |
| Modifier and Type | Method and Description |
|---|---|
void |
account(SingleUsageRecord usageRecord)
Persist the
#UsageRecord. |
abstract void |
close() |
void |
flush() |
protected abstract void |
prepareConnection(AccountingPersistenceConfiguration configuration)
Prepare the connection to persistence.
|
protected abstract void |
reallyAccount(UsageRecord usageRecords)
This method contains the code to save the
#UsageRecord |
protected void |
setAggregationScheduler(AggregationScheduler aggregationScheduler) |
protected void |
setFallback(FallbackPersistence fallback) |
protected void |
validateAccountAggregate(SingleUsageRecord usageRecord,
boolean validate,
boolean aggregate) |
protected FallbackPersistence fallback
protected AggregationScheduler aggregationScheduler
protected AccountingPersistence()
protected AccountingPersistence(FallbackPersistence fallback, AggregationScheduler aggregationScheduler)
protected void setFallback(FallbackPersistence fallback)
fallback - the fallback to setprotected void setAggregationScheduler(AggregationScheduler aggregationScheduler)
aggregationScheduler - the aggregationScheduler to setprotected abstract void prepareConnection(AccountingPersistenceConfiguration configuration) throws Exception
configuration - The configuration to create the connectionException - if failsprotected abstract void reallyAccount(UsageRecord usageRecords) throws Exception
#UsageRecordExceptionprotected void validateAccountAggregate(SingleUsageRecord usageRecord, boolean validate, boolean aggregate)
public void account(SingleUsageRecord usageRecord) 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 FailsCopyright © 2015. All Rights Reserved.