| Implementations of this class represent a transactional object: something you can write and read transactionally. If
you:
- Call
startWrite(Object) just before you begin a transaction that writes to the object (or do the write,
if transactions are automatic);
- Call
endWrite(Context) just after you commit the transaction containing the write (or the write itself,
if transactions are automatic), and pass in the
Context that
startWrite(Object) gave you;
- Call
startRead() just before you begin a transaction that reads from the object (or do the read, if
transactions are automatic); and
- Call
endRead(Context, Object) just after you complete the transaction containing the read (or the read
itself, if transactions are automatic), and pass in the
Context that
startRead() gave you;
then, automatically, this class will check the consistency of your application. In other words, it will tell you if
the value you read is something that couldn't possibly have been there, were the underlying store behaving
truly transactionally.
Implementations fail by throwing a
TCAssertionError ; that should be sufficient for its current uses in
tests. If you need to improve it, by all means, go right ahead — but be careful, because the logic in the
standard implementation is really quite tricky.
|