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:
AuxiliaryCacheManager
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

Nested Class Summary
protected static class JDBCDiskCacheManagerAbstractTemplate.MyThreadFactory
          Allows us to set the daemon status on the clock-daemon
 
Field Summary
protected static Hashtable<String,JDBCDiskCache<? extends Serializable,? extends Serializable>> caches
          A map of JDBCDiskCache objects to region names.
protected static int clients
          Incremented on getIntance, decremented on release.
protected static Hashtable<String,TableState> tableStates
          A map of TableState objects to table names.
 
Constructor Summary
JDBCDiskCacheManagerAbstractTemplate()
           
 
Method Summary
protected abstract
<K extends Serializable,V extends Serializable>
JDBCDiskCache<K,V>
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)
           
<K extends Serializable,V extends Serializable>
JDBCDiskCache<K,V>
getCache(JDBCDiskCacheAttributes cattr)
          Creates a JDBCDiskCache for the region if one doesn't exist, else it returns the pre-created instance.
 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<String,JDBCDiskCache<? extends Serializable,? extends Serializable>> caches
A map of JDBCDiskCache objects to region names.


tableStates

protected static Hashtable<String,TableState> 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 <K extends Serializable,V extends Serializable> JDBCDiskCache<K,V> 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 <K extends Serializable,V extends Serializable> JDBCDiskCache<K,V> getCache(JDBCDiskCacheAttributes cattr)
Creates a JDBCDiskCache for the region if one doesn't exist, else it returns the pre-created 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 -

release

public void release()
Disposes of all regions.



Copyright © 2002-2013 The Apache Software Foundation. All Rights Reserved.