Examples of PutFromLoadValidator


Examples of org.hibernate.cache.jbc.access.PutFromLoadValidator

  public void testInvalidateRegionBlocksForInProgressPut() throws Exception {
    invalidationBlocksForInProgressPutTest(false);
  }
 
  private void invalidationBlocksForInProgressPutTest(final boolean keyOnly) throws Exception {
    final PutFromLoadValidator testee = new PutFromLoadValidator(null);
    final CountDownLatch removeLatch = new CountDownLatch(1);
    final CountDownLatch pferLatch = new CountDownLatch(1);
    final AtomicReference<Object> cache = new AtomicReference<Object>("INITIAL");
   
    Callable<Boolean> pferCallable = new Callable<Boolean>() {
        public Boolean call() throws Exception {
            testee.registerPendingPut(KEY1);
            if (testee.acquirePutFromLoadLock(KEY1)) {
              try {
                removeLatch.countDown();
                pferLatch.await();
                cache.set("PFER");
                return Boolean.TRUE;
              }
              finally {
                testee.releasePutFromLoadLock(KEY1);
              }
            }
            return Boolean.FALSE;
        }
      };
   
    Callable<Void> invalidateCallable = new Callable<Void>() {
        public Void call() throws Exception {
            removeLatch.await();
            if (keyOnly) {
              testee.invalidateKey(KEY1);
            }
            else {
              testee.invalidateRegion();
            }           
            cache.set(null);
            return null;
        }
      };
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.