Package org.jboss.cache

Examples of org.jboss.cache.Cache


    cache.removeNode(helloWorldFqn);
  }

  private void cachingRetrieving() {

    Cache cache = createCacheUseDefault();
    Node rootNode = cache.getRoot();
    Fqn helloWorldFqn = Fqn.fromString("/root/helloWorld");
    Node helloWorld = rootNode.addChild(helloWorldFqn);
    helloWorld.put("isJBossCache", Boolean.TRUE);
    helloWorld.put("content", new Content("HelloWorld"));
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();

    return cache;
  }
View Full Code Here

  }

  private Cache createCacheUseClasspathXML() {

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

    return cache;
  }
View Full Code Here

  }

  private Cache createCacheUseDefault() {

    CacheFactory factory = new DefaultCacheFactory();
    Cache cache = factory.createCache();

    return cache;
  }
View Full Code Here

public class MyListenerTest {
 
  public void test() {
   
    CacheFactory factory = new DefaultCacheFactory();
    Cache cache = factory.createCache(false);
    MyListener myListener = new MyListener();
    cache.addCacheListener(myListener);
    System.out.println(cache.getCacheStatus());
    cache.start();
    System.out.println(cache.getCacheStatus());
   
    if(cache.getCacheStatus().equals(CacheStatus.STARTED)) {
      System.out.println("Yes");
    }
   
    StringBuffer sb = new StringBuffer();
    sb.append("JBossCache Info: \n");
    sb.append("  JBossCache Version: " + cache.getVersion() + "\n");
    sb.append("  JBossCache Status: " + cache.getCacheStatus() + "\n");
    sb.append("  JBossCache ClusterName: " + cache.getConfiguration().getClusterName() + "\n");
    sb.append("  JBossCache CacheMode: " + cache.getConfiguration().getCacheMode());
    System.out.println(sb.toString());
   
//    Node root = cache.getRoot();
//    Fqn abcFqn = Fqn.fromString("/a/b/c");
//    Node node = root.addChild(abcFqn);
View Full Code Here

  
   private void startEagerStartCaches() throws Exception
   {
      for (Map.Entry<String, Boolean> entry : startupCaches.entrySet())
      {
         Cache cache = null;
         if (entry.getValue().booleanValue())
         {
            PojoCache pc = getPojoCache(entry.getKey(), true);
            cache = pc.getCache();
         }
         else
         {
            cache = getCache(entry.getKey(), true);
         }
        
         if (cache.getCacheStatus() != CacheStatus.STARTED)
         {
            if (cache.getCacheStatus() != CacheStatus.CREATED)
            {
               cache.create();
            }
            cache.start();
         }
      }
   }
View Full Code Here

            throw new IllegalStateException("No clustered cache available");
         }
        
         try
         {
            Cache c = null;
            synchronized (cacheHandler)
            {
               c = cacheHandler.getCache();
               if (c == null)
               {
View Full Code Here

      return delegate.findAll(arg0);
   }

   public Cache<Object, Object> getCache()
   {
      Cache c = delegate.getCache();
      return c == null ? null : new CacheManagerManagedCache(c);
   }
View Full Code Here

         if (cacheHandler == null)
         {
            throw new IllegalStateException("No clustered cache available");
         }
        
         Cache c = null;
         synchronized (cacheHandler)
         {
            c = cacheHandler.getCache();
            if (c == null)
            {
View Full Code Here

    cacheNames = names;
  }

  public void getCaches(String cacheName) {
    Cache cache = null;
    try {
      if (cacheName != null) {
        CacheManager cm = CacheManagerLocator.getCacheManagerLocator()
            .getCacheManager(null);

        cache = cm.getCache(cacheName, true);

        listener = new MyListener();
        cache.addCacheListener(listener);

        cache.start();
      }

      caches.add(cache);
      System.out.println(cacheName);
    } catch (Exception e) {
View Full Code Here

TOP

Related Classes of org.jboss.cache.Cache

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.