*) one possible deadlock (because of nested object locks) removed in class kelondroMap

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@61 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
theli 20 years ago
parent 58a65b60bd
commit 47e426ff7e

@ -128,12 +128,11 @@ public class kelondroMap {
class writeQueue extends Thread {
LinkedList queue;
private LinkedList queue = new LinkedList();
boolean run;
public writeQueue() {
run = true;
queue = new LinkedList();
}
public void stack(String key) {
@ -144,12 +143,19 @@ public class kelondroMap {
workoff(key);
}
public synchronized void workoff() {
if (queue.size() > 0) workoff((String) queue.removeFirst());
public void workoff() {
String newKey = null;
synchronized (this.queue) {
if (this.queue.size() > 0) {
newKey = (String) this.queue.removeFirst();
}
}
if (newKey != null) workoff(newKey);
}
public synchronized void dequeue(String key) {
public void dequeue(String key) {
// take out one entry
synchronized (this.queue) {
ListIterator i = queue.listIterator();
String k;
while (i.hasNext()) {
@ -160,6 +166,7 @@ public class kelondroMap {
}
}
}
}
public void workoff(String key) {
//System.out.println("kelondroMap: workoff(" + dyn.entryFile.name() + ") " + key);

Loading…
Cancel
Save