second round of cache cleanups - got rid of that bogus pile of monkey spew

that was ReferenceCache, replaced it with the much cleaner ObjectCache (it
uses SoftReferences so that the "sweep" operation is pretty much automatic)
This commit is contained in:
Eric J. Bowersox
2001-11-15 00:30:24 +00:00
parent e290ce2a8c
commit 0437cc7b92
21 changed files with 536 additions and 595 deletions

View File

@@ -17,47 +17,134 @@
*/
package com.silverwrist.venice.core;
import java.io.PrintStream;
import java.io.PrintWriter;
public class InternalStateError extends RuntimeException
{
// Attributes
private Exception e = null; // internal "root cause" exception
/*--------------------------------------------------------------------------------
* Attributes
*--------------------------------------------------------------------------------
*/
private Throwable inner = null; // internal "root cause" exception
/*--------------------------------------------------------------------------------
* Constructors
*--------------------------------------------------------------------------------
*/
/**
* Constructs a new <CODE>InternalStateError</CODE>.
*/
public InternalStateError()
{
super();
} // end constructor
/**
* Constructs a new <CODE>InternalStateError</CODE> with a text message.
*
* @param msg The message to set in this exception.
*/
public InternalStateError(String msg)
{
super(msg);
} // end constructor
public InternalStateError(Exception e)
/**
* Constructs a new <CODE>InternalStateError</CODE> wrapping another exception.
*
* @param inner The exception wrapped by this one.
*/
public InternalStateError(Throwable inner)
{
super(e.getMessage());
this.e = e;
super(inner.getMessage());
this.inner = inner;
} // end constructor
public InternalStateError(String msg, Exception e)
/**
* Constructs a new <CODE>InternalStateError</CODE> wrapping another exception.
*
* @param msg The message to set in this exception.
* @param inner The exception wrapped by this one.
*/
public InternalStateError(String msg, Throwable inner)
{
super(msg);
this.e = e;
this.inner = inner;
} // end constructor
protected void finalize() throws Throwable
{
e = null;
super.finalize();
/*--------------------------------------------------------------------------------
* Overrides from class Throwable
*--------------------------------------------------------------------------------
*/
} // end finalize
public Exception getException()
/**
* Prints this exception and its backtrace to the standard error stream. Also prints the backtrace
* of any "wrapped" exception.
*
* @see java.lang.System#err
*/
public void printStackTrace()
{
return e;
this.printStackTrace(System.err);
} // end printStackTrace
/**
* Prints this exception and its backtrace to the specified <CODE>PrintStream</CODE>. Also prints the
* backtrace of any "wrapped" exception.
*
* @param s <CODE>PrintStream</CODE> to use for output.
*/
public void printStackTrace(PrintStream s)
{
super.printStackTrace(s);
if (inner!=null)
{ // print the inner stack trace
s.print("Root cause: ");
inner.printStackTrace(s);
} // end if
} // end printStackTrace
/**
* Prints this exception and its backtrace to the specified <CODE>PrintWriter</CODE>. Also prints the
* backtrace of any "wrapped" exception.
*
* @param s <CODE>PrintWriter</CODE> to use for output.
*/
public void printStackTrace(PrintWriter s)
{
super.printStackTrace(s);
if (inner!=null)
{ // print the inner stack trace
s.print("Root cause: ");
inner.printStackTrace(s);
} // end if
} // end printStackTrace
/*--------------------------------------------------------------------------------
* External operations
*--------------------------------------------------------------------------------
*/
/**
* Returns the exception wrapped by this exception, or <CODE>null</CODE> if there is none.
*
* @return See above.
*/
public Throwable getException()
{
return inner;
} // end getException

View File

@@ -21,7 +21,7 @@ import java.sql.*;
import java.util.*;
import org.apache.log4j.*;
import com.silverwrist.util.ParallelRunQueue;
import com.silverwrist.util.rcache.ReferenceCache;
import com.silverwrist.util.cache.ObjectCache;
import com.silverwrist.venice.db.*;
import com.silverwrist.venice.core.DataException;
import com.silverwrist.venice.core.InternalStateError;
@@ -46,7 +46,7 @@ class BackgroundCommunityPurge implements Runnable
private int cid;
private int num_confs;
private int max_confid;
private ReferenceCache conf_refcache;
private ObjectCache conf_objcache;
/*--------------------------------------------------------------------------------
* Constructor
@@ -54,7 +54,7 @@ class BackgroundCommunityPurge implements Runnable
*/
BackgroundCommunityPurge(EngineBackend engine, DataPool datapool, UserBackend user, int cid, int num_confs,
int max_confid, ReferenceCache conf_refcache)
int max_confid, ObjectCache conf_objcache)
{
this.engine = engine;
this.datapool = datapool;
@@ -62,7 +62,7 @@ class BackgroundCommunityPurge implements Runnable
this.cid = cid;
this.num_confs = num_confs;
this.max_confid = max_confid;
this.conf_refcache = conf_refcache;
this.conf_objcache = conf_objcache;
} // end constructor
@@ -102,12 +102,11 @@ class BackgroundCommunityPurge implements Runnable
for (int i=0; i<conferences; i++)
{ // look to see if there's a conference community object first
Integer key = new Integer(conf_ids[i]);
ConferenceCommunityContext confobj = (ConferenceCommunityContext)(conf_refcache.get(key));
ConferenceCommunityContext confobj = (ConferenceCommunityContext)(conf_objcache.get(key));
if (confobj!=null)
{ // OK, there's an object - do the delete internally and release the object
conf_refcache.detach(key);
conf_objcache.detach(key);
confobj.delete(user);
confobj.rd_release();
} // end if
else

View File

@@ -22,7 +22,7 @@ import java.util.*;
import org.apache.log4j.*;
import com.silverwrist.util.OptionSet;
import com.silverwrist.util.StringUtil;
import com.silverwrist.util.rcache.*;
import com.silverwrist.util.cache.*;
import com.silverwrist.venice.db.*;
import com.silverwrist.venice.core.*;
import com.silverwrist.venice.security.AuditRecord;
@@ -36,13 +36,13 @@ class CommunityCoreData implements CommunityData, CommunityDataBackend
*--------------------------------------------------------------------------------
*/
protected class ConferenceCommunityContextImplCreator implements ReferencedDataBuilder
protected class ConferenceCommunityContextImplCreator implements ObjectFactory
{
protected ConferenceCommunityContextImplCreator()
{ // do nothing
} // end constructor
public ReferencedData build(Object key) throws ReferencedDataBuilderException
public Object newObject(Object key) throws ObjectFactoryException
{
Integer xconf = (Integer)key;
try
@@ -52,7 +52,7 @@ class CommunityCoreData implements CommunityData, CommunityDataBackend
} // end try
catch (DataException e)
{ // rethrow as a "wrapped" exception
throw new ReferencedDataBuilderException(e);
throw new ObjectFactoryException(e);
} // end catch
@@ -77,7 +77,6 @@ class CommunityCoreData implements CommunityData, CommunityDataBackend
*--------------------------------------------------------------------------------
*/
private int refcount = 1; // object reference count
private EngineBackend engine; // pointer to engine back end
private DataPool datapool; // pointer to data pool
private int cid; // ID of this community
@@ -104,8 +103,7 @@ class CommunityCoreData implements CommunityData, CommunityDataBackend
private String alias; // the community alias value
private boolean public_comm; // is this a public community?
private BitSet features; // set of available features
private ReferenceCache conf_refcache = new ReferenceCache();
private ConferenceCommunityContextImplCreator conf_creator = new ConferenceCommunityContextImplCreator();
private ObjectCache conf_objcache = new ObjectCache(new ConferenceCommunityContextImplCreator());
private boolean deleted = false; // has this community been deleted?
private OptionSet flags; // property flags
@@ -369,35 +367,6 @@ class CommunityCoreData implements CommunityData, CommunityDataBackend
} // end storeProperties
/*--------------------------------------------------------------------------------
* Implementations from interface ReferencedData
*--------------------------------------------------------------------------------
*/
public int rd_addRef()
{
return ++refcount;
} // end rd_addRef()
public int rd_release()
{
return --refcount;
} // end rd_release
public boolean rd_unreferenced()
{
return (refcount<=0);
} // end rd_unreferenced
public Object rd_getKey()
{
return new Integer(cid);
} // end rd_getKey
/*--------------------------------------------------------------------------------
* Implementations from interface CommunityData
*--------------------------------------------------------------------------------
@@ -1535,13 +1504,13 @@ class CommunityCoreData implements CommunityData, CommunityDataBackend
logger.debug("getConferenceDataObject(" + confid + ")...");
try
{ // delegate to the conf_refcache and conf_creator objects
return (ConferenceCommunityContext)(conf_refcache.getOrCreate(new Integer(confid),conf_creator));
{ // delegate to the conf_objcache object
return (ConferenceCommunityContext)(conf_objcache.getOrCreate(new Integer(confid)));
} // end try
catch (ReferencedDataBuilderException e)
catch (ObjectFactoryException e)
{ // this may be a DataException, or it may not
Exception e2 = e.getTarget();
Throwable e2 = e.getException();
if (e2 instanceof DataException)
throw (DataException)e2;
else
@@ -1557,7 +1526,7 @@ class CommunityCoreData implements CommunityData, CommunityDataBackend
if (logger.isDebugEnabled())
logger.debug("detachConferenceDataObject(" + confid + ")...");
conf_refcache.detach(new Integer(confid));
conf_objcache.detach(new Integer(confid));
} // end detachConferenceDataObject
@@ -1578,10 +1547,9 @@ class CommunityCoreData implements CommunityData, CommunityDataBackend
// extra reference on it.
ConferenceCommunityContextImpl conf =
new ConferenceCommunityContextImpl(engine,this,datapool,rcs.getSequence(),hide_list,cdata);
cdata.rd_release();
rcs = null;
conf_refcache.register(conf); // register this object with our local cache
conf_objcache.register(new Integer(conf.getConfID()),conf); // register this object with our local cache
return conf; // pass it up to the next level
@@ -1976,19 +1944,13 @@ class CommunityCoreData implements CommunityData, CommunityDataBackend
// Delete the rest of the gunk in the background; use another thread to do it.
BackgroundCommunityPurge purger = new BackgroundCommunityPurge(engine,datapool,user,cid,conf_count,
conf_max,conf_refcache);
conf_max,conf_objcache);
Thread thrd = new Thread(purger);
thrd.setPriority(Thread.NORM_PRIORITY-1);
thrd.start();
} // end delete
public void sweepCache()
{
conf_refcache.sweep();
} // end sweepCache
public CommunityProperties getProperties()
{
return createProperties();

View File

@@ -20,13 +20,12 @@ package com.silverwrist.venice.core.impl;
import java.util.BitSet;
import java.util.Date;
import java.util.List;
import com.silverwrist.util.rcache.ReferencedData;
import com.silverwrist.venice.core.AccessError;
import com.silverwrist.venice.core.CommunityProperties;
import com.silverwrist.venice.core.ContactInfo;
import com.silverwrist.venice.core.DataException;
public interface CommunityData extends ReferencedData
public interface CommunityData
{
public abstract int getID();
@@ -153,8 +152,6 @@ public interface CommunityData extends ReferencedData
public abstract void delete(UserBackend user) throws DataException;
public abstract void sweepCache();
public abstract CommunityProperties getProperties();
public abstract void setProperties(CommunityProperties props) throws DataException;

View File

@@ -21,7 +21,6 @@ import java.sql.*;
import java.util.*;
import org.apache.log4j.*;
import com.silverwrist.util.StringUtil;
import com.silverwrist.util.rcache.ReferencedData;
import com.silverwrist.venice.db.*;
import com.silverwrist.venice.security.AuditRecord;
import com.silverwrist.venice.security.Capability;
@@ -130,29 +129,11 @@ class CommunityUserContextImpl implements CommunityContext, CommunityBackend
this.datapool = datapool;
this.cid = data.getID();
this.cache = null; // no cache required - we have the CommunityData
data.rd_addRef();
this.data = data;
setMemberValues(DefaultLevels.creatorCommunity(),true,true);
} // end constructor
/*--------------------------------------------------------------------------------
* finalize() function
*--------------------------------------------------------------------------------
*/
protected void finalize()
{
if (data!=null)
data.rd_release();
engine = null;
user = null;
datapool = null;
cache = null;
data = null;
} // end finalize
/*--------------------------------------------------------------------------------
* Internal functions
*--------------------------------------------------------------------------------
@@ -1102,19 +1083,7 @@ class CommunityUserContextImpl implements CommunityContext, CommunityBackend
ConferenceCommunityContext cdata = getData().createConference(this,name,alias,description,pvt,hide_list);
// wrap the returned object in a conference user context object and release the extra reference
ConferenceUserContextImpl rc;
try
{ // need to wrap this 'cos it can throw DataException
rc = new ConferenceUserContextImpl(engine,this,datapool,cdata);
} // end try
finally
{ // make sure to release that extra reference before we go
cdata.rd_release();
} // end finally
return rc;
return new ConferenceUserContextImpl(engine,this,datapool,cdata);
} // end createConference
@@ -1226,7 +1195,6 @@ class CommunityUserContextImpl implements CommunityContext, CommunityBackend
// detach our references from the lower-level object
data = null;
my_comm.rd_release();
} // end delete
@@ -1444,7 +1412,7 @@ class CommunityUserContextImpl implements CommunityContext, CommunityBackend
} // end realFullName
public void saveMRU(String tag, ReferencedData data)
public void saveMRU(String tag, Object data)
{
user.saveMRU(tag,data);

View File

@@ -20,11 +20,10 @@ package com.silverwrist.venice.core.impl;
import java.sql.Connection;
import java.util.Date;
import java.util.List;
import com.silverwrist.util.rcache.ReferencedData;
import com.silverwrist.venice.core.ConferenceProperties;
import com.silverwrist.venice.core.DataException;
public interface ConferenceCommunityContext extends ReferencedData
public interface ConferenceCommunityContext
{
public abstract int getConfID();

View File

@@ -78,7 +78,6 @@ class ConferenceCommunityContextImpl implements ConferenceCommunityContext
*--------------------------------------------------------------------------------
*/
private int refcount = 1; // reference count (within the CommunityData)
private EngineBackend engine; // engine object reference
private CommunityDataBackend comm; // community object reference
private DataPool datapool; // data pool object
@@ -166,28 +165,10 @@ class ConferenceCommunityContextImpl implements ConferenceCommunityContext
this.sequence = sequence;
this.hide_list = hide_list;
this.cache = null;
cdata.rd_addRef();
this.confdata = cdata;
} // end constructor
/*--------------------------------------------------------------------------------
* finalize() function
*--------------------------------------------------------------------------------
*/
protected void finalize()
{
if (confdata!=null)
confdata.rd_release();
confdata = null;
engine = null;
comm = null;
datapool = null;
cache = null;
} // end finalize
/*--------------------------------------------------------------------------------
* Internal functions
*--------------------------------------------------------------------------------
@@ -238,35 +219,6 @@ class ConferenceCommunityContextImpl implements ConferenceCommunityContext
} // end getConferenceDataNE
/*--------------------------------------------------------------------------------
* Implementations from interface ReferencedData
*--------------------------------------------------------------------------------
*/
public int rd_addRef()
{
return ++refcount;
} // end rd_addRef
public int rd_release()
{
return --refcount;
} // end rd_release
public boolean rd_unreferenced()
{
return (refcount<=0);
} // end rd_unreferences
public Object rd_getKey()
{
return new Integer(confid);
} // end rd_getKey
/*--------------------------------------------------------------------------------
* Implementations from interface ConferenceCommunityContext
*--------------------------------------------------------------------------------
@@ -829,7 +781,6 @@ class ConferenceCommunityContextImpl implements ConferenceCommunityContext
// detach our own reference from the lower-level object
confdata = null;
c.rd_release();
} // end delete

View File

@@ -48,7 +48,6 @@ class ConferenceCoreData implements ConferenceData
*--------------------------------------------------------------------------------
*/
private int refcount = 1; // object reference count
private EngineBackend engine; // pointer to engine back end
private DataPool datapool; // pointer to data pool
private int confid; // ID of this conference
@@ -274,35 +273,6 @@ class ConferenceCoreData implements ConferenceData
} // end storeProperties
/*--------------------------------------------------------------------------------
* Implementations from interface ReferencedData
*--------------------------------------------------------------------------------
*/
public int rd_addRef()
{
return ++refcount;
} // end rd_addRef()
public int rd_release()
{
return --refcount;
} // end rd_release
public boolean rd_unreferenced()
{
return (refcount<=0);
} // end rd_unreferenced
public Object rd_getKey()
{
return new Integer(confid);
} // end rd_getKey
/*--------------------------------------------------------------------------------
* Implementations from interface ConferenceData
*--------------------------------------------------------------------------------

View File

@@ -20,11 +20,10 @@ package com.silverwrist.venice.core.impl;
import java.sql.Connection;
import java.util.Date;
import java.util.List;
import com.silverwrist.util.rcache.ReferencedData;
import com.silverwrist.venice.core.ConferenceProperties;
import com.silverwrist.venice.core.DataException;
public interface ConferenceData extends ReferencedData
public interface ConferenceData
{
public abstract int getID();

View File

@@ -20,7 +20,6 @@ package com.silverwrist.venice.core.impl;
import java.sql.*;
import java.util.*;
import org.apache.log4j.*;
import com.silverwrist.util.rcache.ReferencedData;
import com.silverwrist.venice.db.*;
import com.silverwrist.venice.htmlcheck.*;
import com.silverwrist.venice.security.DefaultLevels;
@@ -202,7 +201,6 @@ class ConferenceUserContextImpl implements ConferenceContext, ConferenceBackend
this.datapool = datapool;
this.confid = cdata.getConfID();
this.cache = null;
cdata.rd_addRef();
this.confdata = cdata;
recalcLevel(DefaultLevels.hostConference());
this.pseud = comm.userDefaultPseud();
@@ -211,23 +209,6 @@ class ConferenceUserContextImpl implements ConferenceContext, ConferenceBackend
} // end constructor
/*--------------------------------------------------------------------------------
* finalize() function
*--------------------------------------------------------------------------------
*/
protected void finalize()
{
if (confdata!=null)
confdata.rd_release();
engine = null;
comm = null;
datapool = null;
cache = null;
confdata = null;
} // end finalize
/*--------------------------------------------------------------------------------
* Internal functions
*--------------------------------------------------------------------------------
@@ -1261,7 +1242,6 @@ class ConferenceUserContextImpl implements ConferenceContext, ConferenceBackend
// detach our references from the lower-level object
confdata = null;
ctxt.rd_release();
} // end delete
@@ -1532,7 +1512,7 @@ class ConferenceUserContextImpl implements ConferenceContext, ConferenceBackend
} // end realFullName
public void saveMRU(String tag, ReferencedData data)
public void saveMRU(String tag, Object data)
{
comm.saveMRU(tag,data);

View File

@@ -17,7 +17,6 @@
*/
package com.silverwrist.venice.core.impl;
import com.silverwrist.util.rcache.ReferencedData;
import com.silverwrist.venice.core.DataException;
public interface UserBackend
@@ -38,6 +37,6 @@ public interface UserBackend
public abstract String realFullName() throws DataException;
public abstract void saveMRU(String tag, ReferencedData data);
public abstract void saveMRU(String tag, Object data);
} // end interface UserBackend

