Package org.jboss.cache

Examples of org.jboss.cache.DefaultCacheFactory


   private Cache<String, String> createCache()
   {
      Configuration config = new Configuration();
      config.setCacheMode(Configuration.CacheMode.REPL_SYNC);
      CacheFactory<String, String> factory = new DefaultCacheFactory();
      Cache<String, String> cache = factory.createCache(config, false);
      caches.add(cache);

      return cache;
   }
View Full Code Here


      /*
       * Create a dummy CacheSPI object.  This is used for setting the cluster
       * name and TransactionManagerLookupClass (transactional) propertes only.
       * the CacheSPI object is not used otherwise during testing.
       */
      cache = (CacheSPI) new DefaultCacheFactory().createCache(false);
      cache.getConfiguration().setClusterName("myCluster");
      if (transactional)
      {
         cache.getConfiguration().setTransactionManagerLookupClass(
               "org.jboss.cache.transaction.DummyTransactionManagerLookup");
View Full Code Here

   public void setUp()
   {
      Configuration config = new Configuration();
      config.setCacheMode(Configuration.CacheMode.LOCAL);
      config.setTransactionManagerLookupClass(DummyTransactionManagerLookup.class.getName());
      CacheFactory<String, String> instance = new DefaultCacheFactory();
      cache = (CacheSPI<String, String>) instance.createCache(config);
      m = cache.getTransactionManager();
   }
View Full Code Here

   {
      // force a tear down if the test runner didn't run one before (happens in IDEA)
      if (cache1 != null || cache2 != null)
         tearDown();

      CacheFactory<String, String> instance = new DefaultCacheFactory();
      cache1 = (CacheSPI<String, String>) instance.createCache(false);
      cache1.getConfiguration().setClusterName("test");
      cache1.getConfiguration().setStateRetrievalTimeout(1000);
      cache1.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
      cache1.getConfiguration().setNodeLockingScheme(nodeLockingScheme);
      cache1.getConfiguration().setCacheMode(cacheMode);
      cache1.start();

      cache2 = (CacheSPI<String, String>) instance.createCache(false);
      cache2.getConfiguration().setClusterName("test");
      cache2.getConfiguration().setStateRetrievalTimeout(1000);
      cache2.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
      cache2.getConfiguration().setNodeLockingScheme(nodeLockingScheme);
      cache2.getConfiguration().setCacheMode(cacheMode);
View Full Code Here

      assertHasBeenInvalidated(cache2.getNode(fqn), "Should have been invalidated");
   }

   protected CacheSPI<Object, Object> createUnstartedCache(boolean optimistic) throws Exception
   {
      CacheSPI<Object, Object> cache = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(false);
      cache.getConfiguration().setClusterName("MyCluster");
      cache.getConfiguration().setStateRetrievalTimeout(3000);
      cache.getConfiguration().setCacheMode(Configuration.CacheMode.INVALIDATION_SYNC);
      if (optimistic) cache.getConfiguration().setNodeLockingScheme("OPTIMISTIC");
      cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
View Full Code Here

      }
      catch (NameNotFoundException n)
      {
         // expected
      }
      cache = (CacheSPI) new DefaultCacheFactory().createCache(false);
      cache.getConfiguration().setCacheMode("local");
      cache.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
      cache.getConfiguration().setCacheLoaderConfig(getCacheLoaderConfig(JNDI_NAME));
      cache.create();
View Full Code Here

      }

      cfg1.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");
      cfg2.setTransactionManagerLookupClass("org.jboss.cache.transaction.DummyTransactionManagerLookup");

      cache1 = new DefaultCacheFactory().createCache(cfg1, true);
      cache2 = new DefaultCacheFactory().createCache(cfg2, false);
      UserTransaction tx1 = (UserTransaction) new InitialContext(p).lookup("UserTransaction");
      writer = new Writer(cache1, tx1);
      try
      {
         writer.start();
View Full Code Here

      }
   }

   CacheSPI<Object, Object> createCache(IsolationLevel level) throws Exception
   {
      CacheSPI<Object, Object> c = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(false);
      c.getConfiguration().setClusterName("test");
      c.getConfiguration().setStateRetrievalTimeout(10000);
      c.getConfiguration().setTransactionManagerLookupClass("org.jboss.cache.transaction.GenericTransactionManagerLookup");
      c.getConfiguration().setLockAcquisitionTimeout(500);
      c.getConfiguration().setIsolationLevel(level);
View Full Code Here

      return mgr;
   }

   private void initCaches(Configuration.CacheMode caching_mode) throws Exception
   {
      cache1 = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(false);
      cache2 = (CacheSPI<Object, Object>) new DefaultCacheFactory().createCache(false);
      cache1.getConfiguration().setCacheMode(caching_mode);
      cache2.getConfiguration().setCacheMode(caching_mode);
      cache1.getConfiguration().setIsolationLevel(IsolationLevel.SERIALIZABLE);
      cache2.getConfiguration().setIsolationLevel(IsolationLevel.SERIALIZABLE);
View Full Code Here

    */
   private void _testConcurrentCommits(int num_threads)
   {
      Object myMutex = new Object();

      final CacheSPI c1 = (CacheSPI) new DefaultCacheFactory().createCache(false);
      final CacheSPI c2 = (CacheSPI) new DefaultCacheFactory().createCache(false);
      c1.getConfiguration().setClusterName("TempCluster");
      c2.getConfiguration().setClusterName("TempCluster");
      c1.getConfiguration().setCacheMode(Configuration.CacheMode.REPL_SYNC);
      c2.getConfiguration().setCacheMode(Configuration.CacheMode.REPL_SYNC);
      c1.getConfiguration().setSyncCommitPhase(true);
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.