[jboss-cvs] CacheBenchFwk/cache-products/jbosscache-1.4.1/src/org/cachebench/cachewrappers ...
Manik Surtani
manik at jboss.org
Thu May 17 04:13:46 EDT 2007
User: msurtani
Date: 07/05/17 04:13:46
Added: cache-products/jbosscache-1.4.1/src/org/cachebench/cachewrappers
JBossCacheWrapper.java
Log:
fixed stuff
Revision Changes Path
1.1 date: 2007/05/17 08:13:46; author: msurtani; state: Exp;CacheBenchFwk/cache-products/jbosscache-1.4.1/src/org/cachebench/cachewrappers/JBossCacheWrapper.java
Index: JBossCacheWrapper.java
===================================================================
package org.cachebench.cachewrappers;
import org.cachebench.CacheWrapper;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.PropertyConfigurator;
import org.jboss.cache.TreeCache;
import java.util.Properties;
import java.util.HashMap;
/**
* An implementation of CacheWrapper that uses JBossCache as an underlying implementation.
*
* @author Manik Surtani (manik at surtani.org)
* @version $Id: JBossCacheWrapper.java,v 1.1 2007/05/17 08:13:46 msurtani Exp $
*/
public class JBossCacheWrapper implements CacheWrapper
{
private TreeCache tree;
private Log log = LogFactory.getLog("org.cachebench.cachewrappers.JBossCacheWrapper");
public void init(Properties parameters) throws Exception
{
log.debug("Initializing the cache");
//parameters.
tree = new TreeCache();
PropertyConfigurator conf = new PropertyConfigurator();
conf.configure( tree, parameters.getProperty("config") );
}
public void setUp() throws Exception
{
tree.createService(); // not necessary, but is same as MBean lifecycle
tree.startService(); // kick start tree cache
}
public void tearDown() throws Exception
{
tree.stopService();
tree.destroyService();
}
public void put(Object key, Object value) throws Exception
{
HashMap map = new HashMap(1);
map.put( key, value );
tree.put(key.toString(), map);
}
public Object get(Object key) throws Exception
{
return tree.get( key.toString() );
}
public void empty() throws Exception
{
tree.remove("/");
}
public int getNumMembers()
{
return tree.getMembers().size();
}
public String getInfo()
{
return tree.printDetails();
}
}
More information about the jboss-cvs-commits
mailing list