Java - Persistent Queue |
| Back to: Gabor Cselle Homepage > Writings |
com.gaborcselle.persistent.PersistentQueueGabor Cselle (mail at gaborcselle dot com), August 10, 2005 This is an implementation of a persistent queue for Java 1.5 and higher. It keeps a copy of its status in a file on disk which is updated every time the queue contents are modified. Therefore, the data in the queue can survive program or system crashes. The name of the status file is given when calling the constructor. The type of elements held in the queue are determined by the type parameter Defragmentation: When the first element of the queue is deleted, not the entire file is written. Instead, a delete marker is appended to the end of the file to signal that the first element has been deleted. This scheme is explained in the illustration below. After some number of deletes (default: 50), the entire file is rewritten from scratch. ![]() JavadocThe Javadoc contains a more information about the class: Source Code DownloadAll source code can be found here:
License![]() Java Persistent Queue by Gabor Cselle is licensed under a Creative Commons Attribution 3.0 Unported License. Questions? Comments? Found an Error?Contact the author at mail at gaborcselle dot com. |