Class JRAbstractLRUVirtualizer

    • Constructor Detail

      • JRAbstractLRUVirtualizer

        protected JRAbstractLRUVirtualizer​(int maxSize)
        Parameters:
        maxSize - the maximum size (in JRVirtualizable objects) of the paged in cache.
    • Method Detail

      • isPagedOut

        protected final boolean isPagedOut​(String id)
      • setLastObject

        protected final void setLastObject​(JRVirtualizable o)
      • setReadOnly

        public void setReadOnly​(boolean ro)
        Sets the read only mode for the virtualizer.

        When in read-only mode, the virtualizer assumes that virtualizable objects are final and any change in a virtualizable object's data is discarded.

        When the virtualizer is used for multiple virtualization contexts (in shared mode), calling this method would override the read-only flags from all the contexts and all the objects will be manipulated in read-only mode. Use JRVirtualizationContext.setReadOnly(boolean) to set the read-only mode for one specific context.

        Parameters:
        ro - the read-only mode to set
      • isReadOnly

        public boolean isReadOnly()
        Determines whether the virtualizer is in read-only mode.
        Returns:
        whether the virtualizer is in read-only mode
        See Also:
        setReadOnly(boolean)
      • registerObject

        public void registerObject​(JRVirtualizable o)
        Description copied from interface: JRVirtualizer
        Lets this virtualizer know that it must track the object.

        All virtualizable object must register with their virtualizer upon construction.

        Specified by:
        registerObject in interface JRVirtualizer
      • evict

        protected void evict()
      • touch

        public void touch​(JRVirtualizable o)
        Description copied from interface: JRVirtualizer
        Lets the virtualizer know that this object is still being used. This should be called to help the virtualizer determine which objects to keep in its cache, and which objects to page-out when it must do some paging-out.

        The virtualizer gets to decide what type of caching strategy it will use.

        Specified by:
        touch in interface JRVirtualizer
      • requestData

        public void requestData​(JRVirtualizable o)
        Description copied from interface: JRVirtualizer
        Called when the virtual object must be paged-in.

        If the object's virtual data is not paged-out, the object will only be touched.

        Specified by:
        requestData in interface JRVirtualizer
      • clearData

        public void clearData​(JRVirtualizable o)
        Description copied from interface: JRVirtualizer
        Called when the virtual object paged-out data should be freed.

        If the object's virtual data is not paged-out, the object will only be touched.

        Specified by:
        clearData in interface JRVirtualizer
      • reset

        protected void reset()
      • disposeAll

        protected final void disposeAll()
      • pageOut

        protected abstract void pageOut​(JRVirtualizable o)
                                 throws IOException
        Writes a virtualizable object's data to an external storage.
        Parameters:
        o - a virtualizable object
        Throws:
        IOException
      • pageIn

        protected abstract void pageIn​(JRVirtualizable o)
                                throws IOException
        Reads a virtualizable object's data from an external storage.
        Parameters:
        o - a virtualizable object
        Throws:
        IOException
      • dispose

        protected abstract void dispose​(String virtualId)
        Removes the external data associated with a virtualizable object.
        Parameters:
        virtualId - the ID of the virtualizable object