Java Doc for AbstractCache.java in  » Content-Management-System » harmonise » org » openharmonise » commons » cache » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Content Management System » harmonise » org.openharmonise.commons.cache 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.openharmonise.commons.cache.AbstractCache

All known Subclasses:   org.openharmonise.rm.search.SearchResultsCache,  org.openharmonise.rm.publishing.WebPageEngineCache,  org.openharmonise.rm.sessions.SessionCache,  org.openharmonise.rm.factory.GeneralCache,  org.openharmonise.rm.tasks.TaskCache,  org.openharmonise.rm.dsi.ColumnRefCache,
AbstractCache
abstract public class AbstractCache (Code)
Abstract class providing the base functionality for object caching. The cache has a maximum size limit and will page out as required if that limit is reached, paging out in descending order of time since last access. If the memory limit of the machine is reached before the cache pages our, the cache will clear and reduce all the cache sizes by a given ratio.
author:
   Michael Bell
author:
   John King
version:
   $Revision: 1.2 $


Field Summary
final public static  StringCHANGE_DELETE
     Constant indicating a change based on a delete action.
final public static  StringCHANGE_SAVE
     Constant indicating a change based on a save action.
final public static  StringCHANGE_TEMP
     Constant indicating a change based on an temporary action.
final public static  StringCHANGE_UPDATE
     Constant indicating a change based on an update action.
final public static  doubleDEFAULT_CACHELIMIT_PERCENT
     Default percentage of the available memory that needs to be reached before the cache sizes are automatically reduced.
final public static  doubleDEFAULT_CACHEREDUCTION_RATIO
     Default percentage that cache sizes are reduced by when the memory limit has been reached.
final public static  intDEFAULT_CACHESIZE
     Default cache size.

Constructor Summary
protected  AbstractCache(String cache_name, int cache_size)
     Creates new cache with given parameters.
protected  AbstractCache(String cache_name)
     Creates cache with default parameters and the given name.

Method Summary
protected  ObjectaddToCache(Object key)
     Adds an object to the cache which corresponds to the given cache key, calls getCacheableObject to get the object to cache.
public  voidaddToCache(Object key, Object cacheable_object)
     Adds the cacheable_object to the cache with the given cache key key.
public  voidchangeObject(Object cache_key, String sChangeCode, Object newObject)
     Changes object in cache, depending on the change code sChangeCode the object will be deleted from the cache or replaced with the new object newObject.
public static synchronized  voidclearAllCaches()
     Clears all caches in system that extend this abstract cache class.
public  voidclearCache()
     Clears this cache.
public  booleancontainsKey(Object cache_key)
     Returns true if the given key is contained in the cache.
public  longgetAvgObjectSizeOfEstimate()
     Returns an estimate of the average size of an object in the cache.
public  SetgetCacheKeys()
     Returns a Set of cache keys.
public  intgetCacheMaxSize()
     Returns the current maximum size of the cache.
public  StringgetCacheName()
     Returns the name of the cache.
public  intgetCacheSize()
     Returns the current cache size, taken from the Map that contains all objects.
public  ListgetCacheTopKeys(int num_favourites)
     Returns the list of keys for the most accessed objects of the size given.
abstract protected  ObjectgetCacheableObject(Object key)
     Returns a cacheable object from the given key.
public  ObjectgetObject(Object key)
     Returns cache object matching the given cache key.
public  CachePointergetObjectPointer(Object key)
     Returns a pointer to the cached object referenced by the key.
public  booleanisDependancyAware()
     Returns true if this cache will check an object for dependancies before paging the object out.
protected  voidremoveObjectFromCache(Object key)
     Removes object associated to the specified cache key from the cache.
public  voidsetCacheMaxSize(int maxSize)
     Sets the maximum cache size.
public  voidsetDependancyAware(boolean bIsDepAware)
     Sets whether this cache checks objects for dependancies before paging the object out.

Field Detail
CHANGE_DELETE
final public static String CHANGE_DELETE(Code)
Constant indicating a change based on a delete action.



CHANGE_SAVE
final public static String CHANGE_SAVE(Code)
Constant indicating a change based on a save action.



CHANGE_TEMP
final public static String CHANGE_TEMP(Code)
Constant indicating a change based on an temporary action.



CHANGE_UPDATE
final public static String CHANGE_UPDATE(Code)
Constant indicating a change based on an update action.



DEFAULT_CACHELIMIT_PERCENT
final public static double DEFAULT_CACHELIMIT_PERCENT(Code)
Default percentage of the available memory that needs to be reached before the cache sizes are automatically reduced.



DEFAULT_CACHEREDUCTION_RATIO
final public static double DEFAULT_CACHEREDUCTION_RATIO(Code)
Default percentage that cache sizes are reduced by when the memory limit has been reached.



