*) Bugfix for Loader Queue:

Job count was not displayed correctly
*) IndexingQueue:
- now it's possible to delete single entries from the queue
- now it's possible to clear the whole queue
  See: http://www.yacy-forum.de/viewtopic.php?t=995

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@641 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
theli 20 years ago
parent 732a107160
commit dc0a2d4c11

@ -14,6 +14,10 @@
#(indexing-queue)#
The indexing queue is empty<br>
::
<form action="IndexCreateIndexingQueue_p.html" method="post" enctype="multipart/form-data">
<input type="submit" name="clearIndexingQueue" value="clear indexing queue">
</form>
<br>
There are #[num]# entries in the indexing queue:<br>
<table border="0" cellpadding="2" cellspacing="1">
<tr class="TableHeader">
@ -23,15 +27,17 @@ There are #[num]# entries in the indexing queue:<br>
<td class="small">Anchor Name</th>
<th class="small">URL</th>
<th class="small">Size</th>
<th class="small">Delete</th>
</tr>
#{list}#
<tr class="TableCell#(dark)#Light::Dark#(/dark)#" class="small">
<tr class="TableCell#(dark)#Light::Dark::Summary#(/dark)#" class="small">
<td width="60" class="small">#[initiator]#</td>
<td width="10" class="small">#[depth]#</td>
<td width="80" class="small">#[modified]#</td>
<td width="180" class="small">#[anchor]#</td>
<td class="small"><a class="small" href="#[url]#">#[url]#</a></td>
<td width="80" class="small" align="right">#[size]#</td>
<td width="80" class="small" align="right"><nobr>#[size]#</nobr></td>
<td width="10" class="small">#(inProcess)#<a class="small" href="IndexCreateIndexingQueue_p.html?deleteEntry=#[hash]#">[Delete]</a>::#(/inProcess)#</td>
</tr>
#{/list}#
</table>

