Package org.infinispan.configuration.cache

Examples of org.infinispan.configuration.cache.Configuration


   public void testRemoteGetForGetKeyValueCommand() throws Throwable {
      ConfigurationBuilder cb = new ConfigurationBuilder();
      cb.clustering().cacheMode(CacheMode.REPL_SYNC);

      GlobalConfigurationBuilder gcb = GlobalConfigurationBuilder.defaultClusteredBuilder();
      Configuration configuration = cb.build();

      ReplicationInterceptor replInterceptor = new ReplicationInterceptor();
      CommandInterceptor nextInterceptor = mock(CommandInterceptor.class);
      when(nextInterceptor.visitGetKeyValueCommand(any(InvocationContext.class), any(GetKeyValueCommand.class))).thenReturn(null);
      replInterceptor.setNext(nextInterceptor);
View Full Code Here


      }
   }

   @Override
   public void cacheStarted(ComponentRegistry cr, String cacheName) {
      Configuration configuration = cr.getComponent(Configuration.class);
      boolean indexingEnabled = configuration.indexing().enabled();
      if ( ! indexingEnabled ) {
         if ( verifyChainContainsQueryInterceptor(cr) ) {
            throw new IllegalStateException( "It was NOT expected to find the Query interceptor registered in the InterceptorChain as indexing was disabled, but it was found" );
         }
         return;
View Full Code Here

      registerQueryMBeans(cache.getAdvancedCache(), cr, cacheName);
   }

   private void registerQueryMBeans(AdvancedCache cache,
         ComponentRegistry cr, String cacheName) {
      Configuration cfg = cache.getCacheConfiguration();
      SearchFactoryIntegrator sf = getSearchFactory(
            cfg.indexing().properties(), cr, null);

      // Resolve MBean server instance
      GlobalConfiguration globalCfg =
            cr.getGlobalComponentRegistry().getGlobalConfiguration();
      mbeanServer = JmxUtil.lookupMBeanServer(globalCfg);

      // Resolve jmx domain to use for query mbeans
      String queryGroupName = getQueryGroupName(cacheName);
      jmxDomain = JmxUtil.buildJmxDomain(globalCfg, mbeanServer, queryGroupName);

      // Register statistics MBean, but only enable if Infinispan config says so
      Statistics stats = sf.getStatistics();
      stats.setStatisticsEnabled(cfg.jmxStatistics().enabled());
      try {
         ObjectName statsObjName = new ObjectName(
               jmxDomain + ":" + queryGroupName + ",component=Statistics");
         JmxUtil.registerMBean(new StatisticsInfo(stats), statsObjName, mbeanServer);
      } catch (Exception e) {
View Full Code Here

      SearchFactoryIntegrator searchFactoryIntegrator = searchFactoriesToShutdown.remove(cacheName);
      if (searchFactoryIntegrator != null) {
         searchFactoryIntegrator.close();
      }

      Configuration cfg = cr.getComponent(Configuration.class);
      removeQueryInterceptorFromConfiguration(cfg);
   }
View Full Code Here

            GlobalConfiguration globalConfigFromXml = cacheManager.getCacheManagerConfiguration();

            GlobalConfigurationBuilder globalConfigBuilder = new GlobalConfigurationBuilder();
            globalConfigBuilder.read(globalConfigFromXml);

            Configuration configFromXml = cacheManager.getDefaultCacheConfiguration();
            ConfigurationBuilder configBuilder = new ConfigurationBuilder().read(configFromXml);

            // Configure transactionManagerLookup programmatically if not provided in configuration
            TransactionManagerLookup tmLookup = configFromXml.transaction().transactionManagerLookup();
            if (tmLookup == null) {
                tmLookup = getTransactionManagerLookup();
                configBuilder.transaction().transactionManagerLookup(tmLookup);
            }
            log.debug("Infinispan transaction manager lookup: " + tmLookup);

            // If we don't want structure cache entries to expire, we need to configure infinite lifespan and keep original
            // lifespan value, which will be send to tree api
            if (skipExpirationOfStructureCacheEntries) {
                cacheLifespanOfLeafNodes = configFromXml.expiration().lifespan();
                configBuilder.expiration().lifespan(-1);
                log.debug("Expiration of structure cache entries is disabled. Leaf nodes will use expiration "
                        + cacheLifespanOfLeafNodes);
            }
View Full Code Here

      SiteCachePair toLookFor = new SiteCachePair(remoteCache, remoteSite);
      BackupReceiver backupManager = backupReceivers.get(toLookFor);
      if (backupManager != null) return backupManager;

      //check the default cache first
      Configuration dcc = cacheManager.getDefaultCacheConfiguration();
      if (isBackupForRemoteCache(remoteSite, remoteCache, dcc, EmbeddedCacheManager.DEFAULT_CACHE_NAME)) {
         Cache<Object, Object> cache = cacheManager.getCache();
         backupReceivers.putIfAbsent(toLookFor, new BackupReceiverImpl(cache));
         toLookFor.setLocalCacheName(EmbeddedCacheManager.DEFAULT_CACHE_NAME);
         return backupReceivers.get(toLookFor);
      }

      Set<String> cacheNames = cacheManager.getCacheNames();
      for (String name : cacheNames) {
         Configuration cacheConfiguration = cacheManager.getCacheConfiguration(name);
         if (isBackupForRemoteCache(remoteSite, remoteCache, cacheConfiguration, name)) {
            Cache<Object, Object> cache = cacheManager.getCache(name);
            toLookFor.setLocalCacheName(name);
            backupReceivers.putIfAbsent(toLookFor, new BackupReceiverImpl(cache));
            return backupReceivers.get(toLookFor);
View Full Code Here

    public EmbeddedCacheManager create() {
        GlobalConfiguration global = new GlobalConfigurationBuilder()
            .globalJmxStatistics().cacheManagerName("geekseek")
            .build();

        Configuration local = new ConfigurationBuilder()
            .clustering()
                .cacheMode(CacheMode.LOCAL)
            .transaction()
                .transactionMode(TransactionMode.TRANSACTIONAL)
                .transactionManagerLookup(new GenericTransactionManagerLookup())
View Full Code Here

   private static Cache<?, ?> checkValidConfiguration(final Cache<?, ?> cache, String indexName) {
      if (cache == null) {
         return null;
      }
      Configuration configuration = cache.getCacheConfiguration();
      if (configuration.expiration().maxIdle() != -1) {
         throw log.luceneStorageHavingIdleTimeSet(indexName, cache.getName());
      }
      if (configuration.expiration().lifespan() != -1) {
         throw log.luceneStorageHavingLifespanSet(indexName, cache.getName());
      }
      if (configuration.storeAsBinary().enabled()) {
         throw log.luceneStorageAsBinaryEnabled(indexName, cache.getName());
      }
      if (!Configurations.noDataLossOnJoiner(configuration)) {
         throw log.luceneStorageNoStateTransferEnabled(indexName, cache.getName());
      }
View Full Code Here

      checkNotNull(indexName, "indexName");
      return new BaseLockFactory(cache, indexName);
   }

   private static void validateMetadataCache(Cache<?, ?> cache, String indexName) {
      Configuration configuration = cache.getCacheConfiguration();
      if (configuration.eviction().strategy().isEnabled()) {
         throw log.evictionNotAllowedInMetadataCache(indexName, cache.getName());
      }
      if (configuration.persistence().usingStores() && !configuration.persistence().preload()) {
         throw log.preloadNeededIfPersistenceIsEnabledForMetadataCache(indexName, cache.getName());
      }
   }
View Full Code Here

   public void testConfigBuilder() {
    GlobalConfiguration globalConfig = new GlobalConfigurationBuilder()
        .globalJmxStatistics().transport().defaultTransport().build();

    Configuration cacheConfig = new ConfigurationBuilder().persistence()
        .addStore(JpaStoreConfigurationBuilder.class)
        .persistenceUnitName(PERSISTENCE_UNIT_NAME)
        .entityClass(User.class).build();
   
   
    StoreConfiguration storeConfiguration = cacheConfig.persistence().stores().get(0);
    assertTrue(storeConfiguration instanceof JpaStoreConfiguration);
    JpaStoreConfiguration jpaCacheLoaderConfig = (JpaStoreConfiguration) storeConfiguration;
    assertEquals(PERSISTENCE_UNIT_NAME, jpaCacheLoaderConfig.persistenceUnitName());
    assertEquals(User.class, jpaCacheLoaderConfig.entityClass());
View Full Code Here

TOP

Related Classes of org.infinispan.configuration.cache.Configuration

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.