Examples of QueryResultsRegion


Examples of org.hibernate.cache.QueryResultsRegion

        JBossCacheRegionFactory regionFactory = CacheTestUtil.startRegionFactory(cfg, getCacheTestSupport());
       
        // Sleep a bit to avoid concurrent FLUSH problem
        avoidConcurrentFlush();

        final QueryResultsRegion region = regionFactory.buildQueryResultsRegion(getStandardRegionName(REGION_PREFIX), cfg.getProperties());
       
        region.put(KEY, VALUE1);
        assertEquals(VALUE1, region.get(KEY));

        final CountDownLatch readerLatch = new CountDownLatch(1);
        final CountDownLatch writerLatch = new CountDownLatch(1);
        final CountDownLatch completionLatch = new CountDownLatch(1);
        final ExceptionHolder holder = new ExceptionHolder();
       
        Thread reader = new Thread() {
         
            public void run() {
                try {
                    BatchModeTransactionManager.getInstance().begin();
                    assertTrue(VALUE2.equals(region.get(KEY)) == false);
                    BatchModeTransactionManager.getInstance().commit();
                }
                catch (AssertionFailedError e) {
                    holder.a1 = e;
                    rollback();
                }
                catch (Exception e) {
                    holder.e1 = e;
                    rollback();
                }
                finally {
                    readerLatch.countDown();
                }
            }
        };
       
        Thread writer = new Thread() {
         
            public void run() {
                try {                   
                    BatchModeTransactionManager.getInstance().begin();
                    region.put(KEY, VALUE2);
                    writerLatch.await();
                    BatchModeTransactionManager.getInstance().commit();
                }
                catch (Exception e) {
                    holder.e2 = e;
                    rollback();
                }
                finally {
                    completionLatch.countDown();
                }
            }
        };
       
        reader.setDaemon(true);
        writer.setDaemon(true);
       
        writer.start();       
        assertFalse("Writer is blocking", completionLatch.await(100, TimeUnit.MILLISECONDS));
       
        // Start the reader
        reader.start();
        assertTrue("Reader finished promptly", readerLatch.await(100, TimeUnit.MILLISECONDS));

        writerLatch.countDown();
        assertTrue("Reader finished promptly", completionLatch.await(100, TimeUnit.MILLISECONDS));
               
        assertEquals(VALUE2, region.get(KEY));           
       
        if (holder.a1 != null)
            throw holder.a1;
        else if (holder.a2 != null)
            throw holder.a2;
View Full Code Here

