Java Doc for CacheMap.java in  » Database-ORM » openjpa » org » apache » openjpa » util » 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 » Database ORM » openjpa » org.apache.openjpa.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.openjpa.util.CacheMap

CacheMap
public class CacheMap implements Map(Code)
Fixed-size map that has ability to pin/unpin entries and move overflow to a backing soft map.
author:
   Patrick Linskey
author:
   Abe White


Field Summary
final protected  SizedMapcacheMap
     The map for non-expired and non-pinned references.
final protected  MappinnedMap
     The set of objects pinned into the cache.
final protected  SizedMapsoftMap
     The map for expired references.

Constructor Summary
public  CacheMap()
     Create a non-LRU (and therefore highly concurrent) cache map with a size of 1000.
public  CacheMap(boolean lru, int max)
     Create a cache map with the given properties.
public  CacheMap(boolean lru, int max, int size, float load)
     Create a cache map with the given properties.

Method Summary
protected  voidcacheMapOverflowRemoved(Object key, Object value)
     Called from SizedMap.overflowRemoved in the cache map.
public  voidclear()
     Removes pinned objects as well as unpinned ones.
public  booleancontainsKey(Object key)
    
public  booleancontainsValue(Object val)
    
protected  voidentryAdded(Object key, Object value)
     Invoked when an entry is added to the cache.
protected  voidentryRemoved(Object key, Object value, boolean expired)
     Invoked when a key-value pair is evicted from this data structure.
public  SetentrySet()
    
public  Objectget(Object key)
    
public  intgetCacheSize()
     The maximum number of hard references to maintain, or -1 for no limit.
public  SetgetPinnedKeys()
     The keys pinned into the map.
public  intgetSoftReferenceSize()
     The maximum number of soft references to maintain, or -1 for no limit.
public  booleanisEmpty()
    
public  booleanisLRU()
     Whether this cache map uses LRU eviction.
public  SetkeySet()
    
public  booleanpin(Object key)
     Locks the given key and its value into the map.
protected  Objectput(Map map, Object key, Object value)
     Put the given entry into the given map.
public  Objectput(Object key, Object value)
    
public  voidputAll(Map map)
    
public  voidreadLock()
     Acquire read lock.
public  voidreadUnlock()
     Release read lock.
protected  Objectremove(Map map, Object key)
     Remove the given key from the given map.
public  Objectremove(Object key)
     If key is pinned into the cache, the pin is cleared and the object is removed.
public  voidsetCacheSize(int size)
     The maximum number of hard references to maintain, or -1 for no limit.
public  voidsetSoftReferenceSize(int size)
     The maximum number of soft references to maintain, or -1 for no limit.
public  intsize()
    
protected  voidsoftMapOverflowRemoved(Object key, Object value)
     Called from SizedMap.overflowRemoved in the soft map.
protected  voidsoftMapValueExpired(Object key)
     Called when a value expires from the soft map.
public  StringtoString()
    
public  booleanunpin(Object key)
     Undo a pinning.
public  Collectionvalues()
    
public  voidwriteLock()
     Acquire write lock.
public  voidwriteUnlock()
     Release write lock.

Field Detail
cacheMap
final protected SizedMap cacheMap(Code)
The map for non-expired and non-pinned references.



pinnedMap
final protected Map pinnedMap(Code)
The set of objects pinned into the cache.



softMap
final protected SizedMap softMap(Code)
The map for expired references.




Constructor Detail
CacheMap
public CacheMap()(Code)
Create a non-LRU (and therefore highly concurrent) cache map with a size of 1000.



CacheMap
public CacheMap(boolean lru, int max)(Code)
Create a cache map with the given properties.



CacheMap
public CacheMap(boolean lru, int max, int size, float load)(Code)
Create a cache map with the given properties.




Method Detail
cacheMapOverflowRemoved
protected void cacheMapOverflowRemoved(Object key, Object value)(Code)
Called from SizedMap.overflowRemoved in the cache map.



clear
public void clear()(Code)
Removes pinned objects as well as unpinned ones.



containsKey
public boolean containsKey(Object key)(Code)



containsValue
public boolean containsValue(Object val)(Code)



entryAdded
protected void entryAdded(Object key, Object value)(Code)
Invoked when an entry is added to the cache. This may be invoked more than once for an entry.



entryRemoved
protected void entryRemoved(Object key, Object value, boolean expired)(Code)
Invoked when a key-value pair is evicted from this data structure. This is invoked with expired set to true when an object is dropped because of space requirements or through garbage collection of soft references. It is invoked with expired set to false when an object is explicitly removed via the CacheMap.remove or CacheMap.clear methods. This may be invoked more than once for a given entry.
Parameters:
  value - may be null if the value was a soft reference that hasbeen GCd
since:
   0.2.5.0



entrySet
public Set entrySet()(Code)



get
public Object get(Object key)(Code)



getCacheSize
public int getCacheSize()(Code)
The maximum number of hard references to maintain, or -1 for no limit.



getPinnedKeys
public Set getPinnedKeys()(Code)
The keys pinned into the map.



getSoftReferenceSize
public int getSoftReferenceSize()(Code)
The maximum number of soft references to maintain, or -1 for no limit.



isEmpty
public boolean isEmpty()(Code)



isLRU
public boolean isLRU()(Code)
Whether this cache map uses LRU eviction.



keySet
public Set keySet()(Code)



pin
public boolean pin(Object key)(Code)
Locks the given key and its value into the map. Objects pinned into the map are not counted towards the maximum cache size, and are never evicted implicitly. You may pin keys for which no value is in the map. true if the givne key's value was pinned; false if no valuefor the given key is cached



put
protected Object put(Map map, Object key, Object value)(Code)
Put the given entry into the given map. Allows subclasses to take additional actions.



put
public Object put(Object key, Object value)(Code)



putAll
public void putAll(Map map)(Code)



readLock
public void readLock()(Code)
Acquire read lock.



readUnlock
public void readUnlock()(Code)
Release read lock.



remove
protected Object remove(Map map, Object key)(Code)
Remove the given key from the given map. Allows subclasses to take additional actions.



remove
public Object remove(Object key)(Code)
If key is pinned into the cache, the pin is cleared and the object is removed.



setCacheSize
public void setCacheSize(int size)(Code)
The maximum number of hard references to maintain, or -1 for no limit.



setSoftReferenceSize
public void setSoftReferenceSize(int size)(Code)
The maximum number of soft references to maintain, or -1 for no limit.



size
public int size()(Code)



softMapOverflowRemoved
protected void softMapOverflowRemoved(Object key, Object value)(Code)
Called from SizedMap.overflowRemoved in the soft map.



softMapValueExpired
protected void softMapValueExpired(Object key)(Code)
Called when a value expires from the soft map.



toString
public String toString()(Code)



unpin
public boolean unpin(Object key)(Code)
Undo a pinning.



values
public Collection values()(Code)



writeLock
public void writeLock()(Code)
Acquire write lock.



writeUnlock
public void writeUnlock()(Code)
Release write lock.



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.