[jboss-cvs] CacheBenchFwk/cache-products/jbosscache-2.0.0/src/org/cachebench/cachewrappers ...

Manik Surtani manik at jboss.org
Thu May 17 04:13:45 EDT 2007


  User: msurtani
  Date: 07/05/17 04:13:45

  Added:       cache-products/jbosscache-2.0.0/src/org/cachebench/cachewrappers 
                        JBossCache200Wrapper.java
  Log:
  fixed stuff
  
  Revision  Changes    Path
  1.1      date: 2007/05/17 08:13:45;  author: msurtani;  state: Exp;CacheBenchFwk/cache-products/jbosscache-2.0.0/src/org/cachebench/cachewrappers/JBossCache200Wrapper.java
  
  Index: JBossCache200Wrapper.java
  ===================================================================
  package org.cachebench.cachewrappers;
  
  import org.cachebench.CacheWrapper;
  import org.jboss.cache.Cache;
  import org.jboss.cache.DefaultCacheFactory;
  import org.jboss.cache.Fqn;
  
  import java.util.Properties;
  
  public class JBossCache200Wrapper implements CacheWrapper
  {
     private Cache cache;
  
     public void init(Properties parameters) throws Exception
     {
        cache = DefaultCacheFactory.getInstance().createCache(parameters.getProperty("config"));
     }
  
     public void setUp() throws Exception
     {
     }
  
     public void tearDown() throws Exception
     {
     }
  
     public void put(Object key, Object value) throws Exception
     {
        // make sure the threads don't conflict!
        Fqn f = Fqn.fromString("/" + Thread.currentThread().getName() + "/" + key);
        cache.put(f, key, value);
     }
  
     public Object get(Object key) throws Exception
     {
        Fqn f = Fqn.fromString("/" + Thread.currentThread().getName() + "/" + key);
        return cache.get(f, key);
     }
  
     public void empty() throws Exception
     {
        cache.removeNode(Fqn.ROOT);
     }
  
     public int getNumMembers()
     {
        return cache.getMembers().size();
     }
  
     public String getInfo()
     {
        return "Num direct children: " + cache.getRoot().getChildren().size();
     }
  
  }
  
  
  



More information about the jboss-cvs-commits mailing list