|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.netbeans.mdr.persistence.btreeimpl.btreestorage.MDRCache
An in-memory cache of MDR objects. At any given moment, there are four kinds of objects in the cache:
The creator of the cache specifies how many objects to cache in memory. Hard references are kept to the last N objects used, to enforce this. The cache keeps soft references to the other objects of the third type, so how often they are collected depends upon memory usage and the JVM's GC implementation.
Nested Class Summary | |
static interface |
MDRCache.OverflowHandler
The cache handler is called when the number of changes in the cache reaches its threshhold. |
Constructor Summary | |
MDRCache(int size)
Create the cache |
|
MDRCache(int size,
MDRCache.OverflowHandler hndlr,
int limit)
Create the cache |
Method Summary | |
void |
clear()
clear all unecessary objects from the cache |
void |
clearLists()
Clear the set of new, dirty, and deleted objects, presumably after having written them all out. |
java.lang.Object |
get(java.lang.Object m)
get an object from the cache |
java.util.Collection |
getDeleted()
Get all of the deleted IDs |
java.util.Collection |
getDirty()
Get all of the dirty objects |
java.util.Collection |
getNew()
Get all of the new objects |
boolean |
hasChanges()
returns true if the cache contains any changed objects |
boolean |
isDeleted(java.lang.Object key)
check if the object with the given key is deleted |
boolean |
isNew(java.lang.Object key)
check if the object with the given key is new |
java.util.Iterator |
iterateActive()
Get an iterator over the keys of all active objects in the cache |
java.util.Iterator |
iterateDeleted()
Get an iterator over the keys of deleted objects |
java.util.Iterator |
iterateNew()
Get an iterator over the keys of new objects |
int |
numberDeleted()
return the number of deleted objects |
int |
numberNew()
return the number of new objects |
void |
put(java.lang.Object m,
java.lang.Object o)
add a new object to the cache |
void |
remove(java.lang.Object m)
remove an object from the cache |
void |
replace(java.lang.Object m,
java.lang.Object o)
replace an object in the cache |
void |
setDirty(java.lang.Object key)
mark that the object with the given MOF ID is dirty |
void |
setNew(java.lang.Object key)
mark that the object with the given MOF ID is new |
void |
showStats(java.io.PrintStream strm)
Show caching statistics |
void |
showStats(java.io.PrintWriter strm)
Show caching statistics |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public MDRCache(int size, MDRCache.OverflowHandler hndlr, int limit)
size
- how many objects to cache in memoryhndlr
- handler to call when the cache has too many changed objectslimit
- number of changed objects to allowpublic MDRCache(int size)
size
- how many objects to cache in memoryMethod Detail |
public boolean hasChanges()
public void put(java.lang.Object m, java.lang.Object o) throws StorageException
m
- the object's MOF IDo
- the object to add
StorageException
public java.lang.Object get(java.lang.Object m)
m
- the object's MOF IDpublic void replace(java.lang.Object m, java.lang.Object o) throws StorageException
m
- the object's keyo
- the object
StorageException
public void remove(java.lang.Object m)
m
- the object's MOF ID
public void clear()
public void setNew(java.lang.Object key) throws StorageException
key
- MOF ID
StorageException
public boolean isNew(java.lang.Object key)
public java.util.Iterator iterateActive()
public java.util.Iterator iterateDeleted()
public java.util.Iterator iterateNew()
public int numberNew()
public int numberDeleted()
public boolean isDeleted(java.lang.Object key)
public void setDirty(java.lang.Object key) throws StorageException
key
- MOF ID
StorageException
public java.util.Collection getNew()
public java.util.Collection getDirty()
public java.util.Collection getDeleted()
public void clearLists()
public void showStats(java.io.PrintStream strm)
public void showStats(java.io.PrintWriter strm)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |