Author: bombe
Date: 2008-08-20 18:41:58 +0000 (Wed, 20 Aug 2008)
New Revision: 22061
Modified:
trunk/freenet/src/freenet/client/async/BackgroundBlockEncoder.java
Log:
use generics
Modified: trunk/freenet/src/freenet/client/async/BackgroundBlockEncoder.java
===================================================================
--- trunk/freenet/src/freenet/client/async/BackgroundBlockEncoder.java
2008-08-20 18:40:15 UTC (rev 22060)
+++ trunk/freenet/src/freenet/client/async/BackgroundBlockEncoder.java
2008-08-20 18:41:58 UTC (rev 22061)
@@ -14,16 +14,16 @@
public class BackgroundBlockEncoder implements PrioRunnable {
// Minimize memory usage at the cost of having to encode from the end
- private final ArrayList queue;
+ private final ArrayList<SoftReference<SingleBlockInserter>> queue;
public BackgroundBlockEncoder() {
- queue = new ArrayList();
+ queue = new ArrayList<SoftReference<SingleBlockInserter>>();
}
public void queue(SingleBlockInserter sbi) {
if(sbi.isCancelled()) return;
if(sbi.resultingURI != null) return;
- SoftReference ref = new SoftReference(sbi);
+ SoftReference<SingleBlockInserter> ref = new
SoftReference<SingleBlockInserter>(sbi);
synchronized(this) {
queue.add(ref);
Logger.minor(this, "Queueing encode of "+sbi);
@@ -39,7 +39,7 @@
if(inserter.isCancelled()) continue;
if(inserter.resultingURI != null) continue;
Logger.minor(this, "Queueing encode of
"+inserter);
- SoftReference ref = new SoftReference(inserter);
+ SoftReference<SingleBlockInserter> ref = new
SoftReference<SingleBlockInserter>(inserter);
queue.add(ref);
}
notifyAll();
@@ -59,8 +59,8 @@
}
}
while(!queue.isEmpty()) {
- SoftReference ref = (SoftReference)
queue.remove(queue.size()-1);
- sbi = (SingleBlockInserter) ref.get();
+ SoftReference<SingleBlockInserter> ref
= queue.remove(queue.size()-1);
+ sbi = ref.get();
if(sbi != null) break;
}
}