Package org.jboss.cache

Examples of org.jboss.cache.CacheFactory


      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

   private void buildCache(List<CustomInterceptorConfig> interceptorConfig)
   {
      Configuration config = new Configuration();
      config.setCacheMode(Configuration.CacheMode.LOCAL);
      config.setNodeLockingScheme(Configuration.NodeLockingScheme.MVCC);
      CacheFactory cacheFactory2 = new UnitTestCacheFactory<Object, Object>();
      CacheSPI tmpCacheSPI = (CacheSPI) cacheFactory2.createCache(config);
      defaultInterceptroCount = tmpCacheSPI.getInterceptorChain().size();
      tmpCacheSPI.stop();

      CacheFactory cacheFactory = new UnitTestCacheFactory<Object, Object>();
      config.setCustomInterceptors(interceptorConfig);
      cache = (CacheSPI) cacheFactory.createCache(config, true);
   }
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

   static boolean notificationsReceived = true;

   @BeforeMethod
   public void setUp() throws CloneNotSupportedException
   {
      CacheFactory cf = new UnitTestCacheFactory<Object, Object>();
      Configuration conf = new Configuration();
      conf.setCacheMode(Configuration.CacheMode.REPL_SYNC);
      BuddyReplicationConfig brc = new BuddyReplicationConfig();
      brc.setEnabled(true);
      conf.setBuddyReplicationConfig(brc);
     
      c1 = cf.createCache(conf, false);
      c2 = cf.createCache(conf.clone(), false);
      c3 = cf.createCache(conf.clone(), false);

      c1.start();
      c2.start();
      c3.start();
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

  }

  private Cache createCacheUseFilepathXML() {

    CacheFactory factory = new DefaultCacheFactory();
    Cache cache = factory.createCache(
        "/opt/configurations/cache-configuration.xml", false);
    Configuration config = cache.getConfiguration();
    config.setClusterName("Cluster Test");
    cache.create();
    cache.start();
View Full Code Here

    return cache;
  }

  private Cache createCacheUseClasspathXML() {

    CacheFactory factory = new DefaultCacheFactory();
    Cache cache = factory.createCache("cache-configuration.xml");

    return cache;
  }
View Full Code Here

TOP

Related Classes of org.jboss.cache.CacheFactory

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.