| java.lang.Object com.tc.test.transactions.StandardTransactionalObject
StandardTransactionalObject | public class StandardTransactionalObject implements TransactionalObject(Code) | | The standard implementation of
TransactionalObject . See that class for details.
This implementation allows reads to also be checked with a slight relaxation of the rules, called slop:
if, when you read, you get a value that's invalid, but would have been valid were the read issued at any
point up to slop milliseconds ago, it's treated as valid. This is used for our tests that involve the
Terracotta database listener, as invalidations take a nonzero amount of time to travel.
Be warned: this class's implementation is quite tricky. Make changes with care, and re-run the test whenever you
change it.
(The set of all values you could possibly read includes all values the object has had from the current time less the
slop up to the start of the read, in addition to all values for which writes have at least been started (by calling
startWrite(Object) for them) before the moment you called
StandardTransactionalObject.endRead(Context,Object) .)
This class works in a bit of a funny way: if slop is exactly zero, we need to maintain order of method
calls — many method calls can happen without
System.currentTimeMillis changing at all. To do that, we
simply use a
Timing object, rather than a raw long , to store our times; there's one
implementation (which we use if slop is nonzero) that uses just the raw time from
System.currentTimeMillis , while there's another (which we use if slop is exactly zero) that
uses both the raw time and an internally-generated sequence number, to distinguish calls that happen at the same
'time' (according to
System.currentTimeMillis ).
|
Constructor Summary | |
public | StandardTransactionalObject(String name, long slop, long gcSlop, Object initialValue, long now) | public | StandardTransactionalObject(String name, long slop, Object initialValue, long now) | public | StandardTransactionalObject(String name, long slop, Object initialValue) | public | StandardTransactionalObject(String name, Object initialValue, long now) | public | StandardTransactionalObject(String name, Object initialValue) |
StandardTransactionalObject | public StandardTransactionalObject(String name, long slop, long gcSlop, Object initialValue, long now)(Code) | | |
StandardTransactionalObject | public StandardTransactionalObject(String name, long slop, Object initialValue, long now)(Code) | | |
StandardTransactionalObject | public StandardTransactionalObject(String name, long slop, Object initialValue)(Code) | | |
StandardTransactionalObject | public StandardTransactionalObject(String name, Object initialValue, long now)(Code) | | |
StandardTransactionalObject | public StandardTransactionalObject(String name, Object initialValue)(Code) | | |
endRead | public synchronized void endRead(Context rawRead, Object result)(Code) | | |
endRead | public synchronized void endRead(Context rawRead, Object result, long now)(Code) | | |
endWrite | public synchronized void endWrite(Context rawWrite)(Code) | | |
endWrite | public synchronized void endWrite(Context rawWrite, long now)(Code) | | |
startRead | public synchronized Context startRead()(Code) | | |
startRead | public synchronized Context startRead(long now)(Code) | | |
startWrite | public synchronized Context startWrite(Object value)(Code) | | |
startWrite | public synchronized Context startWrite(Object value, long now)(Code) | | |
|
|