Java Doc for DefaultLevel2Cache.java in  » Database-ORM » JPOX » org » jpox » 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 » Database ORM » JPOX » org.jpox.cache 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.jpox.cache.DefaultLevel2Cache

All known Subclasses:   org.jpox.cache.SoftLevel2Cache,
DefaultLevel2Cache
public class DefaultLevel2Cache implements Level2Cache(Code)
Default implementation of a Level 2 cache for JPOX.

Operates with 2 maps internally. One stores all pinned objects that have been selected to be retained by user's application. The other stores all other objects. This second map is the default location where objects are placed when being added here. The second (unpinned) map stores weak references meaning that they can get garbage collected as necessary by the JVM.

Maintains collections of the classes and the identities that are to be pinned if they ever are put into the cache. These are defined by the pinAll(), pin() methods.

All mutating methods, and the get method have been synchronized to prevent conflicts.


version:
   $Revision: 1.18 $


Field Summary
protected  MappinnedCache
     Pinned objects cache.
protected  CollectionpinnedClasses
     Collection of pinned classes whose objects should be pinned if they ever reach the cache.
protected  CollectionpinnedIds
     Collection of ids whose objects should be pinned if they ever reach the cache.
protected  MapunpinnedCache
     Unpinned objects cache.

Constructor Summary
protected  DefaultLevel2Cache()
     Constructor.
public  DefaultLevel2Cache(Properties props)
     Constructor.

Method Summary
public  voidclear()
     Method to clear the cache.
public  booleancontainsOid(Object oid)
    
public synchronized  voidevict(Object oid)
     Method to evict an object from the cache.
public synchronized  voidevictAll()
     Method to evict all objects from the L2 cache.
public synchronized  voidevictAll(Class pcClass, boolean subclasses)
     Method to evict all objects of the given types from the cache.
public synchronized  voidevictAll(Collection oids)
     Method to evict the objects with the specified ids.
public synchronized  voidevictAll(Object[] oids)
     Method to evict the objects with the specified ids.
public synchronized  CachedPCget(Object oid)
     Accessor for an object from the cache. The returned object will not have a StateManager connected.
public  intgetNumberOfPinnedObjects()
     Accessor for the number of pinned objects in the cache.
public  intgetNumberOfUnpinnedObjects()
     Accessor for the number of unpinned objects in the cache.
public  intgetSize()
     Accessor for the total number of objects in the L2 cache.
public  booleanisEmpty()
     Accessor for whether the cache is empty.
public synchronized  voidpin(Object oid)
     Method to pin an object to the cache.
public synchronized  voidpinAll(Class cls, boolean subs)
     Method to pin all objects of the given types.
public synchronized  voidpinAll(Collection oids)
    
public synchronized  voidpinAll(Object[] oids)
    
public synchronized  CachedPCput(Object oid, CachedPC pc)
     Method to put an object in the cache.
public synchronized  voidunpin(Object oid)
    
public synchronized  voidunpinAll(Class cls, boolean subs)
     Method to unpin all objects of the specified types.
public synchronized  voidunpinAll(Collection oids)
    
public synchronized  voidunpinAll(Object[] oids)
    

Field Detail
pinnedCache
protected Map pinnedCache(Code)
Pinned objects cache.



pinnedClasses
protected Collection pinnedClasses(Code)
Collection of pinned classes whose objects should be pinned if they ever reach the cache.



pinnedIds
protected Collection pinnedIds(Code)
Collection of ids whose objects should be pinned if they ever reach the cache.



unpinnedCache
protected Map unpinnedCache(Code)
Unpinned objects cache.




Constructor Detail
DefaultLevel2Cache
protected DefaultLevel2Cache()(Code)
Constructor.



DefaultLevel2Cache
public DefaultLevel2Cache(Properties props)(Code)
Constructor.
Parameters:
  props - Any properties to control the cache




Method Detail
clear
public void clear()(Code)
Method to clear the cache.



containsOid
public boolean containsOid(Object oid)(Code)
Method to check if an object with the specified id is in the cache
Parameters:
  oid - The object ID Whether it is present



evict
public synchronized void evict(Object oid)(Code)
Method to evict an object from the cache.
Parameters:
  oid - The id of the object to evict



evictAll
public synchronized void evictAll()(Code)
Method to evict all objects from the L2 cache.



evictAll
public synchronized void evictAll(Class pcClass, boolean subclasses)(Code)
Method to evict all objects of the given types from the cache.
Parameters:
  pcClass - The class to evict
Parameters:
  subclasses - Whether to also evict subclasses



evictAll
public synchronized void evictAll(Collection oids)(Code)
Method to evict the objects with the specified ids.
Parameters:
  oids - The ids of the objects to evict



evictAll
public synchronized void evictAll(Object[] oids)(Code)
Method to evict the objects with the specified ids.
Parameters:
  oids - The ids of the objects to evict



get
public synchronized CachedPC get(Object oid)(Code)
Accessor for an object from the cache. The returned object will not have a StateManager connected. This is because data stored in the Level 2 cache is StateManager and PersistenceManager independent.
Parameters:
  oid - The Object ID The L2 cacheable object



getNumberOfPinnedObjects
public int getNumberOfPinnedObjects()(Code)
Accessor for the number of pinned objects in the cache. Number of pinned objects



getNumberOfUnpinnedObjects
public int getNumberOfUnpinnedObjects()(Code)
Accessor for the number of unpinned objects in the cache. Number of unpinned objects



getSize
public int getSize()(Code)
Accessor for the total number of objects in the L2 cache. Number of objects



isEmpty
public boolean isEmpty()(Code)
Accessor for whether the cache is empty. Whether it is empty.



pin
public synchronized void pin(Object oid)(Code)
Method to pin an object to the cache.
Parameters:
  oid - The id of the object to pin



pinAll
public synchronized void pinAll(Class cls, boolean subs)(Code)
Method to pin all objects of the given types.
Parameters:
  cls - The class
Parameters:
  subs - Whether to include subclasses



pinAll
public synchronized void pinAll(Collection oids)(Code)
Method to pin all of the supplied objects
Parameters:
  oids - The Object ids to pin



pinAll
public synchronized void pinAll(Object[] oids)(Code)
Method to pin all of the supplied objects
Parameters:
  oids - The object ids to pin



put
public synchronized CachedPC put(Object oid, CachedPC pc)(Code)
Method to put an object in the cache. Note that the pc object being passed in must NOT have a StateManager connected. Data stored in the Level 2 cache has to be independent of PersistenceManager and StateManager.
Parameters:
  oid - The Object id for this object
Parameters:
  pc - The cacheable object The value previously associated with this oid



unpin
public synchronized void unpin(Object oid)(Code)
Method to unpin an object
Parameters:
  oid - The object id



unpinAll
public synchronized void unpinAll(Class cls, boolean subs)(Code)
Method to unpin all objects of the specified types.
Parameters:
  cls - Base class
Parameters:
  subs - Whether to include subclasses



unpinAll
public synchronized void unpinAll(Collection oids)(Code)
Method to unpin all of the supplied objects
Parameters:
  oids - The object ids to unpin



unpinAll
public synchronized void unpinAll(Object[] oids)(Code)
Method to unpin all of the specified objects
Parameters:
  oids - The object ids to unpin



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.