View File

@@ -23,7 +23,6 @@ import org.apache.log4j.*;
import com.silverwrist.util.LocaleFactory;
import com.silverwrist.util.OptionSet;
import com.silverwrist.util.StringUtil;
import com.silverwrist.util.rcache.ReferencedData;
import com.silverwrist.venice.*;
import com.silverwrist.venice.core.*;
import com.silverwrist.venice.db.*;
@@ -75,7 +74,7 @@ class UserContextImpl implements UserContext, UserBackend
private String full_name = null; // my full name (cached)
private Locale my_locale = null; // my default locale (cached)
private TimeZone my_tz = null; // my default timezone (cached)
private HashMap mru_cache = new HashMap(); // MRU cache for ReferencedData objects
private HashMap mru_cache = new HashMap(); // MRU cache for data objects
private OptionSet flags = null; // option flags
/*--------------------------------------------------------------------------------
@@ -90,35 +89,6 @@ class UserContextImpl implements UserContext, UserBackend
} // end constructor
/*--------------------------------------------------------------------------------
* finalize() method
*--------------------------------------------------------------------------------
*/
protected void finalize()
{
Iterator it = mru_cache.values().iterator();
while (it.hasNext())
{ // release all our ReferencedData objects
ReferencedData rd = (ReferencedData)(it.next());
rd.rd_release();
} // end while
engine = null;
datapool = null;
username = null;
created = null;
last_access = null;
description = null;
my_email = null;
my_pseud = null;
full_name = null;
my_locale = null;
my_tz = null;
} // end finalize
/*--------------------------------------------------------------------------------
* Internal functions
*--------------------------------------------------------------------------------
@@ -1039,8 +1009,6 @@ class UserContextImpl implements UserContext, UserBackend
// Create the community context we return to the user.
CommunityContext rc = new CommunityUserContextImpl(engine,this,datapool,new_comm);
new_comm.rd_release(); // release the extra reference we have on CommunityData
// And that's it! You expected lightning bolts maybe? :-)
return rc;
@@ -1604,13 +1572,9 @@ class UserContextImpl implements UserContext, UserBackend
} // end realFullName
public void saveMRU(String tag, ReferencedData data)
public void saveMRU(String tag, Object data)
{
ReferencedData old = (ReferencedData)(mru_cache.get(tag));
data.rd_addRef();
mru_cache.put(tag,data);
if (old!=null)
old.rd_release();
} // end saveMRU

View File

@@ -25,7 +25,7 @@ import org.w3c.dom.*;
import com.silverwrist.util.OptionSet;
import com.silverwrist.util.StringUtil;
import com.silverwrist.util.DOMElementHelper;
import com.silverwrist.util.rcache.*;
import com.silverwrist.util.cache.*;
import com.silverwrist.venice.core.*;
import com.silverwrist.venice.db.*;
import com.silverwrist.venice.htmlcheck.*;
@@ -312,58 +312,18 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
} // end class MasterSideBoxList
/*--------------------------------------------------------------------------------
* Internal cache sweeper class information.
*--------------------------------------------------------------------------------
*/
protected class CacheSweeper implements Runnable
{
public void run()
{
for (;;)
{ // this is a background thread that runs always
try
{ // wait for a little while
Thread.sleep(10000);
} // end try
catch (InterruptedException e)
{ // if we're interrupted, just schedule the next run a little early
} // end catch
// sweep the community cache first
List comms = comm_refcache.sweepReturn();
Iterator it = comms.iterator();
while (it.hasNext())
{ // perform subsweeps on the community data
CommunityData comm = (CommunityData)(it.next());
comm.sweepCache();
comm.rd_release();
} // end while
// now sweep other caches
conf_refcache.sweep();
} // end for (ever)
} // end run
} // end class CacheSweeper
/*--------------------------------------------------------------------------------
* Internal class for creating new CommunityCoreData objects.
*--------------------------------------------------------------------------------
*/
protected class CommunityCoreDataCreator implements ReferencedDataBuilder
protected class CommunityCoreDataCreator implements ObjectFactory
{
protected CommunityCoreDataCreator()
{ // do nothing
} // end constructor
public ReferencedData build(Object key) throws ReferencedDataBuilderException
public Object newObject(Object key) throws ObjectFactoryException
{
Integer xcid = (Integer)key;
try
@@ -373,7 +333,7 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
} // end try
catch (DataException e)
{ // rethrow as a "wrapped" exception
throw new ReferencedDataBuilderException(e);
throw new ObjectFactoryException(e);
} // end catch
@@ -386,13 +346,13 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
*--------------------------------------------------------------------------------
*/
protected class ConferenceCoreDataCreator implements ReferencedDataBuilder
protected class ConferenceCoreDataCreator implements ObjectFactory
{
protected ConferenceCoreDataCreator()
{ // do nothing
} // end constructor
public ReferencedData build(Object key) throws ReferencedDataBuilderException
public Object newObject(Object key) throws ObjectFactoryException
{
Integer xconf = (Integer)key;
try
@@ -402,7 +362,7 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
} // end try
catch (DataException e)
{ // rethrow as a "wrapped" exception
throw new ReferencedDataBuilderException(e);
throw new ObjectFactoryException(e);
} // end catch
@@ -501,12 +461,10 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
private Properties email_props = null; // email properties
private javax.mail.Session mailsession = null; // email session object
private Hashtable stock_messages = null; // stock messages holder
private ReferenceCache comm_refcache = new ReferenceCache();
private CommunityCoreDataCreator comm_creator = new CommunityCoreDataCreator();
private ObjectCache comm_objcache = new ObjectCache(new CommunityCoreDataCreator());
private VeniceFeatureDef[] features; // master feature table
private Hashtable feature_syms = new Hashtable(); // hashtable mapping symbols to features
private ReferenceCache conf_refcache = new ReferenceCache();
private ConferenceCoreDataCreator conf_creator = new ConferenceCoreDataCreator();
private ObjectCache conf_objcache = new ObjectCache(new ConferenceCoreDataCreator());
private HTMLCheckerConfig[] html_configs; // holder for HTML checker configurations
private int[] gp_ints; // global integer parameters
private MasterSideBox[] sideboxes; // master sidebox table
@@ -1084,12 +1042,6 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
cfg.addOutputFilter(html_filter);
html_configs[HTMLC_ESCAPE_BODY_PSEUD] = cfg;
// Start the cache sweeper.
Thread thrd = new Thread(new CacheSweeper());
thrd.setPriority(Thread.currentThread().getPriority()-2);
thrd.setDaemon(true);
thrd.start();
if (logger.isDebugEnabled())
logger.debug("initialize() complete :-)");
@@ -2144,13 +2096,13 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
logger.debug("getCommunityDataObject(" + cid + ")...");
try
{ // delegate to the comm_refcache and comm_creator objects
return (CommunityData)(comm_refcache.getOrCreate(new Integer(cid),comm_creator));
{ // delegate to the comm_objcache object
return (CommunityData)(comm_objcache.getOrCreate(new Integer(cid)));
} // end try
catch (ReferencedDataBuilderException e)
catch (ObjectFactoryException e)
{ // this may be a DataException, or it may not
Exception e2 = e.getTarget();
Throwable e2 = e.getException();
if (e2 instanceof DataException)
throw (DataException)e2;
else
@@ -2167,7 +2119,7 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
if (logger.isDebugEnabled())
logger.debug("detachCommunityDataObject(" + cid + ")...");
comm_refcache.detach(new Integer(cid));
comm_objcache.detach(new Integer(cid));
} // end detachCommunityDataObject
@@ -2255,7 +2207,7 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
if (logger.isDebugEnabled())
logger.debug("registerNewCommunity(" + comm.getID() + ")...");
comm_refcache.register(comm);
comm_objcache.register(new Integer(comm.getID()),comm);
} // end registerNewCommunity
@@ -2286,13 +2238,13 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
logger.debug("getConferenceDataObject(" + confid + ")...");
try
{ // delegate to the conf_refcache and conf_creator objects
return (ConferenceData)(conf_refcache.getOrCreate(new Integer(confid),conf_creator));
{ // delegate to the conf_objcache objects
return (ConferenceData)(conf_objcache.getOrCreate(new Integer(confid)));
} // end try
catch (ReferencedDataBuilderException e)
catch (ObjectFactoryException e)
{ // this may be a DataException, or it may not
Exception e2 = e.getTarget();
Throwable e2 = e.getException();
if (e2 instanceof DataException)
throw (DataException)e2;
else
@@ -2309,7 +2261,7 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
if (logger.isDebugEnabled())
logger.debug("detachConferenceDataObject(" + confid + ")...");
conf_refcache.detach(new Integer(confid));
conf_objcache.detach(new Integer(confid));
} // end detachConferenceDataObject
@@ -2347,7 +2299,7 @@ public class VeniceEngineImpl implements VeniceEngine, EngineBackend
if (logger.isDebugEnabled())
logger.debug("registerNewConference(" + conf.getID() + ")...");
conf_refcache.register(conf);
conf_objcache.register(new Integer(conf.getID()),conf);
} // end registerNewConference