Package org.jboss.cache

Examples of org.jboss.cache.DefaultCacheFactory


      this.providerFactory = providerFactory;
   }

   public void start()
   {
      CacheFactory factory = new DefaultCacheFactory();
      ExpirationAlgorithmConfig exp = new ExpirationAlgorithmConfig();
      exp.setMaxNodes(maxSize);

      EvictionRegionConfig evictionRegionConfig = new EvictionRegionConfig(RegionManagerImpl.DEFAULT_REGION);
      evictionRegionConfig.setEvictionAlgorithmConfig(exp);

      EvictionConfig evictConfig = new EvictionConfig();
      evictConfig.setDefaultEvictionRegionConfig(evictionRegionConfig);
      evictConfig.setWakeupInterval(wakeupInterval);


      Configuration config = new Configuration();
      config.setCacheMode(Configuration.CacheMode.LOCAL);
      config.setEvictionConfig(evictConfig);

      cache = factory.createCache(config, true);

      ServerCacheHitInterceptor hit = new ServerCacheHitInterceptor(this);
      ServerCacheInterceptor interceptor = new ServerCacheInterceptor(this);

      getProviderFactory().getServerPreProcessInterceptorRegistry().register(hit);
View Full Code Here


   * @param mySessionFactory
   */
  private void registerAllJBossTreeCacheMBeans() {
      try {
        log.info("start to register all JBoss Treecache MBeans...");
        CacheFactory factory = new DefaultCacheFactory();
        Cache cache = factory.createCache("treecache.xml");
        ObjectName cacheObjectName = new ObjectName("jboss.cache:service=Cache");
        JmxRegistrationManager jmxRegistrationManager = new JmxRegistrationManager(server, cache, cacheObjectName );
        jmxRegistrationManager.registerAllMBeans();
        log.info("registered all JBoss Treecache MBeans");
      } catch (MalformedObjectNameException e) {
View Full Code Here

   {
      log.debug("Starting JBoss Cache");

      try
      {
         CacheFactory factory = new DefaultCacheFactory();
         cache = factory.createCache(getConfigurationAsStream());

         cache.create();
         cache.start();
      }
      catch (Exception e)
View Full Code Here

               {
                  log.warn("Unable to open config file for display", e);
               }
               configFileContents.repaint();

               cache = new DefaultCacheFactory().createCache(cacheConfigFile);
               isUsingBuddyReplication = cache.getConfiguration().getBuddyReplicationConfig() != null && cache.getConfiguration().getBuddyReplicationConfig().isEnabled();
            }
            else
            {
               cache.start();
View Full Code Here

      return c;
   }

   public void testSimpleStateTransfer() throws Exception
   {
      first = (CacheSPI) new DefaultCacheFactory().createCache(getConfiguration(0));
      first.put("/a/b/c", "key", "value");
      first.put("/a/b/d", "key", "value");
      first.put("/a/b/e", "key", "value");
      second = (CacheSPI) new DefaultCacheFactory().createCache(getConfiguration(2));
      assert second.get("/a/b/c","key").equals("value");
      assert second.get("/a/b/d","key").equals("value");
      assert second.get("/a/b/e","key").equals("value");
      JDBCCacheLoader cacheLoader = (JDBCCacheLoader) second.getCacheLoaderManager().getCacheLoader();
      assert cacheLoader.exists(Fqn.fromString("/a"));
View Full Code Here

   public void testMoreState() throws Exception
   {
      long startTime = System.currentTimeMillis();

      first = (CacheSPI) new DefaultCacheFactory().createCache(getConfiguration(0));
      long cacheStartTime = System.currentTimeMillis() - startTime;
      System.out.println("cacheStartTime = " + cacheStartTime);
      for (int i = 0; i < 5012; i++)
      {
         first.put("a/b/"+i, "k","v");
         if (i%1000 == 0) System.out.println(i + " operations executed so far");
      }
      startTime = System.currentTimeMillis();
      second = (CacheSPI) new DefaultCacheFactory().createCache(getConfiguration(2));

      long stateTranferTime = System.currentTimeMillis() - startTime - cacheStartTime;
      for (int i = 0; i < 5012; i+=100)
      {
         second.get("a/b/"+ i, "k").equals("v");
View Full Code Here

   @Test(enabled = false)
   public static void main(String[] args)
   {
      Configuration localConfig = UnitTestCacheConfigurationFactory.createConfiguration(Configuration.CacheMode.REPL_SYNC);
      localConfig.setExposeManagementStatistics(true);
      CacheFactory cacheFactory = new DefaultCacheFactory();
      Cache cache = cacheFactory.createCache(localConfig);
      JmxRegistrationManager regManager = new JmxRegistrationManager(cache);
      while (true){}
   }
View Full Code Here

    {
        String configResource = PropertiesHelper.getString(CACHE_RESOURCE_PROP, properties, null);
        if (configResource == null) {
          configResource = PropertiesHelper.getString(LEGACY_CACHE_RESOURCE_PROP, properties, DEFAULT_CACHE_RESOURCE);
        }
        return new DefaultCacheFactory().createCache(configResource, false);
    }
View Full Code Here

  private void batchTest() {
   
    Configuration config = new Configuration();
    config.setInvocationBatchingEnabled(true);
    CacheFactory factory = new DefaultCacheFactory();
    Cache cache = factory.createCache(config);
   
    cache.put("/a", "a", new Content("a"));
   
    cache.startBatch();
    cache.put("/b", "b", new Content("b"));
View Full Code Here

    config.setTransactionManagerLookupClass(GenericTransactionManagerLookup.class.getName());
    config.setIsolationLevel(IsolationLevel.READ_COMMITTED);
    config.setCacheMode(CacheMode.LOCAL);
    config.setLockAcquisitionTimeout(15000);
   
    CacheFactory factory = new DefaultCacheFactory();
    Cache cache = factory.createCache(config);
  }
View Full Code Here

TOP

Related Classes of org.jboss.cache.DefaultCacheFactory

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.