Package org.jboss.cache.config

Examples of org.jboss.cache.config.Configuration


      synchronized (plainCaches)
      {
         cache = plainCaches.get(configName);
         if (cache == null && create)
         {
            Configuration config = configRegistry.getConfiguration(configName);
            if (channelFactory != null && config.getMultiplexerStack() != null)
            {
               config.getRuntimeConfig().setMuxChannelFactory(channelFactory);
            }
            cache = createCache(config);
            registerCache(cache, configName);
         }
         else if (cache != null)
View Full Code Here


        // Regions can get instantiated in the course of normal work (e.g.
        // a named query region will be created the first time the query is
        // executed), so suspend any ongoing tx
        Transaction tx = suspend();
        try {
            Configuration cfg = jbcCache.getConfiguration();
            if (cfg.isUseRegionBasedMarshalling()) {
                org.jboss.cache.Region jbcRegion = jbcCache.getRegion(regionFqn, true);
                ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
                if (classLoader == null) {
                    classLoader = getClass().getClassLoader();
                }
View Full Code Here

  
   private static Cache createCache(boolean local, String passivationDir,
         boolean totalReplication, boolean marshalling, boolean purgeCacheLoader)
   {
      Configuration cfg = getConfiguration(local, passivationDir, totalReplication, marshalling, purgeCacheLoader);
      return DefaultCacheFactory.getInstance().createCache(cfg, true);
   }
View Full Code Here

   }
  
   private static Configuration getConfiguration(boolean local, String passivationDir,
         boolean totalReplication, boolean marshalling, boolean purgeCacheLoader)
   {
      Configuration config = new Configuration();
      config.setClusterName("Tomcat-TestCluster");
      config.setTransactionManagerLookupClass(BatchModeTransactionManagerLookup.class.getName());
      config.setNodeLockingScheme(NodeLockingScheme.PESSIMISTIC);
      config.setIsolationLevel(IsolationLevel.REPEATABLE_READ);
      config.setSyncReplTimeout(20000);
      config.setLockAcquisitionTimeout(15000);
     
      config.setCacheMode(local ? CacheMode.LOCAL : CacheMode.REPL_SYNC);
     
      config.setUseRegionBasedMarshalling(marshalling);
      config.setInactiveOnStartup(marshalling);   
     
      // No async marshalling or notifications
      config.setSerializationExecutorPoolSize(0);
      config.setListenerAsyncPoolSize(0)
     
      // Block for commits -- no races between test driver and replication
      config.setSyncCommitPhase(true);
      config.setSyncRollbackPhase(true);
     
      if (passivationDir != null)
      {
         CacheLoaderConfig clc = new CacheLoaderConfig();
         clc.setPassivation(true);
         clc.setShared(false);
         FileCacheLoaderConfig fclc = new FileCacheLoaderConfig();
         fclc.setLocation(passivationDir);
         fclc.setFetchPersistentState(true);
         fclc.setPurgeOnStartup(purgeCacheLoader);
         fclc.setAsync(false);
         fclc.setIgnoreModifications(false);
         ArrayList<IndividualCacheLoaderConfig> iclcs = new ArrayList<IndividualCacheLoaderConfig>();
         iclcs.add(fclc);
         clc.setIndividualCacheLoaderConfigs(iclcs);
        
         config.setCacheLoaderConfig(clc);
      }
     
      if (!local && !totalReplication)
      {
         BuddyReplicationConfig brc = new BuddyReplicationConfig();
         brc.setEnabled(true);
         NextMemberBuddyLocatorConfig blc = new NextMemberBuddyLocatorConfig();
         blc.setNumBuddies(1);
         blc.setIgnoreColocatedBuddies(true);
         brc.setBuddyLocatorConfig(blc);
        
         brc.setBuddyPoolName("default");
         brc.setBuddyCommunicationTimeout(20000);
         brc.setAutoDataGravitation(false);
         brc.setDataGravitationRemoveOnFind(true);
         brc.setDataGravitationSearchBackupTrees(true);
        
         config.setBuddyReplicationConfig(brc);
      }
     
      return config;
   }
View Full Code Here

            else
            {
               // User did not try to configure the cache.
               // Configure it using defaults.  Only exception
               // is the clusterName, which user can specify in server.xml.
               Configuration config = new Configuration();
               String channelName = (clusterName == null) ? DEFAULT_CLUSTER_NAME
                                                          : clusterName;
               config.setClusterName(channelName);
               config.setIsolationLevel(DEFAULT_ISOLATION_LEVEL);
               config.setCacheMode(DEFAULT_CACHE_MODE);
               config.setLockAcquisitionTimeout(DEFAULT_LOCK_TIMEOUT);
               config.setTransactionManagerLookupClass(DEFAULT_TM_LOOKUP);
               pcWrapper = new CacheJmxWrapper(DefaultCacheFactory.getInstance().createCache(config, false));

            }
           
            if (server != null && objName != null)
View Full Code Here

      return cache;
   }

   public Configuration getConfiguration()
   {
      Configuration cfg = (cache == null ? config : cache.getConfiguration());
      if (cfg == null)
      {
         cfg = config = new Configuration();
      }
      return cfg;
   }
View Full Code Here

      return cfg;
   }

   public String printConfigurationAsString()
   {
      Configuration cfg = getConfiguration();
      return cfg == null ? "Configuration is null" : cfg.toString();
   }
View Full Code Here

      return cfg == null ? "Configuration is null" : cfg.toString();
   }

   public String printConfigurationAsHtmlString()
   {
      Configuration cfg = getConfiguration();
      return cfg == null ? "Configuration is null" : CachePrinter.formatHtml(cfg.toString());
   }
View Full Code Here

   // --------------------------------------------------------  Private methods

   private void injectMuxChannel() throws CacheException
   {
      Configuration cfg = getConfiguration();
      RuntimeConfig rtcfg = cfg.getRuntimeConfig();

      // Only inject if there isn't already a channel or factory
      if (rtcfg.getMuxChannelFactory() == null && rtcfg.getChannel() == null)
      {
         Channel ch;
         try
         {
            ch = multiplexerService.createMultiplexerChannel(cfg.getMultiplexerStack(), cfg.getClusterName());
         }
         catch (Exception e)
         {
            throw new CacheException("Exception creating multiplexed channel", e);
         }
View Full Code Here

      synchronized (plainCaches)
      {
         cache = plainCaches.get(configName);
         if (cache == null && create)
         {
            Configuration config = configRegistry.getConfiguration(configName);
            if (channelFactory != null && config.getMultiplexerStack() != null)
            {
               config.getRuntimeConfig().setMuxChannelFactory(channelFactory);
            }
            cache = createCache(config);
            registerCache(cache, configName);
         }
         else if (cache != null)
View Full Code Here

TOP

Related Classes of org.jboss.cache.config.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.