Package org.infinispan.manager

Examples of org.infinispan.manager.CacheContainer


   }
  
   public void add(CacheContainerRegistryConfigurationEntry entry) throws NamingException
   {
      CacheContainerConfiguration configuration = new CacheContainerConfigurationAdapter(entry.getConfiguration());
      CacheContainer container = this.factory.createCacheContainer(configuration, this.mapAliases(entry));
     
      String jndiName = entry.getJndiName();
     
      // Store cache containers with jndi name, so they can be unbound during stop()
      this.containers.put(entry.getId(), new AbstractMap.SimpleImmutableEntry<String, CacheContainer>(jndiName, container));
View Full Code Here


   public void testSameCacheManager()
   {
      ExoCache cache1 = service_.getCacheInstance("myCustomCache");
      assertTrue("expect an instance of AbstractExoCache", cache1 instanceof AbstractExoCache);
      AbstractExoCache aCache1 = (AbstractExoCache)cache1;
      CacheContainer cacheContainer1 = aCache1.cache.getCacheManager();

      ExoCache cache2 = service_.getCacheInstance("myCustomCache-Bis");
      assertTrue("expect an instance of AbstractExoCache", cache2 instanceof AbstractExoCache);
      AbstractExoCache aCache2 = (AbstractExoCache)cache2;
      CacheContainer cacheContainer2 = aCache2.cache.getCacheManager();
      assertTrue("The CacheContainer should be the same", cacheContainer1 == cacheContainer2);

      ExoCache cache3 = service_.getCacheInstance("myCustomCache-Bis2");
      assertTrue("expect an instance of AbstractExoCache", cache3 instanceof AbstractExoCache);
      AbstractExoCache aCache3 = (AbstractExoCache)cache3;
      CacheContainer cacheContainer3 = aCache3.cache.getCacheManager();
      assertTrue("The CacheContainer should be the same", cacheContainer1 == cacheContainer3);

      aCache1.cache.stop();
      aCache2.cache.stop();
   }
View Full Code Here

            containerName = parts[0];
            cacheName = parts[1];
         }
      }
     
      CacheContainer container = this.registry.getCacheContainer(containerName);
      this.cache = (cacheName == null) ? container.<SSOKey, Object>getCache() : container.<SSOKey, Object>getCache(cacheName);
     
      if (this.cache.getStatus() != ComponentStatus.RUNNING)
      {
         this.cache.start();
         this.startedCache.set(true);
View Full Code Here

   public void testDistributed() {
      doTest(CacheMode.DIST_SYNC);
   }

   private void doTest(CacheMode m) {
      CacheContainer cc = null;
      try {
         cc = TestCacheManagerFactory.createCacheManager(m, true);
         boolean found = false;
         for (CommandInterceptor i : cc.getCache().getAdvancedCache().getInterceptorChain()) {
            if (i instanceof QueryInterceptor) found = true;
         }
         assert found : "Didn't find a query interceptor in the chain!!";
      } finally {
         TestingUtil.killCacheManagers(cc);
View Full Code Here

*/
@Test(testName = "query.blackbox.SearchFactoryShutdownTest", groups = "functional")
public class SearchFactoryShutdownTest extends AbstractInfinispanTest {
  
   public void testCorrectShutdown() {
      CacheContainer cc = null;

      try {
         ConfigurationBuilder cfg = new ConfigurationBuilder();
         cfg
            .transaction()
               .transactionMode(TransactionMode.TRANSACTIONAL)
            .indexing()
               .index(Index.ALL)
               .addProperty("default.directory_provider", "ram")
               .addProperty("lucene_version", "LUCENE_CURRENT");
         cc = TestCacheManagerFactory.createCacheManager(cfg);
         Cache<?, ?> cache = cc.getCache();
         SearchFactoryIntegrator sfi = TestingUtil.extractComponent(cache, SearchFactoryIntegrator.class);

         assert ! sfi.isStopped();

         cc.stop();

         assert sfi.isStopped();
      } finally {
         // proper cleanup for exceptional execution
         TestingUtil.killCacheManagers(cc);
View Full Code Here

   @Override
   protected void createCacheManagers() throws Throwable {
      GlobalConfigurationBuilder globalCfg1 = createForeignExternalizerGlobalConfig();
      GlobalConfigurationBuilder globalCfg2 = createForeignExternalizerGlobalConfig();
      ConfigurationBuilder cfg = getDefaultClusteredCacheConfig(CacheMode.REPL_SYNC, false);
      CacheContainer cm1 = TestCacheManagerFactory.createClusteredCacheManager(globalCfg1, cfg);
      CacheContainer cm2 = TestCacheManagerFactory.createClusteredCacheManager(globalCfg2, cfg);
      registerCacheManager(cm1, cm2);
      defineConfigurationOnAllManagers(getCacheName(), cfg);
      waitForClusterToForm(getCacheName());
   }
View Full Code Here

     * @see org.jboss.msc.service.Service#start(org.jboss.msc.service.StartContext)
     */
    @Override
    public void start(StartContext context) throws StartException {

        CacheContainer container = this.getCacheContainer();

        // get an instance of the defined cache
        this.cache = container.getCache(this.name);
        this.cache.start();
    }
View Full Code Here

   public void testHashFunctionReturnsSameValues() {
      for (int i = 0; i < 1000; i++) {
         byte[] key = generateKey(i);
         TcpTransport transport = (TcpTransport) tcpConnectionFactory.getTransport(key, null);
         SocketAddress serverAddress = transport.getServerAddress();
         CacheContainer cacheContainer = hrServ2CacheManager.get(serverAddress);
         assertNotNull("For server address " + serverAddress + " found " + cacheContainer + ". Map is: " + hrServ2CacheManager, cacheContainer);
         DistributionManager distributionManager = cacheContainer.getCache().getAdvancedCache().getDistributionManager();
         Address clusterAddress = cacheContainer.getCache().getAdvancedCache().getRpcManager().getAddress();

         ConsistentHash serverCh = distributionManager.getReadConsistentHash();
         int numSegments = serverCh.getNumSegments();
         int keySegment = serverCh.getSegment(key);
         Address serverOwner = serverCh.locatePrimaryOwnerForSegment(keySegment);
View Full Code Here

      }
      return hitCountInterceptor;
   }

   protected void assertOnlyServerHit(SocketAddress serverAddress) {
      CacheContainer cacheContainer = hrServ2CacheManager.get(serverAddress);
      HitCountInterceptor interceptor = getHitCountInterceptor(cacheContainer.getCache());
      assert interceptor.getHits() == 1 : "Expected one hit but received " + interceptor.getHits();
      for (CacheContainer cm : hrServ2CacheManager.values()) {
         if (cm != cacheContainer) {
            interceptor = getHitCountInterceptor(cm.getCache());
            assert interceptor.getHits() == 0 : "Expected 0 hits but got " + interceptor.getHits();
View Full Code Here

      gcb1.globalJmxStatistics()
            .enable()
            .allowDuplicateDomains(true)
            .jmxDomain(JMX_DOMAIN)
            .mBeanServerLookup(new PerThreadMBeanServerLookup());
      CacheContainer cacheManager1 = TestCacheManagerFactory.createClusteredCacheManager(gcb1, defaultConfig,
            new TransportFlags(), true);
      cacheManager1.start();

      GlobalConfigurationBuilder gcb2 = GlobalConfigurationBuilder.defaultClusteredBuilder();
      gcb2.globalJmxStatistics()
            .enable()
            .allowDuplicateDomains(true)
            .jmxDomain(JMX_DOMAIN)
            .mBeanServerLookup(new PerThreadMBeanServerLookup());
      CacheContainer cacheManager2 = TestCacheManagerFactory.createClusteredCacheManager(gcb2, defaultConfig,
            new TransportFlags(), true);
      cacheManager2.start();

      registerCacheManager(cacheManager1, cacheManager2);

      ConfigurationBuilder cb = new ConfigurationBuilder();
      cb.clustering().cacheMode(CacheMode.REPL_SYNC).jmxStatistics().enable();
View Full Code Here

TOP

Related Classes of org.infinispan.manager.CacheContainer

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.