public abstract class JRAbstractLRUVirtualizer extends java.lang.Object implements JRVirtualizer
Modifier and Type | Class and Description |
---|---|
protected class |
JRAbstractLRUVirtualizer.Cache
This class keeps track of how many objects are currently in memory, and
when there are too many, it pushes the last touched one to disk.
|
protected static class |
JRAbstractLRUVirtualizer.CacheReference |
protected class |
JRAbstractLRUVirtualizer.ClassLoaderAnnotationObjectInputStream |
protected class |
JRAbstractLRUVirtualizer.ClassLoaderAnnotationObjectOutputStream |
Modifier and Type | Field and Description |
---|---|
protected static int |
CLASSLOADER_IDX_NOT_SET |
protected java.util.Map<java.lang.ClassLoader,java.lang.Integer> |
classLoadersIndexes |
protected java.util.List<java.lang.ClassLoader> |
classLoadersList |
protected JRVirtualizable |
lastObject |
protected ReferenceMap |
lastObjectMap |
protected ReferenceMap |
lastObjectSet |
Modifier | Constructor and Description |
---|---|
protected |
JRAbstractLRUVirtualizer(int maxSize) |
Modifier and Type | Method and Description |
---|---|
void |
clearData(JRVirtualizable o)
Called when the virtual object paged-out data should be freed.
|
void |
deregisterObject(JRVirtualizable o)
Lets this virtualizer know that it no longer must track the
object.
|
protected abstract void |
dispose(java.lang.String virtualId)
Removes the external data associated with a virtualizable object.
|
protected void |
disposeAll() |
protected void |
finalize() |
protected static boolean |
isAncestorClassLoader(java.lang.ClassLoader loader) |
protected boolean |
isPagedOut(java.lang.String id) |
protected boolean |
isPagedOutAndTouch(JRVirtualizable o,
java.lang.String uid) |
boolean |
isReadOnly()
Determines whether the virtualizer is in read-only mode.
|
protected boolean |
isReadOnly(JRVirtualizable o) |
protected abstract void |
pageIn(JRVirtualizable o)
Reads a virtualizable object's data from an external storage.
|
protected abstract void |
pageOut(JRVirtualizable o)
Writes a virtualizable object's data to an external storage.
|
protected void |
readData(JRVirtualizable o,
java.io.InputStream in)
Reads serialized identity and virtual data for a virtualizable object
from a stream.
|
void |
registerObject(JRVirtualizable o)
Lets this virtualizer know that it must track the object.
|
void |
requestData(JRVirtualizable o)
Called when the virtual object must be paged-in.
|
protected void |
reset() |
protected void |
setLastObject(JRVirtualizable o) |
void |
setReadOnly(boolean ro)
Sets the read only mode for the virtualizer.
|
void |
touch(JRVirtualizable o)
Lets the virtualizer know that this object is still being used.
|
void |
virtualizeData(JRVirtualizable o)
Called when the virtual object should be paged-out.
|
protected void |
writeData(JRVirtualizable o,
java.io.OutputStream out)
Writes serialized indentity and virtual data of a virtualizable object to a stream.
|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
cleanup
protected static final int CLASSLOADER_IDX_NOT_SET
protected final java.util.Map<java.lang.ClassLoader,java.lang.Integer> classLoadersIndexes
protected final java.util.List<java.lang.ClassLoader> classLoadersList
protected JRVirtualizable lastObject
protected ReferenceMap lastObjectMap
protected ReferenceMap lastObjectSet
protected JRAbstractLRUVirtualizer(int maxSize)
maxSize
- the maximum size (in JRVirtualizable objects) of the paged in
cache.protected static boolean isAncestorClassLoader(java.lang.ClassLoader loader)
protected final boolean isPagedOut(java.lang.String id)
protected boolean isPagedOutAndTouch(JRVirtualizable o, java.lang.String uid)
protected final void setLastObject(JRVirtualizable o)
public void setReadOnly(boolean ro)
JRVirtualizationContext.setReadOnly(boolean)
to set the read-only mode for one specific context.ro
- the read-only mode to setpublic boolean isReadOnly()
setReadOnly(boolean)
protected final boolean isReadOnly(JRVirtualizable o)
public void registerObject(JRVirtualizable o)
JRVirtualizer
All virtualizable object must register with their virtualizer upon construction.
registerObject
in interface JRVirtualizer
public void deregisterObject(JRVirtualizable o)
JRVirtualizer
deregisterObject
in interface JRVirtualizer
public void touch(JRVirtualizable o)
JRVirtualizer
The virtualizer gets to decide what type of caching strategy it will use.
touch
in interface JRVirtualizer
public void requestData(JRVirtualizable o)
JRVirtualizer
If the object's virtual data is not paged-out, the object will only be
touched
.
requestData
in interface JRVirtualizer
public void clearData(JRVirtualizable o)
JRVirtualizer
If the object's virtual data is not paged-out, the object will only be
touched
.
clearData
in interface JRVirtualizer
public void virtualizeData(JRVirtualizable o)
JRVirtualizer
virtualizeData
in interface JRVirtualizer
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
protected final void writeData(JRVirtualizable o, java.io.OutputStream out) throws JRRuntimeException
o
- the serialized objectout
- the output streamJRRuntimeException
protected final void readData(JRVirtualizable o, java.io.InputStream in) throws JRRuntimeException
o
- the virtualizable objectin
- the input streamJRRuntimeException
protected void reset()
protected final void disposeAll()
protected abstract void pageOut(JRVirtualizable o) throws java.io.IOException
o
- a virtualizable objectjava.io.IOException
protected abstract void pageIn(JRVirtualizable o) throws java.io.IOException
o
- a virtualizable objectjava.io.IOException
protected abstract void dispose(java.lang.String virtualId)
virtualId
- the ID of the virtualizable object© 2001-2010 Jaspersoft Corporation www.jaspersoft.com