|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.tentackle.db.ModificationCounter
public class ModificationCounter
Counter to track modifications for a class/table.
There is one ModificationCounter-object per DbObject-class *AND* Db-connection.
The Db maintains a list of ModificationCounter-objects, one for each table.
The physical count for UPDATE and INSERT (i.e. update to the database) is minimized
within transactions. If there are only updates and inserts the counter
(i.e. the tableSerial) increments by 1.
However, each DELETE gets its own tableSerial which will allow other JVMs to detect
that "some objects have been deleted" by gaps in the sequence of tableSerials.
AppDbObjectCache and DbPreferences make use of that trick.
| Field Summary | |
|---|---|
static String |
FIELD_TABLENAME
column name for the tablename |
static String |
TABLENAME
the modification-table's name |
| Constructor Summary | |
|---|---|
ModificationCounter(Db db,
String tableName)
Creates a modification counter for a given tablename. |
|
| Method Summary | |
|---|---|
void |
addModificationTable()
Adds an entry for this counter (== database object class) to the modification table. |
long |
countModification(boolean checkModificationSerial,
boolean optimize)
Counts the modification for the table this counter belongs to. If the counter does not exist in the modification table, an appropriate entry will be created. |
long |
selectModification()
Get the current modification count by tablename. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String TABLENAME
public static final String FIELD_TABLENAME
| Constructor Detail |
|---|
public ModificationCounter(Db db,
String tableName)
db - the db connectiontableName - the tablename| Method Detail |
|---|
public long countModification(boolean checkModificationSerial,
boolean optimize)
checkModificationSerial - is true if the new tableSerial should be returnedoptimize - is true if counting should be optimized within transactions. Otherwise
this and the succeeding invocation performs a physical count.
public void addModificationTable()
public long selectModification()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||