Package net.sf.jasperreports.engine.fill
Class JRFileVirtualizer
- java.lang.Object
-
- net.sf.jasperreports.engine.fill.JRAbstractLRUVirtualizer
-
- net.sf.jasperreports.engine.fill.JRFileVirtualizer
-
- All Implemented Interfaces:
JRVirtualizer
public class JRFileVirtualizer extends JRAbstractLRUVirtualizer
Virtualizes data to the filesystem. When this object is finalized, it removes the swap files it makes. The virtualized objects have references to this object, so finalization does not occur until this object and the objects using it are only weakly referenced.- Author:
- John Bindel
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class net.sf.jasperreports.engine.fill.JRAbstractLRUVirtualizer
JRAbstractLRUVirtualizer.Cache, JRAbstractLRUVirtualizer.CacheReference
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringPROPERTY_TEMP_FILES_SET_DELETE_ON_EXITProperty used to decide whetherdeleteOnExitshould be requested for temporary files created by the virtualizer.-
Fields inherited from class net.sf.jasperreports.engine.fill.JRAbstractLRUVirtualizer
lastObjectMap, lastObjectRef, lastObjectSet, pagedIn, pagedOut, serializer
-
-
Constructor Summary
Constructors Constructor Description JRFileVirtualizer(int maxSize)Uses the process's working directory as the location to store files.JRFileVirtualizer(int maxSize, java.lang.String directory)JRFileVirtualizer(JasperReportsContext jasperReportsContext, int maxSize, java.lang.String directory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcleanup()Called when we are done with the virtualizer and wish to cleanup any resources it has.protected voiddispose(java.lang.String virtualId)Removes the external data associated with a virtualizable object.protected voidpageIn(JRVirtualizable o)Reads a virtualizable object's data from an external storage.protected voidpageOut(JRVirtualizable o)Writes a virtualizable object's data to an external storage.-
Methods inherited from class net.sf.jasperreports.engine.fill.JRAbstractLRUVirtualizer
clearData, contextChanged, deregisterObject, dispose, disposeAll, evict, finalize, isEvictable, isPagedOut, isPagedOutAndTouch, isReadOnly, isReadOnly, lastObject, readData, registerObject, requestData, reset, setLastObject, setReadOnly, touch, virtualizeData, writeData
-
-
-
-
Field Detail
-
PROPERTY_TEMP_FILES_SET_DELETE_ON_EXIT
public static final java.lang.String PROPERTY_TEMP_FILES_SET_DELETE_ON_EXIT
Property used to decide whetherdeleteOnExitshould be requested for temporary files created by the virtualizer.Calling
File.deleteOnExit()will accumulate JVM process memory (see this bug), and this should abviously be avoided in long-running applications.Temporary files will be deleted by explicitly calling
cleanup()or from the virtualizerfinalize()method.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
JRFileVirtualizer
public JRFileVirtualizer(int maxSize)
Uses the process's working directory as the location to store files.- Parameters:
maxSize- the maximum size (in JRVirtualizable objects) of the paged in cache.
-
JRFileVirtualizer
public JRFileVirtualizer(int maxSize, java.lang.String directory)- Parameters:
maxSize- the maximum size (in JRVirtualizable objects) of the paged in cache.directory- the base directory in the filesystem where the paged out data is to be stored
-
JRFileVirtualizer
public JRFileVirtualizer(JasperReportsContext jasperReportsContext, int maxSize, java.lang.String directory)
- Parameters:
jasperReportsContext- the JasperReportsContext to use for reading configuration from.maxSize- the maximum size (in JRVirtualizable objects) of the paged in cache.directory- the base directory in the filesystem where the paged out data is to be stored
-
-
Method Detail
-
pageOut
protected void pageOut(JRVirtualizable o) throws java.io.IOException
Description copied from class:JRAbstractLRUVirtualizerWrites a virtualizable object's data to an external storage.- Specified by:
pageOutin classJRAbstractLRUVirtualizer- Parameters:
o- a virtualizable object- Throws:
java.io.IOException
-
pageIn
protected void pageIn(JRVirtualizable o) throws java.io.IOException
Description copied from class:JRAbstractLRUVirtualizerReads a virtualizable object's data from an external storage.- Specified by:
pageInin classJRAbstractLRUVirtualizer- Parameters:
o- a virtualizable object- Throws:
java.io.IOException
-
dispose
protected void dispose(java.lang.String virtualId)
Description copied from class:JRAbstractLRUVirtualizerRemoves the external data associated with a virtualizable object.- Specified by:
disposein classJRAbstractLRUVirtualizer- Parameters:
virtualId- the ID of the virtualizable object
-
cleanup
public void cleanup()
Called when we are done with the virtualizer and wish to cleanup any resources it has.
-
-