Package org.infinispan.manager

Examples of org.infinispan.manager.EmbeddedCacheManager


      for (Object o : caches) {
         Cache c = (Cache) o;
         if (c == null) {
            System.out.println("  ** Cache " + count + " is null!");
         } else {
            EmbeddedCacheManager cacheManager = c.getCacheManager();
            System.out.println("  ** Cache " + count + " is " + cacheManager.getAddress());
         }
         count++;
      }
      System.out.println("**** END: Cache Contents ****");
   }
View Full Code Here


   }

   protected EmbeddedCacheManager createCacheManager(Properties properties) throws CacheException {
      try {
         String configLoc = PropertiesHelper.getString(INFINISPAN_CONFIG_RESOURCE_PROP, properties, DEF_INFINISPAN_CONFIG_RESOURCE);
         EmbeddedCacheManager manager = new DefaultCacheManager(configLoc, false);
         String globalStats = PropertiesHelper.extractPropertyValue(INFINISPAN_GLOBAL_STATISTICS_PROP, properties);
         if (globalStats != null) {
            manager.getGlobalConfiguration().setExposeGlobalJmxStatistics(Boolean.parseBoolean(globalStats));
         }
         manager.start();
         return manager;
      } catch (IOException e) {
         throw new CacheException("Unable to create default cache manager", e);
      }
   }
View Full Code Here

        try {
            // Set delegating classloader as tccl
            Thread.currentThread().setContextClassLoader(delegating);

            String cacheName = "idm-" + portalContainerName + "-" + apiOrStore;
            EmbeddedCacheManager cacheManager = getSharedCacheManager(configStream);
            return cacheManager.getCache(cacheName);
        } finally {
            // Put portal classloader to be tccl again
            Thread.currentThread().setContextClassLoader(portalCl);
        }
    }
View Full Code Here

     * @return cacheManager
     * @throws Exception
     */
    private EmbeddedCacheManager getSharedCacheManager(InputStream configStream) throws Exception {
        if (cacheManager == null) {
            EmbeddedCacheManager cacheManager = new DefaultCacheManager(configStream, false);
            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) {
View Full Code Here

   private int numberOfEntries = 100;

   @Override
   protected EmbeddedCacheManager createCacheManager() throws Exception {
      EmbeddedCacheManager cm =
            TestCacheManagerFactory.createCacheManagerEnforceJmxDomain(JMX_DOMAIN);

      ConfigurationBuilder builder = getDefaultStandaloneCacheConfig(true);
      builder.indexing().index(Index.ALL)
            .addProperty("default.directory_provider", "ram")
            .addProperty("error_handler", "org.infinispan.query.helper.StaticTestingErrorHandler")
            .addProperty("lucene_version", "LUCENE_CURRENT");

      cm.defineConfiguration(CACHE_NAME, builder.build());
      return cm;
   }
View Full Code Here

      ObjectName queryStatsObjectName = getQueryStatsObjectName(JMX_DOMAIN, CACHE_NAME);
      Set<ObjectName> matchingNames = server.queryNames(new ObjectName(JMX_DOMAIN + ":type=Query,component=Statistics,cache=" + ObjectName.quote(CACHE_NAME) + ",*"), null);
      assertEquals(1, matchingNames.size());
      assertTrue(matchingNames.contains(queryStatsObjectName));

      EmbeddedCacheManager cm2 = null;
      try {
         ConfigurationBuilder defaultCacheConfig2 = new ConfigurationBuilder();
         defaultCacheConfig2
               .indexing().index(Index.ALL)
               .addProperty("default.directory_provider", "ram")
               .addProperty("lucene_version", "LUCENE_CURRENT")
               .jmxStatistics().enable();

         cm2 = TestCacheManagerFactory.createClusteredCacheManagerEnforceJmxDomain("cm2", JMX_DOMAIN, true, true, defaultCacheConfig2, new PerThreadMBeanServerLookup());
         cm2.getCache(CACHE_NAME); // Start the cache belonging to second cache manager

         matchingNames = server.queryNames(new ObjectName(JMX_DOMAIN + ":type=Query,component=Statistics,cache=" + ObjectName.quote(CACHE_NAME) + ",*"), null);
         assertEquals(2, matchingNames.size());
         assertTrue(matchingNames.contains(queryStatsObjectName));
      } finally {
View Full Code Here

         // a parallel-testsuite friendly mbean server
         holder.getGlobalConfigurationBuilder().globalJmxStatistics()
               .jmxDomain(BASE_JMX_DOMAIN + i)
               .mBeanServerLookup(new PerThreadMBeanServerLookup());

         EmbeddedCacheManager cm = TestCacheManagerFactory
               .createClusteredCacheManager(holder, true);
         registerCacheManager(cm);
         Cache cache = cm.getCache();
         caches.add(cache);
      }
      waitForClusterToForm(neededCacheNames);
   }
View Full Code Here

   public void testCorrectBalancingOfKeysAfterNodeKill() {
      final AtomicInteger clientTopologyId = (AtomicInteger) TestingUtil.extractField(remoteCacheManager, "topologyId");

      final int topologyIdBeforeJoin = clientTopologyId.get();
      log.tracef("Starting test with client topology id %d", topologyIdBeforeJoin);
      EmbeddedCacheManager cm5 = addClusterEnabledCacheManager(buildConfiguration());
      HotRodServer hotRodServer5 = TestHelper.startHotRodServer(cm5);

      // Rebalancing to include the joiner will increment the topology id by 2
      eventually(new Condition() {
         @Override
View Full Code Here

   }

   public void startServers() throws Exception {
      if (!servers.isEmpty()) {
         for (Context s : servers.values()) {
            EmbeddedCacheManager manager = ServerBootstrap.getCacheManager(s.getServletContext());
            manager.start();
            for (String cacheName : manager.getCacheNames()) {
               manager.getCache(cacheName);
            }
            manager.getCache();
            s.getServer().start();
         }
      } else {
         throw new IllegalStateException("No servers defined!");
      }
View Full Code Here

   }

   public void stopServers() throws Exception {
      if (!servers.isEmpty()) {
         for (Context s : servers.values()) {
            EmbeddedCacheManager manager = ServerBootstrap.getCacheManager(s.getServletContext());
            s.getServer().stop();
            manager.stop();
         }
      } else {
         throw new IllegalStateException("No servers defined!");
      }
   }
View Full Code Here

TOP

Related Classes of org.infinispan.manager.EmbeddedCacheManager

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.