DEFAULT_CACHESIZE
final public static int DEFAULT_CACHESIZE(Code)
Default cache size.




Constructor Detail
AbstractCache
protected AbstractCache(String cache_name, int cache_size) throws CacheException(Code)
Creates new cache with given parameters.
Parameters:
  cache_name - the name of cache
Parameters:
  cache_size - the initial size of cache
Parameters:
  cache_pagesize - the paging size
throws:
  CacheException - if an error occurs in object construction



AbstractCache
protected AbstractCache(String cache_name) throws CacheException(Code)
Creates cache with default parameters and the given name.
Parameters:
  cache_name - the name of cache
throws:
  CacheException - if an error occurs in object construction




Method Detail
addToCache
protected Object addToCache(Object key) throws CacheException(Code)
Adds an object to the cache which corresponds to the given cache key, calls getCacheableObject to get the object to cache.
Parameters:
  key - the cache key which corresponds to required cached object the object which was existing in the cache for the given key, if there was already an object for the cache key.
throws:
  RuntimeException - if any exceptions are thrown during execution
throws:
  CacheException - note that the code will be changed to throw thisexceptoin in the future rather than a RuntimeException



addToCache
public void addToCache(Object key, Object cacheable_object)(Code)
Adds the cacheable_object to the cache with the given cache key key.
Parameters:
  key - the cache key
Parameters:
  cacheable_object - the object to be cached
throws:
  InterruptedException -
throws:
  RuntimeException - if any exceptions are thrown during execution



changeObject
public void changeObject(Object cache_key, String sChangeCode, Object newObject)(Code)
Changes object in cache, depending on the change code sChangeCode the object will be deleted from the cache or replaced with the new object newObject.
Parameters:
  cache_key - key of changed object
Parameters:
  sChangeCode - code of change
Parameters:
  newObject - new object which corresponds with the cache key
throws:
  InterruptedException -



clearAllCaches
public static synchronized void clearAllCaches()(Code)
Clears all caches in system that extend this abstract cache class.



clearCache
public void clearCache()(Code)
Clears this cache.
throws:
  InterruptedException -



containsKey
public boolean containsKey(Object cache_key) throws InterruptedException(Code)
Returns true if the given key is contained in the cache.
Parameters:
  cache_key - a cache key true if this cache contains this key
throws:
  InterruptedException -



getAvgObjectSizeOfEstimate
public long getAvgObjectSizeOfEstimate()(Code)
Returns an estimate of the average size of an object in the cache. an estimate of the average size of an object in the cache



getCacheKeys
public Set getCacheKeys()(Code)
Returns a Set of cache keys. a Set of cache keys



getCacheMaxSize
public int getCacheMaxSize()(Code)
Returns the current maximum size of the cache. the current maximum size of the cache



getCacheName
public String getCacheName()(Code)
Returns the name of the cache. the name of the cache



getCacheSize
public int getCacheSize()(Code)
Returns the current cache size, taken from the Map that contains all objects. the size of the cache



getCacheTopKeys
public List getCacheTopKeys(int num_favourites)(Code)
Returns the list of keys for the most accessed objects of the size given.
Parameters:
  num_favourites - the number of keys to return in list a list of the keys of the most accessed objects



getCacheableObject
abstract protected Object getCacheableObject(Object key) throws Exception(Code)
Returns a cacheable object from the given key.
Parameters:
  key - cache key for object Object to be cached
throws:
  Exception - if any error occurs



getObject
public Object getObject(Object key) throws CacheException(Code)
Returns cache object matching the given cache key.
Parameters:
  key - the cache key which corresponds to required cached object the object in cache corresponding to given cache key
throws:
  CacheException - if an error occurs accessing object in cache
throws:
  InterruptedException -
throws:
  RuntimeException - if object is not in cache



getObjectPointer
public CachePointer getObjectPointer(Object key) throws CacheException(Code)
Returns a pointer to the cached object referenced by the key.
Parameters:
  key - the cache key which corresponds to required cached object a CachePointer referencing the cached object corresponding to given cache key
throws:
  InterruptedException -
throws:
  CacheException -



isDependancyAware
public boolean isDependancyAware()(Code)
Returns true if this cache will check an object for dependancies before paging the object out.



removeObjectFromCache
protected void removeObjectFromCache(Object key)(Code)
Removes object associated to the specified cache key from the cache.
Parameters:
  key - the cache key



setCacheMaxSize
public void setCacheMaxSize(int maxSize)(Code)
Sets the maximum cache size.
Parameters:
  maxSize - the maximum size for the cache



setDependancyAware
public void setDependancyAware(boolean bIsDepAware)(Code)
Sets whether this cache checks objects for dependancies before paging the object out. If, when checking for dependancies, the object is found to have dependances the object will not be paged out.
Parameters:
  bIsDepAware - true if the cache should check dependanciesof an object before paging it out of the cache.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.