Permalink
Browse files

Added 'LinkedList2.limit' field for future proofing.

  • Loading branch information...
1 parent 45c6c80 commit fb0538b820abc102da32f7e662fd776cf63797a1 @dan-g dan-g committed Apr 9, 2012
Showing with 13 additions and 1 deletion.
  1. +13 −1 src/main/java/net/kotek/jdbm/LinkedList2.java
@@ -32,6 +32,10 @@
private DBAbstract db;
final long rootRecid;
+ /** size limit, is not currently used, but needs to be here for future compatibility.
+ * Zero means no limit.
+ */
+ long sizeLimit = 0;
private final ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
@@ -121,6 +125,7 @@ private Root getRoot(){
}
+
public int size() {
lock.readLock().lock();
try{
@@ -132,6 +137,10 @@ public int size() {
}
+ public Iterator<E> descendingIterator() {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
public boolean add(Object value) {
lock.writeLock().lock();
try {
@@ -179,12 +188,15 @@ public boolean add(Object value) {
*/
static LinkedList2 deserialize(DataInput is, Serialization ser) throws IOException, ClassNotFoundException {
long rootrecid = LongPacker.unpackLong(is);
+ long sizeLimit = LongPacker.unpackLong(is);
+ if(sizeLimit!=0) throw new InternalError("LinkedList.sizeLimit not supported in this JDBM version");
Serializer serializer = (Serializer) ser.deserialize(is);
return new LinkedList2(ser.db,rootrecid, serializer);
}
void serialize(DataOutput out) throws IOException {
LongPacker.packLong(out, rootRecid);
+ LongPacker.packLong(out, sizeLimit);
db.defaultSerializer().serialize(out, valueSerializer);
}
@@ -465,4 +477,4 @@ static void defrag(long recid, DBStore r1, DBStore r2) throws IOException {
}
-}
+}

0 comments on commit fb0538b

Please sign in to comment.