Subversion Repositories Utilities

Compare Revisions

Ignore whitespace Rev 406 → Rev 407

/trunk/build-data.properties
1,5 → 1,5
#Build Properties: build-data.properties
#Sun, 20 May 2012 22:06:14 +0100
#Sun, 20 May 2012 22:49:00 +0100
#Build Number: build-data.properties
#Tue, 13 Mar 2012 21:42:18 +0000
Library-Name=Ceridwen Utilities
9,8 → 9,8
Library-Vendor-Id=com.ceridwen
Library-URL=http\://www.ceridwen.com/
 
Library-Build-Count=474
Library-Build-Count=477
Library-Build-Stamp=
Library-Build-Date=Sun May 20 22\:06\:14 BST 2012
Library-Build-Date=Sun May 20 22\:49\:00 BST 2012
 
 
/trunk/src/com/gaborcselle/persistent/PersistentQueue.java
25,6 → 25,9
import java.io.StreamCorruptedException;
import java.util.LinkedList;
 
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
 
import com.ceridwen.util.collections.Queue;
 
/**
54,6 → 57,9
* @version 1.0
*/
public class PersistentQueue<E extends Serializable> implements Queue<E> {
private static Log log = LogFactory.getLog(PersistentQueue.class);
private final String filename;
private final int defragmentInterval;
/** How many remove()s have we executed since last defragmenting the file? */
87,21 → 93,26
* @throws IOException if an I/O error occurs
*/
public PersistentQueue(String filename, int defragmentInterval) throws IOException {
this.filename = filename;
this.defragmentInterval = defragmentInterval;
this.removesSinceDefragment = 0;
list = new LinkedList<E>();
File file = new File(filename);
// if file does exists:
if (file.exists() && !file.isDirectory()) {
// read in the file contents
readStateFromFile(this.filename);
} else {
// else, if file does not exist
createEmptyFile(this.filename);
}
try {
this.filename = filename;
this.defragmentInterval = defragmentInterval;
this.removesSinceDefragment = 0;
list = new LinkedList<E>();
File file = new File(filename);
// if file does exists:
if (file.exists() && !file.isDirectory()) {
// read in the file contents
readStateFromFile(this.filename);
} else {
// else, if file does not exist
createEmptyFile(this.filename);
}
} catch (Exception ex) {
PersistentQueue.log.fatal("Could not create queue store: " + this.filename);
throw new IOException(ex);
}
}
 
/**
/trunk/readme/changelog.txt
1,4 → 1,4
Version 1.61: 20/05/2012 (406)
Version 1.61: 20/05/2012 (407)
Re-implemented com.ceridwen.util.collection.PersistentQueue for backwards compatibility
Dependencies: apache commons lang 3.1
apache commons net 3.1