Class 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
    • Field Detail

      • PROPERTY_TEMP_FILES_SET_DELETE_ON_EXIT

        public static final String PROPERTY_TEMP_FILES_SET_DELETE_ON_EXIT
        Property used to decide whether deleteOnExit should 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 virtualizer finalize() 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,
                                 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,
                                 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