Package org.infinispan

Examples of org.infinispan.AdvancedCache


  public NaturalIdRegion buildNaturalIdRegion(String regionName, Properties properties, CacheDataDescription metadata)
      throws CacheException {
    if ( log.isDebugEnabled() ) {
      log.debug( "Building natural id cache region [" + regionName + "]" );
    }
    final AdvancedCache cache = getCache( regionName, NATURAL_ID_KEY, properties );
    final NaturalIdRegionImpl region = new NaturalIdRegionImpl( cache, regionName, metadata, this );
    startRegion( region, regionName );
    return region;
  }
View Full Code Here


    // If region name is not default one, lookup a cache for that region name
    if ( !regionName.equals( "org.hibernate.cache.internal.StandardQueryCache" ) ) {
      cacheName = regionName;
    }

    final AdvancedCache cache = getCache( cacheName, QUERY_KEY, properties );
    final QueryResultsRegionImpl region = new QueryResultsRegionImpl( cache, regionName, this );
    startRegion( region, regionName );
    return region;
  }
View Full Code Here

  public TimestampsRegion buildTimestampsRegion(String regionName, Properties properties)
      throws CacheException {
    if ( log.isDebugEnabled() ) {
      log.debug( "Building timestamps cache region [" + regionName + "]" );
    }
    final AdvancedCache cache = getCache( regionName, TIMESTAMPS_KEY, properties );
    final TimestampsRegionImpl region = createTimestampsRegion( cache, regionName );
    startRegion( region, regionName );
    return region;
  }
View Full Code Here

      configureTransactionManager( builder, templateCacheName, properties );
      // Define configuration
      manager.defineConfiguration( regionName, builder.build() );
      definedConfigurations.add( regionName );
    }
    final AdvancedCache cache = manager.getCache( regionName ).getAdvancedCache();
    if ( !cache.getStatus().allowInvocations() ) {
      cache.start();
    }
    return createCacheWrapper( cache );
  }
View Full Code Here

    * @param cache       cache to watch
    * @param cacheStatus status to wait for
    * @param timeout     timeout to wait for
    */
   public static void blockUntilCacheStatusAchieved(Cache cache, ComponentStatus cacheStatus, long timeout) {
      AdvancedCache spi = cache.getAdvancedCache();
      long killTime = System.currentTimeMillis() + timeout;
      while (System.currentTimeMillis() < killTime) {
         if (spi.getStatus() == cacheStatus) return;
         sleepThread(50);
      }
      throw new RuntimeException("Timed out waiting for condition");
   }
View Full Code Here

  }

  @Override
  public void lock(Serializable id, Object version, Object object, int timeout, SessionImplementor session)
      throws StaleObjectStateException, JDBCException {
    AdvancedCache advCache = getProvider(session).getCache(ENTITY_STORE).getAdvancedCache();
    EntityKey key = EntityKeyBuilder.fromData(
        lockable.getRootTableName(),
        lockable.getRootTableIdentifierColumnNames(),
        identifierGridType,
        id,
        session );
    advCache.lock( key );
    //FIXME check the version number as well and raise an optimistic lock exception if there is an issue JPA 2 spec: 3.4.4.2
  }
View Full Code Here

    * @param cache       cache to watch
    * @param cacheStatus status to wait for
    * @param timeout     timeout to wait for
    */
   public static void blockUntilCacheStatusAchieved(Cache cache, ComponentStatus cacheStatus, long timeout) {
      AdvancedCache spi = cache.getAdvancedCache();
      long killTime = System.currentTimeMillis() + timeout;
      while (System.currentTimeMillis() < killTime) {
         if (spi.getStatus() == cacheStatus) return;
         sleepThread(50);
      }
      throw new RuntimeException("Timed out waiting for condition");
   }
View Full Code Here

   protected final RpcManager realOne;


   public static CountingRpcManager replaceRpcManager(Cache c) {
      AdvancedCache advancedCache = c.getAdvancedCache();
      CountingRpcManager crm = new CountingRpcManager(advancedCache.getRpcManager());
      advancedCache.getComponentRegistry().registerComponent(crm, RpcManager.class);
      advancedCache.getComponentRegistry().rewire();
      assert advancedCache.getRpcManager().equals(crm);
      return crm;
   }
View Full Code Here

      assert !mBeanServer.isRegistered(name1);
      assertCorrectJmxName(name1, first);
   }

   private ComponentsJmxRegistration buildRegistrator(Cache cache) {
      AdvancedCache ac = (AdvancedCache) cache;
      Set<AbstractComponentRegistry.Component> components = ac.getComponentRegistry().getRegisteredComponents();
      String groupName = "name=" + ObjectName.quote(cache.getName());
      ComponentsJmxRegistration registrator = new ComponentsJmxRegistration(mBeanServer, components, groupName);
      registrator.setJmxDomain(JMX_DOMAIN);
      return registrator;
   }
View Full Code Here

    * @throws InterruptedException
    */
   @Test(threadPoolSize = 7, invocationCount = 21)
   public void testScenario() throws InterruptedException {
      int myId = sequencer.incrementAndGet();
      AdvancedCache cache = this.caches.get(myId % this.INIT_CLUSTER_SIZE).getAdvancedCache();
      for (int i = 0; i < 100; i++) {
         if (i % 4 == 0)
            cache.withFlags(Flag.SKIP_LOCKING).put(key, "value");
         cache.withFlags(Flag.SKIP_LOCKING).remove(key);
      }
      cache.clear();
   }
View Full Code Here

TOP

Related Classes of org.infinispan.AdvancedCache

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.