Class CacheablePersistence

java.lang.Object
org.jppf.job.persistence.impl.CacheablePersistence
All Implemented Interfaces:
JobPersistence

public class CacheablePersistence extends Object implements JobPersistence
A caching wrapper for any other implementation of JobPersistence.

The cached artifacts are those handled by the load() and store() methods, that is, job headers, data providers, tasks and task results. The cache is an LRU cache of soft references to the artifacts. It guarantees that all its entries will be cleared before an out of memory error is raised. Additionally the cache has a capacity which can be specified in the configuration and which defaults to 1024.

This cacheable persistence is configured as follows:

 # shorten the configuration value for clarity
 wrapper = org.jppf.job.persistence.impl.CacheablePersistence
 # cacheable persistence with default capacity of 1024
 jppf.job.persistence = ${wrapper} <actual_persistence> <param1> ... <paramN>
 # cacheable persistence with a specified capacity
 jppf.job.persistence = ${wrapper} <capacity> <actual_persistence> <param1> ... <paramN>

Here is a concrete example wrapping a default database persistence:

 # shortcut for the package name
 pkg = org.jppf.job.persistence.impl
 # cacheable database persistence with a capacity of 10000,
 # a table named 'JPPF_TEST' and datasource named 'JobDS'
 jppf.job.persistence = ${pkg}.CacheablePersistence 10000 ${pkg}.DefaultDatabasePersistence JPPF_TEST JobDS
Author:
Laurent Cohen