[jboss-cvs] JBossCache/src-50/org/jboss/cache/pojo/impl ...
Ben Wang
bwang at jboss.com
Mon Sep 18 22:32:02 EDT 2006
User: bwang
Date: 06/09/18 22:32:02
Modified: src-50/org/jboss/cache/pojo/impl PojoCacheImpl.java
Log:
1. added create and destroy lifecycle methods
2. add more option to create PojoCache
Revision Changes Path
1.21 +35 -5 JBossCache/src-50/org/jboss/cache/pojo/impl/PojoCacheImpl.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: PojoCacheImpl.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src-50/org/jboss/cache/pojo/impl/PojoCacheImpl.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- PojoCacheImpl.java 8 Sep 2006 07:52:20 -0000 1.20
+++ PojoCacheImpl.java 19 Sep 2006 02:32:02 -0000 1.21
@@ -43,7 +43,7 @@
* Implementation class for PojoCache interface
*
* @author Ben Wang
- * @version $Id: PojoCacheImpl.java,v 1.20 2006/09/08 07:52:20 bwang Exp $
+ * @version $Id: PojoCacheImpl.java,v 1.21 2006/09/19 02:32:02 bwang Exp $
*/
public class PojoCacheImpl implements PojoCache, Observer
{
@@ -75,18 +75,31 @@
XmlConfigurationParser parser = new XmlConfigurationParser();
Configuration expected = parser.parseFile( configStr );
- DefaultCacheFactory factory = new DefaultCacheFactory();
- cache_ = (CacheSPI)factory.createCache(expected, toStart);
+ init(expected, toStart);
} catch (Exception e)
{
e.printStackTrace();
throw new PojoCacheException("PojoTreeCache: " + e);
}
- init();
}
- private void init()
+ public PojoCacheImpl(Configuration config, boolean toStart)
+ {
+ init(config, toStart);
+ }
+
+ private void init(Configuration config, boolean toStart)
{
+ try
+ {
+ DefaultCacheFactory factory = new DefaultCacheFactory();
+ cache_ = (CacheSPI)factory.createCache(config, toStart);
+ } catch (Exception e)
+ {
+ e.printStackTrace();
+ throw new PojoCacheException("PojoTreeCache: " + e);
+ }
+
delegate_ = new PojoCacheDelegate(this, this);
}
@@ -211,6 +224,18 @@
return Version.printVersion();
}
+ public void create() throws PojoCacheException
+ {
+ log.info("PojoCache version: " + getVersion());
+ try
+ {
+ cache_.create();
+ } catch (Exception e)
+ {
+ throw new PojoCacheException("PojoCache create exception", e);
+ }
+ }
+
public void start() throws PojoCacheException
{
try
@@ -229,6 +254,11 @@
cache_.stop();
}
+ public void destroy() throws PojoCacheException
+ {
+ cache_.destroy();
+ }
+
public void addListener(PojoCacheListener listener)
{
// synchronize on listenrs just to
More information about the jboss-cvs-commits
mailing list