Class DiskQueue<E>

  • Type Parameters:
    E - the element type parameter
    All Implemented Interfaces:
    Serializable, AutoCloseable, Iterable<E>, Collection<E>, Queue<E>

    public class DiskQueue<E>
    extends Object
    implements Queue<E>, Serializable, AutoCloseable

    A Queue implementation that stores its data in a file. DiskQueue are monitored to ensure that their file handle is properly closed if the it is no longer in use. However, one can use the commit and close methods to explicitly commit changes and close the queue.

    DiskQueue are created using a builder in the following way:

     
      var map = DiskQueue.builder()
                       .file(Resources.from("/data/map.db")
                       .namespace("people")
                       .compressed(true)
                       .build();
     
     

    Once an DiskQueue instance is constructed it acts like regular Java Queue.

    See Also:
    Serialized Form