1 Reply Latest reply on Apr 3, 2007 8:13 AM by manik

    override DefaultDataVersion

    jivesociety

      Been following the optimistic locking interceptor code a bit but getting lost followng the flow. I was wondering if version 1.4.3 allowed an easy way to override the DataVersion implementation (DefaultDataVersion) for a user specific one. I'm thinking of using a different algorithm to do this. My use case has a fileCacheLoader and I would like to use a file timestamp of the file that corresponds to a FQN as a way to compare versions.

        • 1. Re: override DefaultDataVersion
          manik

          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.