@ -77,18 +77,37 @@ public class IndexCreateIndexingQueue_p {
if (post != null) {
if (post.containsKey("clearRejected")) {
switchboard.urlPool.errorURL.clearStack();
}
}
if (post.containsKey("moreRejected")) {
showRejectedCount = Integer.parseInt(post.get("showRejected", "10"));
}
if (post.containsKey("clearsbqueue")) {
//switchboard.sbQueue.
if (post.containsKey("clearIndexingQueue")) {
try {
synchronized (switchboard.sbQueue) {
switchboard.sbQueue.clear();
}
} catch (Exception e) {}
} else if (post.containsKey("deleteEntry")) {
String urlHash = (String) post.get("deleteEntry");
try {
synchronized (switchboard.sbQueue) {
ArrayList entries = switchboard.sbQueue.list(0);
for (int i=entries.size()-1; i >= 0; i--) {
plasmaSwitchboardQueue.Entry pcentry = (plasmaSwitchboardQueue.Entry) entries.get(i);
if (pcentry.urlHash().equals(urlHash)) {
switchboard.sbQueue.remove(i);
break;
}
}
}
} catch (Exception e) {}
prop.put("LOCATION","");
return prop;
}
}
yacySeed initiator;
boolean dark;
int i=0;
if ((switchboard.sbQueue.size() == 0) && (switchboard.indexingTasksInProcess.size() == 0)) {
prop.put("indexing-queue", 0); //is empty
@ -97,29 +116,35 @@ public class IndexCreateIndexingQueue_p {
dark = true;
plasmaSwitchboardQueue.Entry pcentry;
int entryCount = 0;
int inProcessCount = 0, entryCount = 0;
try {
ArrayList entryList = new ArrayList();
// getting all entries that are currently in process
synchronized (switchboard.indexingTasksInProcess) {
inProcessCount = switchboard.indexingTasksInProcess.size();
entryList.addAll(switchboard.indexingTasksInProcess.values());
}
// getting all enqueued entries
entryList.addAll(switchboard.sbQueue.list(0));
if ((switchboard.sbQueue.size() > 0)) {
entryList.addAll(switchboard.sbQueue.list(0));
}
for (i = 0; i < entryList.size(); i++) {
for (int i = 0; i < entryList.size(); i++) {
boolean inProcess = i < inProcessCount;
pcentry = (plasmaSwitchboardQueue.Entry) entryList.get(i);
if ((pcentry != null)&&(pcentry.url() != null)) {
initiator = yacyCore.seedDB.getConnected(pcentry.initiator());
prop.put("indexing-queue_list_"+entryCount+"_dark", ((dark) ? 1 : 0));
prop.put("indexing-queue_list_"+entryCount+"_dark", (inProcess)? 2: ((dark) ? 1 : 0));
prop.put("indexing-queue_list_"+entryCount+"_initiator", ((initiator == null) ? "proxy" : initiator.getName()));
prop.put("indexing-queue_list_"+entryCount+"_depth", pcentry.depth());
prop.put("indexing-queue_list_"+entryCount+"_modified", (pcentry.responseHeader() == null) ? "" : daydate(pcentry.responseHeader().lastModified()));
prop.put("indexing-queue_list_"+entryCount+"_anchor", (pcentry.anchorName()==null)?"":pcentry.anchorName());
prop.put("indexing-queue_list_"+entryCount+"_url", pcentry.normalizedURLString());
prop.put("indexing-queue_list_"+entryCount+"_size", Status.bytesToString(pcentry.size()));
prop.put("indexing-queue_list_"+entryCount+"_inProcess", (inProcess)?1:0);
prop.put("indexing-queue_list_"+entryCount+"_0_hash", pcentry.urlHash());
dark = !dark;
entryCount++;
}
@ -147,7 +172,7 @@ public class IndexCreateIndexingQueue_p {
plasmaCrawlEURL.Entry entry;
yacySeed initiatorSeed, executorSeed;
int j=0;
for (i = switchboard.urlPool.errorURL.stackSize() - 1; i >= (switchboard.urlPool.errorURL.stackSize() - showRejectedCount); i--) {
for ( int i = switchboard.urlPool.errorURL.stackSize() - 1; i >= (switchboard.urlPool.errorURL.stackSize() - showRejectedCount); i--) {
entry = (plasmaCrawlEURL.Entry) switchboard.urlPool.errorURL.getStack(i);
initiatorHash = entry.initiator();
executorHash = entry.executor();

@ -73,11 +73,9 @@ public class IndexCreateLoaderQueue_p {
prop.put("loader-set", 0);
} else {
prop.put("loader-set", 1);
prop.put("loader-set_num", switchboard.cacheLoader.size());
boolean dark = true;
ThreadGroup loaderThreads = switchboard.cacheLoader.threadStatus();
ThreadGroup loaderThreads = switchboard.cacheLoader.threadStatus();
int threadCount = loaderThreads.activeCount();
Thread[] threadList = new Thread[threadCount*2];
threadCount = loaderThreads.enumerate(threadList);
@ -96,6 +94,7 @@ public class IndexCreateLoaderQueue_p {
dark = !dark;
}
prop.put("loader-set_list", i );
prop.put("loader-set_num", i);
}
// return rewrite properties

@ -107,6 +107,11 @@ public class plasmaSwitchboardQueue {
return new Entry(sbQueueStack.pot());
}
public Entry remove(int index) throws IOException {
if (sbQueueStack.size() == 0) return null;
return new Entry(sbQueueStack.pot(index));
}
public Entry get(int index) throws IOException {
if ((index < 0) || (index >= sbQueueStack.size())) throw new ArrayIndexOutOfBoundsException();
return new Entry(sbQueueStack.bot(index));
@ -125,6 +130,10 @@ public class plasmaSwitchboardQueue {
return list;
}
public void clear() throws IOException {
sbQueueStack.clear();
}
public void close() {
if (sbQueueStack != null) try {
sbQueueStack.close();

Loading…
Cancel
Save