Class VersionedWrapper<V>

java.lang.Object
org.mockserver.state.infinispan.VersionedWrapper<V>
Type Parameters:
V - the value type (must be serializable for Infinispan storage)
All Implemented Interfaces:
Serializable

public final class VersionedWrapper<V> extends Object implements Serializable
Wrapper that pairs a value with an explicit version number for storage in an Infinispan cache. This enables optimistic-concurrency CAS via cache.replace(key, oldWrapper, newWrapper) — Infinispan compares the old value using equals(Object), which checks both the value's identity AND the version, so a stale-version replace fails atomically.

Implements Serializable so it works with Infinispan's default Java serialization marshaller. For phase 2c (clustering with ProtoStream), a dedicated marshaller adapter can be added without changing this class.

See Also:
  • Constructor Details

    • VersionedWrapper

      public VersionedWrapper(V value, long version)
  • Method Details

    • getValue

      public V getValue()
    • getVersion

      public long getVersion()
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object