fixed a bug with news; news moving could lead to shurtcut loop / 100% CPU; appeared when clicked on a 'Profile' news in Network menu

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@845 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 19 years ago
parent d8544e8416
commit e5f8163203

@ -265,21 +265,11 @@ public class yacyNewsPool {
private boolean moveOff(yacyNewsQueue fromqueue, yacyNewsQueue toqueue, String id) throws IOException { private boolean moveOff(yacyNewsQueue fromqueue, yacyNewsQueue toqueue, String id) throws IOException {
// called if a published news shall be removed // called if a published news shall be removed
// the news is also removed from the news database yacyNewsRecord record = fromqueue.remove(id);
yacyNewsRecord record; if (record == null) return false;
synchronized (fromqueue) { toqueue.push(record);
while (fromqueue.size() > 0) {
record = fromqueue.top(0);
if ((record != null) && (record.id().equals(id))) {
fromqueue.pop(0);
if (toqueue != null) toqueue.push(record);
//newsDB.remove(id);
return true; return true;
} }
}
}
return false;
}
} }

@ -129,6 +129,19 @@ public class yacyNewsQueue {
return entry; return entry;
} }
public synchronized yacyNewsRecord remove(String id) throws IOException {
yacyNewsRecord record;
for (int i = 0; i < size(); i++) {
record = top(i);
if ((record != null) && (record.id().equals(id))) {
pop(i);
return record;
}
}
return null;
}
/* /*
public synchronized void incDistributedCounter(yacyNewsRecord entry) throws IOException { public synchronized void incDistributedCounter(yacyNewsRecord entry) throws IOException {
// this works only if the entry element lies ontop of the stack // this works only if the entry element lies ontop of the stack

Loading…
Cancel
Save