Package org.hibernate.cache.CacheConcurrencyStrategy

Examples of org.hibernate.cache.CacheConcurrencyStrategy.SoftLock


    assertTrue( !ccs.put("foo", "foo", before, null, null, false) );

    // update it:

    SoftLock lock = ccs.lock("foo", null);

    assertTrue( ccs.get("foo", after)==null );
    assertTrue( ccs.get("foo", longBefore)==null );

    assertTrue( !ccs.put("foo", "foo", before, null, null, false) );

    Thread.sleep(15);

    long whileLocked = cache.nextTimestamp();

    assertTrue( !ccs.put("foo", "foo", whileLocked, null, null, false) );

    Thread.sleep(15);

    ccs.release("foo", lock);

    assertTrue( ccs.get("foo", after)==null );
    assertTrue( ccs.get("foo", longBefore)==null );

    assertTrue( !ccs.put("foo", "bar", whileLocked, null, null, false) );
    assertTrue( !ccs.put("foo", "bar", after, null, null, false) );

    Thread.sleep(15);

    long longAfter = cache.nextTimestamp();

    assertTrue( ccs.put("foo", "baz", longAfter, null, null, false) );

    assertTrue( ccs.get("foo", after)==null );
    assertTrue( ccs.get("foo", whileLocked)==null );

    Thread.sleep(15);

    long longLongAfter = cache.nextTimestamp();

    assertTrue( ccs.get("foo", longLongAfter).equals("baz") );

    // update it again, with multiple locks:

    SoftLock lock1 = ccs.lock("foo", null);
    SoftLock lock2 = ccs.lock("foo", null);

    assertTrue( ccs.get("foo", longLongAfter)==null );

    Thread.sleep(15);
View Full Code Here

TOP

Related Classes of org.hibernate.cache.CacheConcurrencyStrategy.SoftLock

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.