Apologies for the code being hard to follow. :-) Optimistic locking is a pretty heavily patched and "organically grown" feature. In 2.0.0 this has been sufficiently cleaned up (JBCACHE-942)
Regarding overriding the data version type, this feature is for very specific use cases and should only be used if you really know what you are doing with the versioning. For example, one good use case is where an external entity maintains versioning info (such as a database). Using timestamps on a file system is valid provided:
1) Your unit of measurement is sufficiently fine-grained that you won't have colliding version numbers
2) If this is replicated, your cluster nodes have reliable enough a clock synchronisation mechanism.
Do actually use your own data version, use the Option API to set a data version for each call (e.g., using overloaded methods on TreeCache that take in an Option object).
Note that the mechanism for doing this in 2.0.0 is different - see the 2.0.0 user guide for details on doing this in 2.0.0.