public abstract class Persistence extends Object
| Modifier and Type | Field and Description |
|---|---|
protected static FallbackPersistence |
fallback |
protected static Persistence |
persistence
The singleton instance of persistence
|
| Modifier | Constructor and Description |
|---|---|
protected |
Persistence() |
| Modifier and Type | Method and Description |
|---|---|
void |
account(UsageRecord usageRecord)
Persist the
#UsageRecord. |
abstract void |
close() |
static UsageRecord |
createTestUsageRecord() |
static Persistence |
getInstance() |
protected static void |
init() |
protected abstract void |
prepareConnection()
Prepare the connection to persistence.
|
protected abstract void |
reallyAccount(UsageRecord usageRecord)
This method contains the code to save the
#UsageRecord |
static void |
setFallbackLocation(String path) |
protected static Persistence persistence
protected static FallbackPersistence fallback
public static void setFallbackLocation(String path)
protected static void init()
public static UsageRecord createTestUsageRecord()
public static Persistence getInstance()
Exception - if failsprotected abstract void prepareConnection()
throws Exception
Exception - if failsprotected abstract void reallyAccount(UsageRecord usageRecord) throws Exception
#UsageRecordExceptionpublic void account(UsageRecord usageRecord)
#UsageRecord.
This method account the record 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 persistCopyright © 2015. All Rights Reserved.