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
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
FieldsModifier and TypeFieldDescriptionstatic final StringProperty 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
ConstructorsConstructorDescriptionJRFileVirtualizer(int maxSize) Uses the process's working directory as the location to store files.JRFileVirtualizer(int maxSize, String directory) JRFileVirtualizer(JasperReportsContext jasperReportsContext, int maxSize, String directory) -
Method Summary
Modifier and TypeMethodDescriptionvoidcleanup()Called when we are done with the virtualizer and wish to cleanup any resources it has.protected voidRemoves the external data associated with a virtualizable object.protected voidReads a virtualizable object's data from an external storage.protected voidWrites 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 Details
-
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:
-
-
Constructor Details
-
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
- 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
- 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 Details
-
pageOut
Description copied from class:JRAbstractLRUVirtualizerWrites a virtualizable object's data to an external storage.- Specified by:
pageOutin classJRAbstractLRUVirtualizer- Parameters:
o- a virtualizable object- Throws:
IOException
-
pageIn
Description copied from class:JRAbstractLRUVirtualizerReads a virtualizable object's data from an external storage.- Specified by:
pageInin classJRAbstractLRUVirtualizer- Parameters:
o- a virtualizable object- Throws:
IOException
-
dispose
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.
-