*) Bugfix of Delete-Indexqueue-Entry, Clear Indexing Queue functionality

- htcache files will now also be deleted if entry should not be stored into cache

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@667 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
theli 19 years ago
parent 53c28a8ddc
commit dc85b1021e

@ -18,7 +18,7 @@ The indexing queue is empty<br>
<input type="submit" name="clearIndexingQueue" value="clear indexing queue"> <input type="submit" name="clearIndexingQueue" value="clear indexing queue">
</form> </form>
<br> <br>
There are #[num]# entries in the indexing queue:<br> There are #[num]# entries with a total size of #[totalSize]# in the indexing queue:<br>
<table border="0" cellpadding="2" cellspacing="1"> <table border="0" cellpadding="2" cellspacing="1">
<tr class="TableHeader"> <tr class="TableHeader">
<th class="small">Initiator</th> <th class="small">Initiator</th>
@ -37,7 +37,7 @@ There are #[num]# entries in the indexing queue:<br>
<td width="180" class="small">#[anchor]#</td> <td width="180" class="small">#[anchor]#</td>
<td class="small"><a class="small" href="#[url]#">#[url]#</a></td> <td class="small"><a class="small" href="#[url]#">#[url]#</a></td>
<td width="80" class="small" align="right"><nobr>#[size]#</nobr></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> <td width="10" class="small" title="#[hash]#">#(inProcess)#<a class="small" href="IndexCreateIndexingQueue_p.html?deleteEntry=#[hash]#">[Delete]</a>::#(/inProcess)#</td>
</tr> </tr>
#{/list}# #{/list}#
</table> </table>

@ -84,7 +84,12 @@ public class IndexCreateIndexingQueue_p {
if (post.containsKey("clearIndexingQueue")) { if (post.containsKey("clearIndexingQueue")) {
try { try {
synchronized (switchboard.sbQueue) { synchronized (switchboard.sbQueue) {
switchboard.sbQueue.clear(); plasmaSwitchboardQueue.Entry entry = null;
while ((entry = switchboard.sbQueue.pop()) != null) {
if ((entry != null) && (entry.profile() != null) && (!(entry.profile().storeHTCache()))) {
switchboard.cacheManager.deleteFile(entry.url());
}
}
} }
} catch (Exception e) {} } catch (Exception e) {}
} else if (post.containsKey("deleteEntry")) { } else if (post.containsKey("deleteEntry")) {
@ -95,7 +100,10 @@ public class IndexCreateIndexingQueue_p {
for (int i=entries.size()-1; i >= 0; i--) { for (int i=entries.size()-1; i >= 0; i--) {
plasmaSwitchboardQueue.Entry pcentry = (plasmaSwitchboardQueue.Entry) entries.get(i); plasmaSwitchboardQueue.Entry pcentry = (plasmaSwitchboardQueue.Entry) entries.get(i);
if (pcentry.urlHash().equals(urlHash)) { if (pcentry.urlHash().equals(urlHash)) {
switchboard.sbQueue.remove(i); plasmaSwitchboardQueue.Entry entry = switchboard.sbQueue.remove(i);
if ((entry != null) && (entry.profile() != null) && (!(entry.profile().storeHTCache()))) {
switchboard.cacheManager.deleteFile(entry.url());
}
break; break;
} }
} }
@ -117,6 +125,7 @@ public class IndexCreateIndexingQueue_p {
dark = true; dark = true;
plasmaSwitchboardQueue.Entry pcentry; plasmaSwitchboardQueue.Entry pcentry;
int inProcessCount = 0, entryCount = 0; int inProcessCount = 0, entryCount = 0;
long totalSize = 0;
try { try {
ArrayList entryList = new ArrayList(); ArrayList entryList = new ArrayList();
@ -134,6 +143,8 @@ public class IndexCreateIndexingQueue_p {
for (int i = 0; i < entryList.size(); i++) { for (int i = 0; i < entryList.size(); i++) {
boolean inProcess = i < inProcessCount; boolean inProcess = i < inProcessCount;
pcentry = (plasmaSwitchboardQueue.Entry) entryList.get(i); pcentry = (plasmaSwitchboardQueue.Entry) entryList.get(i);
long entrySize = pcentry.size();
totalSize += entrySize;
if ((pcentry != null)&&(pcentry.url() != null)) { if ((pcentry != null)&&(pcentry.url() != null)) {
initiator = yacyCore.seedDB.getConnected(pcentry.initiator()); initiator = yacyCore.seedDB.getConnected(pcentry.initiator());
prop.put("indexing-queue_list_"+entryCount+"_dark", (inProcess)? 2: ((dark) ? 1 : 0)); prop.put("indexing-queue_list_"+entryCount+"_dark", (inProcess)? 2: ((dark) ? 1 : 0));
@ -142,9 +153,9 @@ public class IndexCreateIndexingQueue_p {
prop.put("indexing-queue_list_"+entryCount+"_modified", (pcentry.responseHeader() == null) ? "" : daydate(pcentry.responseHeader().lastModified())); 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+"_anchor", (pcentry.anchorName()==null)?"":pcentry.anchorName());
prop.put("indexing-queue_list_"+entryCount+"_url", pcentry.normalizedURLString()); 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+"_size", Status.bytesToString(entrySize));
prop.put("indexing-queue_list_"+entryCount+"_inProcess", (inProcess)?1:0); prop.put("indexing-queue_list_"+entryCount+"_inProcess", (inProcess)?1:0);
prop.put("indexing-queue_list_"+entryCount+"_0_hash", pcentry.urlHash()); prop.put("indexing-queue_list_"+entryCount+"_inProcess_hash", pcentry.urlHash());
dark = !dark; dark = !dark;
entryCount++; entryCount++;
} }
@ -152,6 +163,7 @@ public class IndexCreateIndexingQueue_p {
} catch (IOException e) {} } catch (IOException e) {}
prop.put("indexing-queue_num", entryCount);//num entries in queue prop.put("indexing-queue_num", entryCount);//num entries in queue
prop.put("indexing-queue_totalSize", Status.bytesToString(totalSize));//num entries in queue
prop.put("indexing-queue_list", entryCount); prop.put("indexing-queue_list", entryCount);
} }

Loading…
Cancel
Save