Examples of org.hibernate.cache.QueryResultsRegion

        JBossCacheRegionFactory regionFactory = CacheTestUtil.startRegionFactory(cfg, getCacheTestSupport());
       
        // Sleep a bit to avoid concurrent FLUSH problem
        avoidConcurrentFlush();
       
        final QueryResultsRegion region = regionFactory.buildQueryResultsRegion(getStandardRegionName(REGION_PREFIX), cfg.getProperties());
       
        region.put(KEY, VALUE1);
        assertEquals(VALUE1, region.get(KEY));
       
        final Fqn rootFqn = getRegionFqn(getStandardRegionName(REGION_PREFIX), REGION_PREFIX);
        final Cache jbc = getJBossCache(regionFactory);

        final CountDownLatch blockerLatch = new CountDownLatch(1);
        final CountDownLatch writerLatch = new CountDownLatch(1);
        final CountDownLatch completionLatch = new CountDownLatch(1);
        final ExceptionHolder holder = new ExceptionHolder();
       
        Thread blocker = new Thread() {
         
            public void run() {
                Fqn toBlock = new Fqn(rootFqn, KEY);
                GetBlocker blocker = new GetBlocker(blockerLatch,toBlock);
                try {
                    jbc.addCacheListener(blocker);
                   
                    BatchModeTransactionManager.getInstance().begin();
                    region.get(KEY);
                    BatchModeTransactionManager.getInstance().commit();
                }
                catch (Exception e) {
                    holder.e1 = e;
                    rollback();
                }
                finally {
                    jbc.removeCacheListener(blocker);
                }
            }
        };
       
        Thread writer = new Thread() {
         
            public void run() {
                try {
                    writerLatch.await();
                   
                    BatchModeTransactionManager.getInstance().begin();
                    region.put(KEY, VALUE2);
                    BatchModeTransactionManager.getInstance().commit();
                }
                catch (Exception e) {
                    holder.e2 = e;
                    rollback();
                }
                finally {
                    completionLatch.countDown();
                }
            }
        };
       
        blocker.setDaemon(true);
        writer.setDaemon(true);
       
        boolean unblocked = false;
        try {
            blocker.start();
            writer.start();
           
            assertFalse("Blocker is blocking", completionLatch.await(100, TimeUnit.MILLISECONDS));
            // Start the writer
            writerLatch.countDown();
            assertTrue("Writer finished promptly", completionLatch.await(100, TimeUnit.MILLISECONDS));
           
            blockerLatch.countDown();
            unblocked = true;
           
            if ("PESSIMISTIC".equals(jbc.getConfiguration().getNodeLockingSchemeString())
                  && "REPEATABLE_READ".equals(jbc.getConfiguration().getIsolationLevelString())) {
                assertEquals(VALUE1, region.get(KEY));
            }
            else {
                assertEquals(VALUE2, region.get(KEY));
            }           
           
            if (holder.a1 != null)
                throw holder.a1;
            else if (holder.a2 != null)
View Full Code Here

Examples of org.hibernate.cache.QueryResultsRegion

        JBossCacheRegionFactory regionFactory = CacheTestUtil.startRegionFactory(cfg, getCacheTestSupport());
       
        // Sleep a bit to avoid concurrent FLUSH problem
        avoidConcurrentFlush();

        final QueryResultsRegion region = regionFactory.buildQueryResultsRegion(getStandardRegionName(REGION_PREFIX), cfg.getProperties());
       
        region.put(KEY, VALUE1);
        assertEquals(VALUE1, region.get(KEY));

        final CountDownLatch readerLatch = new CountDownLatch(1);
        final CountDownLatch writerLatch = new CountDownLatch(1);
        final CountDownLatch completionLatch = new CountDownLatch(1);
        final ExceptionHolder holder = new ExceptionHolder();
       
        Thread reader = new Thread() {
         
            public void run() {
                try {
                    BatchModeTransactionManager.getInstance().begin();
                    assertTrue(VALUE2.equals(region.get(KEY)) == false);
                    BatchModeTransactionManager.getInstance().commit();
                }
                catch (AssertionFailedError e) {
                    holder.a1 = e;
                    rollback();
                }
                catch (Exception e) {
                    holder.e1 = e;
                    rollback();
                }
                finally {
                    readerLatch.countDown();
                }
            }
        };
       
        Thread writer = new Thread() {
         
            public void run() {
                try {                   
                    BatchModeTransactionManager.getInstance().begin();
                    region.put(KEY, VALUE2);
                    writerLatch.await();
                    BatchModeTransactionManager.getInstance().commit();
                }
                catch (Exception e) {
                    holder.e2 = e;
                    rollback();
                }
                finally {
                    completionLatch.countDown();
                }
            }
        };
       
        reader.setDaemon(true);
        writer.setDaemon(true);
       
        writer.start();       
        assertFalse("Writer is blocking", completionLatch.await(100, TimeUnit.MILLISECONDS));
       
        // Start the reader
        reader.start();
        assertTrue("Reader finished promptly", readerLatch.await(100, TimeUnit.MILLISECONDS));

        writerLatch.countDown();
        assertTrue("Reader finished promptly", completionLatch.await(100, TimeUnit.MILLISECONDS));
               
        assertEquals(VALUE2, region.get(KEY));           
       
        if (holder.a1 != null)
            throw holder.a1;
        else if (holder.a2 != null)
            throw holder.a2;
View Full Code Here

Examples of org.hibernate.cache.QueryResultsRegion

        JBossCacheRegionFactory regionFactory = CacheTestUtil.startRegionFactory(cfg, getCacheTestSupport());
       
        // Sleep a bit to avoid concurrent FLUSH problem
        avoidConcurrentFlush();
       
        final QueryResultsRegion region = regionFactory.buildQueryResultsRegion(getStandardRegionName(REGION_PREFIX), cfg.getProperties());
       
        region.put(KEY, VALUE1);
        assertEquals(VALUE1, region.get(KEY));
       
        final Fqn rootFqn = getRegionFqn(getStandardRegionName(REGION_PREFIX), REGION_PREFIX);
        final Cache jbc = getJBossCache(regionFactory);

        final CountDownLatch blockerLatch = new CountDownLatch(1);
        final CountDownLatch writerLatch = new CountDownLatch(1);
        final CountDownLatch completionLatch = new CountDownLatch(1);
        final ExceptionHolder holder = new ExceptionHolder();
       
        Thread blocker = new Thread() {
         
            public void run() {
                Fqn toBlock = new Fqn(rootFqn, KEY);
                GetBlocker blocker = new GetBlocker(blockerLatch,toBlock);
                try {
                    jbc.addCacheListener(blocker);
                   
                    BatchModeTransactionManager.getInstance().begin();
                    region.get(KEY);
                    BatchModeTransactionManager.getInstance().commit();
                }
                catch (Exception e) {
                    holder.e1 = e;
                    rollback();
                }
                finally {
                    jbc.removeCacheListener(blocker);
                }
            }
        };
       
        Thread writer = new Thread() {
         
            public void run() {
                try {
                    writerLatch.await();
                   
                    BatchModeTransactionManager.getInstance().begin();
                    region.put(KEY, VALUE2);
                    BatchModeTransactionManager.getInstance().commit();
                }
                catch (Exception e) {
                    holder.e2 = e;
                    rollback();
                }
                finally {
                    completionLatch.countDown();
                }
            }
        };
       
        blocker.setDaemon(true);
        writer.setDaemon(true);
       
        boolean unblocked = false;
        try {
            blocker.start();
            writer.start();
           
            assertFalse("Blocker is blocking", completionLatch.await(100, TimeUnit.MILLISECONDS));
            // Start the writer
            writerLatch.countDown();
            assertTrue("Writer finished promptly", completionLatch.await(100, TimeUnit.MILLISECONDS));
           
            blockerLatch.countDown();
            unblocked = true;
           
            if ("PESSIMISTIC".equals(jbc.getConfiguration().getNodeLockingSchemeString())
                  && "REPEATABLE_READ".equals(jbc.getConfiguration().getIsolationLevelString())) {
                assertEquals(VALUE1, region.get(KEY));
            }
            else {
                assertEquals(VALUE2, region.get(KEY));
            }           
           
            if (holder.a1 != null)
                throw holder.a1;
            else if (holder.a2 != null)
View Full Code Here

Examples of org.hibernate.cache.QueryResultsRegion

      InfinispanRegionFactory regionFactory = CacheTestUtil.startRegionFactory(cfg, getCacheTestSupport());

      // Sleep a bit to avoid concurrent FLUSH problem
      avoidConcurrentFlush();

      final QueryResultsRegion region = regionFactory.buildQueryResultsRegion(getStandardRegionName(REGION_PREFIX), cfg
               .getProperties());

      region.put(KEY, VALUE1);
      assertEquals(VALUE1, region.get(KEY));

      final CountDownLatch readerLatch = new CountDownLatch(1);
      final CountDownLatch writerLatch = new CountDownLatch(1);
      final CountDownLatch completionLatch = new CountDownLatch(1);
      final ExceptionHolder holder = new ExceptionHolder();

      Thread reader = new Thread() {
         public void run() {
            try {
               BatchModeTransactionManager.getInstance().begin();
               log.debug("Transaction began, get value for key");
               assertTrue(VALUE2.equals(region.get(KEY)) == false);
               BatchModeTransactionManager.getInstance().commit();
            } catch (AssertionFailedError e) {
               holder.a1 = e;
               rollback();
            } catch (Exception e) {
               holder.e1 = e;
               rollback();
            } finally {
               readerLatch.countDown();
            }
         }
      };

      Thread writer = new Thread() {
         public void run() {
            try {
               BatchModeTransactionManager.getInstance().begin();
               log.debug("Put value2");
               region.put(KEY, VALUE2);
               log.debug("Put finished for value2, await writer latch");
               writerLatch.await();
               log.debug("Writer latch finished");
               BatchModeTransactionManager.getInstance().commit();
               log.debug("Transaction committed");
            } catch (Exception e) {
               holder.e2 = e;
               rollback();
            } finally {
               completionLatch.countDown();
            }
         }
      };

      reader.setDaemon(true);
      writer.setDaemon(true);

      writer.start();
      assertFalse("Writer is blocking", completionLatch.await(100, TimeUnit.MILLISECONDS));

      // Start the reader
      reader.start();
      assertTrue("Reader finished promptly", readerLatch.await(1000000000, TimeUnit.MILLISECONDS));

      writerLatch.countDown();
      assertTrue("Reader finished promptly", completionLatch.await(100, TimeUnit.MILLISECONDS));

      assertEquals(VALUE2, region.get(KEY));

      if (holder.a1 != null)
         throw holder.a1;
      else if (holder.a2 != null)
         throw holder.a2;
View Full Code Here

Examples of org.hibernate.cache.QueryResultsRegion

      InfinispanRegionFactory regionFactory = CacheTestUtil.startRegionFactory(cfg, getCacheTestSupport());

      // Sleep a bit to avoid concurrent FLUSH problem
      avoidConcurrentFlush();

      final QueryResultsRegion region = regionFactory.buildQueryResultsRegion(getStandardRegionName(REGION_PREFIX), cfg
               .getProperties());

      region.put(KEY, VALUE1);
      assertEquals(VALUE1, region.get(KEY));

      // final Fqn rootFqn = getRegionFqn(getStandardRegionName(REGION_PREFIX), REGION_PREFIX);
      final CacheAdapter jbc = getInfinispanCache(regionFactory);

      final CountDownLatch blockerLatch = new CountDownLatch(1);
      final CountDownLatch writerLatch = new CountDownLatch(1);
      final CountDownLatch completionLatch = new CountDownLatch(1);
      final ExceptionHolder holder = new ExceptionHolder();

      Thread blocker = new Thread() {

         public void run() {
            // Fqn toBlock = new Fqn(rootFqn, KEY);
            GetBlocker blocker = new GetBlocker(blockerLatch, KEY);
            try {
               jbc.addListener(blocker);

               BatchModeTransactionManager.getInstance().begin();
               region.get(KEY);
               BatchModeTransactionManager.getInstance().commit();
            } catch (Exception e) {
               holder.e1 = e;
               rollback();
            } finally {
               jbc.removeListener(blocker);
            }
         }
      };

      Thread writer = new Thread() {

         public void run() {
            try {
               writerLatch.await();

               BatchModeTransactionManager.getInstance().begin();
               region.put(KEY, VALUE2);
               BatchModeTransactionManager.getInstance().commit();
            } catch (Exception e) {
               holder.e2 = e;
               rollback();
            } finally {
               completionLatch.countDown();
            }
         }
      };

      blocker.setDaemon(true);
      writer.setDaemon(true);

      boolean unblocked = false;
      try {
         blocker.start();
         writer.start();

         assertFalse("Blocker is blocking", completionLatch.await(100, TimeUnit.MILLISECONDS));
         // Start the writer
         writerLatch.countDown();
         assertTrue("Writer finished promptly", completionLatch.await(100, TimeUnit.MILLISECONDS));

         blockerLatch.countDown();
         unblocked = true;

         if (IsolationLevel.REPEATABLE_READ.equals(jbc.getConfiguration().getIsolationLevel())) {
            assertEquals(VALUE1, region.get(KEY));
         } else {
            assertEquals(VALUE2, region.get(KEY));
         }

         if (holder.a1 != null)
            throw holder.a1;
         else if (holder.a2 != null)
View Full Code Here

Examples of org.hibernate.cache.spi.QueryResultsRegion

    );

    // Sleep a bit to avoid concurrent FLUSH problem
    avoidConcurrentFlush();

    final QueryResultsRegion region = regionFactory.buildQueryResultsRegion(
        getStandardRegionName( REGION_PREFIX ),
        cfg.getProperties()
    );

    region.put( KEY, VALUE1 );
    assertEquals( VALUE1, region.get( KEY ) );

    final CountDownLatch readerLatch = new CountDownLatch( 1 );
    final CountDownLatch writerLatch = new CountDownLatch( 1 );
    final CountDownLatch completionLatch = new CountDownLatch( 1 );
    final ExceptionHolder holder = new ExceptionHolder();

    Thread reader = new Thread() {
      @Override
      public void run() {
        try {
          BatchModeTransactionManager.getInstance().begin();
          log.debug( "Transaction began, get value for key" );
          assertTrue( VALUE2.equals( region.get( KEY ) ) == false );
          BatchModeTransactionManager.getInstance().commit();
        }
        catch (AssertionFailedError e) {
          holder.a1 = e;
          rollback();
        }
        catch (Exception e) {
          holder.e1 = e;
          rollback();
        }
        finally {
          readerLatch.countDown();
        }
      }
    };

    Thread writer = new Thread() {
      @Override
      public void run() {
        try {
          BatchModeTransactionManager.getInstance().begin();
          log.debug( "Put value2" );
          region.put( KEY, VALUE2 );
          log.debug( "Put finished for value2, await writer latch" );
          writerLatch.await();
          log.debug( "Writer latch finished" );
          BatchModeTransactionManager.getInstance().commit();
          log.debug( "Transaction committed" );
        }
        catch (Exception e) {
          holder.e2 = e;
          rollback();
        }
        finally {
          completionLatch.countDown();
        }
      }
    };

    reader.setDaemon( true );
    writer.setDaemon( true );

    writer.start();
    assertFalse( "Writer is blocking", completionLatch.await( 100, TimeUnit.MILLISECONDS ) );

    // Start the reader
    reader.start();
    assertTrue( "Reader finished promptly", readerLatch.await( 1000000000, TimeUnit.MILLISECONDS ) );

    writerLatch.countDown();
    assertTrue( "Reader finished promptly", completionLatch.await( 100, TimeUnit.MILLISECONDS ) );

    assertEquals( VALUE2, region.get( KEY ) );

    if ( holder.a1 != null ) {
      throw holder.a1;
    }
    else if ( holder.a2 != null ) {
View Full Code Here

Examples of org.hibernate.cache.spi.QueryResultsRegion

    );

    // Sleep a bit to avoid concurrent FLUSH problem
    avoidConcurrentFlush();

    final QueryResultsRegion region = regionFactory.buildQueryResultsRegion(
        getStandardRegionName( REGION_PREFIX ),
        cfg.getProperties()
    );

    region.put( KEY, VALUE1 );
    assertEquals( VALUE1, region.get( KEY ) );

    // final Fqn rootFqn = getRegionFqn(getStandardRegionName(REGION_PREFIX), REGION_PREFIX);
    final AdvancedCache jbc = getInfinispanCache(regionFactory);

    final CountDownLatch blockerLatch = new CountDownLatch( 1 );
    final CountDownLatch writerLatch = new CountDownLatch( 1 );
    final CountDownLatch completionLatch = new CountDownLatch( 1 );
    final ExceptionHolder holder = new ExceptionHolder();

    Thread blocker = new Thread() {

      @Override
      public void run() {
        // Fqn toBlock = new Fqn(rootFqn, KEY);
        GetBlocker blocker = new GetBlocker( blockerLatch, KEY );
        try {
          jbc.addListener( blocker );

          BatchModeTransactionManager.getInstance().begin();
          region.get( KEY );
          BatchModeTransactionManager.getInstance().commit();
        }
        catch (Exception e) {
          holder.e1 = e;
          rollback();
        }
        finally {
          jbc.removeListener( blocker );
        }
      }
    };

    Thread writer = new Thread() {

      @Override
      public void run() {
        try {
          writerLatch.await();

          BatchModeTransactionManager.getInstance().begin();
          region.put( KEY, VALUE2 );
          BatchModeTransactionManager.getInstance().commit();
        }
        catch (Exception e) {
          holder.e2 = e;
          rollback();
        }
        finally {
          completionLatch.countDown();
        }
      }
    };

    blocker.setDaemon( true );
    writer.setDaemon( true );

    boolean unblocked = false;
    try {
      blocker.start();
      writer.start();

      assertFalse( "Blocker is blocking", completionLatch.await( 100, TimeUnit.MILLISECONDS ) );
      // Start the writer
      writerLatch.countDown();
      assertTrue( "Writer finished promptly", completionLatch.await( 100, TimeUnit.MILLISECONDS ) );

      blockerLatch.countDown();
      unblocked = true;

      if ( IsolationLevel.REPEATABLE_READ.equals( jbc.getConfiguration().getIsolationLevel() ) ) {
        assertEquals( VALUE1, region.get( KEY ) );
      }
      else {
        assertEquals( VALUE2, region.get( KEY ) );
      }

      if ( holder.a1 != null ) {
        throw holder.a1;
      }
View Full Code Here

Examples of org.hibernate.cache.spi.QueryResultsRegion

    );

    // Sleep a bit to avoid concurrent FLUSH problem
    avoidConcurrentFlush();

    final QueryResultsRegion region = regionFactory.buildQueryResultsRegion(
        getStandardRegionName( REGION_PREFIX ),
        cfg.getProperties()
    );

    region.put( KEY, VALUE1 );
    assertEquals( VALUE1, region.get( KEY ) );

    final CountDownLatch readerLatch = new CountDownLatch( 1 );
    final CountDownLatch writerLatch = new CountDownLatch( 1 );
    final CountDownLatch completionLatch = new CountDownLatch( 1 );
    final ExceptionHolder holder = new ExceptionHolder();

    Thread reader = new Thread() {
      @Override
      public void run() {
        try {
          BatchModeTransactionManager.getInstance().begin();
          log.debug( "Transaction began, get value for key" );
          assertTrue( VALUE2.equals( region.get( KEY ) ) == false );
          BatchModeTransactionManager.getInstance().commit();
        }
        catch (AssertionFailedError e) {
          holder.a1 = e;
          rollback();
        }
        catch (Exception e) {
          holder.e1 = e;
          rollback();
        }
        finally {
          readerLatch.countDown();
        }
      }
    };

    Thread writer = new Thread() {
      @Override
      public void run() {
        try {
          BatchModeTransactionManager.getInstance().begin();
          log.debug( "Put value2" );
          region.put( KEY, VALUE2 );
          log.debug( "Put finished for value2, await writer latch" );
          writerLatch.await();
          log.debug( "Writer latch finished" );
          BatchModeTransactionManager.getInstance().commit();
          log.debug( "Transaction committed" );
        }
        catch (Exception e) {
          holder.e2 = e;
          rollback();
        }
        finally {
          completionLatch.countDown();
        }
      }
    };

    reader.setDaemon( true );
    writer.setDaemon( true );

    writer.start();
    assertFalse( "Writer is blocking", completionLatch.await( 100, TimeUnit.MILLISECONDS ) );

    // Start the reader
    reader.start();
    assertTrue( "Reader finished promptly", readerLatch.await( 1000000000, TimeUnit.MILLISECONDS ) );

    writerLatch.countDown();
    assertTrue( "Reader finished promptly", completionLatch.await( 100, TimeUnit.MILLISECONDS ) );

    assertEquals( VALUE2, region.get( KEY ) );

    if ( holder.a1 != null ) {
      throw holder.a1;
    }
    else if ( holder.a2 != null ) {
View Full Code Here

Examples of org.hibernate.cache.spi.QueryResultsRegion

    );

    // Sleep a bit to avoid concurrent FLUSH problem
    avoidConcurrentFlush();

    final QueryResultsRegion region = regionFactory.buildQueryResultsRegion(
        getStandardRegionName( REGION_PREFIX ),
        cfg.getProperties()
    );

    region.put( KEY, VALUE1 );
    assertEquals( VALUE1, region.get( KEY ) );

    // final Fqn rootFqn = getRegionFqn(getStandardRegionName(REGION_PREFIX), REGION_PREFIX);
    final AdvancedCache jbc = getInfinispanCache(regionFactory);

    final CountDownLatch blockerLatch = new CountDownLatch( 1 );
    final CountDownLatch writerLatch = new CountDownLatch( 1 );
    final CountDownLatch completionLatch = new CountDownLatch( 1 );
    final ExceptionHolder holder = new ExceptionHolder();

    Thread blocker = new Thread() {

      @Override
      public void run() {
        // Fqn toBlock = new Fqn(rootFqn, KEY);
        GetBlocker blocker = new GetBlocker( blockerLatch, KEY );
        try {
          jbc.addListener( blocker );

          BatchModeTransactionManager.getInstance().begin();
          region.get( KEY );
          BatchModeTransactionManager.getInstance().commit();
        }
        catch (Exception e) {
          holder.e1 = e;
          rollback();
        }
        finally {
          jbc.removeListener( blocker );
        }
      }
    };

    Thread writer = new Thread() {

      @Override
      public void run() {
        try {
          writerLatch.await();

          BatchModeTransactionManager.getInstance().begin();
          region.put( KEY, VALUE2 );
          BatchModeTransactionManager.getInstance().commit();
        }
        catch (Exception e) {
          holder.e2 = e;
          rollback();
        }
        finally {
          completionLatch.countDown();
        }
      }
    };

    blocker.setDaemon( true );
    writer.setDaemon( true );

    boolean unblocked = false;
    try {
      blocker.start();
      writer.start();

      assertFalse( "Blocker is blocking", completionLatch.await( 100, TimeUnit.MILLISECONDS ) );
      // Start the writer
      writerLatch.countDown();
      assertTrue( "Writer finished promptly", completionLatch.await( 100, TimeUnit.MILLISECONDS ) );

      blockerLatch.countDown();
      unblocked = true;

      if ( IsolationLevel.REPEATABLE_READ.equals( jbc.getConfiguration().getIsolationLevel() ) ) {
        assertEquals( VALUE1, region.get( KEY ) );
      }
      else {
        assertEquals( VALUE2, region.get( KEY ) );
      }

      if ( holder.a1 != null ) {
        throw holder.a1;
      }
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.