org.apache.jcs.auxiliary.disk.jdbc
Class JDBCDiskCacheManagerAbstractTemplate

java.lang.Object
  extended by org.apache.jcs.auxiliary.disk.AbstractDiskCacheManager
      extended by org.apache.jcs.auxiliary.disk.jdbc.JDBCDiskCacheManagerAbstractTemplate
All Implemented Interfaces:
Serializable, AuxiliaryCacheManager, ICacheType
Direct Known Subclasses:
JDBCDiskCacheManager, MySQLDiskCacheManager

public abstract class JDBCDiskCacheManagerAbstractTemplate
extends AbstractDiskCacheManager

This class serves as an abstract template for JDBCDiskCache Manager. The MySQL JDBC Disk Cache needs many of the same features as the generic manager.

Author:
Aaron Smuts
See Also:
Serialized Form

Field Summary
protected static Hashtable caches
          A map of JDBCDiskCache objects to region names.
protected static int clients
          Incremented on getIntance, decremented on release.
protected static Hashtable tableStates
          A map of TableState objects to table names.
 
Fields inherited from interface org.apache.jcs.engine.behavior.ICacheType
CACHE_HUB, DISK_CACHE, LATERAL_CACHE, REMOTE_CACHE
 
Constructor Summary
JDBCDiskCacheManagerAbstractTemplate()
           
 
Method Summary
protected abstract  AuxiliaryCache createJDBCDiskCache(JDBCDiskCacheAttributes cattr, TableState tableState)
          Children must implement this method.
protected  void createShrinkerWhenNeeded(JDBCDiskCacheAttributes cattr, AuxiliaryCache raf)
          If UseDiskShrinker is true then we will create a shrinker daemon if necessary.
 void freeCache(String name)
           
 AuxiliaryCache getCache(JDBCDiskCacheAttributes cattr)
          Creates a JDBCDiskCache for the region if one doesn't exist, else it returns the precreated instance.
 int getCacheType()
          Gets the cacheType attribute of the HSQLCacheManager object
 void release()
          Disposes of all regions.
 
Methods inherited from class org.apache.jcs.auxiliary.disk.AbstractDiskCacheManager
getCacheEventLogger, getElementSerializer, setCacheEventLogger, setElementSerializer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.jcs.auxiliary.AuxiliaryCacheManager
getCache
 

Field Detail

clients

protected static int clients
Incremented on getIntance, decremented on release.


caches

protected static Hashtable caches
A map of JDBCDiskCache objects to region names.


tableStates

protected static Hashtable tableStates
A map of TableState objects to table names. Each cache has a table state object, which is used to determine if any long processes such as deletes or optimizations are running.

Constructor Detail

JDBCDiskCacheManagerAbstractTemplate

public JDBCDiskCacheManagerAbstractTemplate()
Method Detail

createJDBCDiskCache

protected abstract AuxiliaryCache createJDBCDiskCache(JDBCDiskCacheAttributes cattr,
                                                      TableState tableState)
Children must implement this method.

Parameters:
cattr -
tableState - An object used by multiple processes to indicate state.
Returns:
AuxiliaryCache -- a JDBCDiskCache

getCache

public AuxiliaryCache getCache(JDBCDiskCacheAttributes cattr)
Creates a JDBCDiskCache for the region if one doesn't exist, else it returns the precreated instance. It also adds the region to the shrinker thread if needed.

Parameters:
cattr -
Returns:
The cache value

createShrinkerWhenNeeded

protected void createShrinkerWhenNeeded(JDBCDiskCacheAttributes cattr,
                                        AuxiliaryCache raf)
If UseDiskShrinker is true then we will create a shrinker daemon if necessary.

Parameters:
cattr -
raf -

freeCache

public void freeCache(String name)
Parameters:
name -

getCacheType

public int getCacheType()
Gets the cacheType attribute of the HSQLCacheManager object

Returns:
The cacheType value

release

public void release()
Disposes of all regions.



Copyright © 2002-2012 Apache Software Foundation. All Rights Reserved.