mirror of
https://github.com/yacy/yacy_search_server.git
synced 2024-09-19 00:01:41 +02:00
some code enhancements and bugfixes
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@4542 6c8d7289-2bf4-0310-a012-ef5d649a1542
This commit is contained in:
parent
b4b370586a
commit
7cc4ff05c9
|
@ -1,10 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry excluding="env/|htdocsdefault/|proxymsg/|yacy/|env/|yacy/user/|yacy/user/" kind="src" path="htroot"/>
|
||||
<classpathentry excluding="user/|user/" kind="src" path="htroot/yacy"/>
|
||||
<classpathentry excluding="env/|htdocsdefault/|proxymsg/|yacy/|env/|yacy/user/|yacy/user/|yacy/ui/" kind="src" path="htroot"/>
|
||||
<classpathentry excluding="user/|user/|ui/" kind="src" path="htroot/yacy"/>
|
||||
<classpathentry kind="src" path="htroot/env"/>
|
||||
<classpathentry kind="src" path="source"/>
|
||||
<classpathentry kind="src" path="htroot/yacy/user"/>
|
||||
<classpathentry kind="src" path="htroot/yacy/ui"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="lib" path="lib/tar.jar"/>
|
||||
<classpathentry kind="lib" path="libx/axis-ant.jar"/>
|
||||
|
|
|
@ -1036,7 +1036,7 @@ public final class httpd implements serverHandler {
|
|||
return true;
|
||||
}
|
||||
|
||||
public Object clone() {
|
||||
public httpd clone() {
|
||||
return new httpd(switchboard);
|
||||
}
|
||||
|
||||
|
|
|
@ -105,7 +105,7 @@ public class icapd implements serverHandler {
|
|||
|
||||
}
|
||||
|
||||
public Object clone(){
|
||||
public icapd clone(){
|
||||
return new icapd();
|
||||
}
|
||||
|
||||
|
|
|
@ -163,7 +163,7 @@ public final class indexRWIRowEntry implements indexRWIEntry {
|
|||
return (int) (time / 86400000);
|
||||
}
|
||||
|
||||
public Object clone() {
|
||||
public indexRWIRowEntry clone() {
|
||||
byte[] b = new byte[urlEntryRow.objectsize];
|
||||
System.arraycopy(entry.bytes(), 0, b, 0, urlEntryRow.objectsize);
|
||||
return new indexRWIRowEntry(b);
|
||||
|
|
|
@ -720,7 +720,7 @@ public abstract class kelondroAbstractRecords implements kelondroRecords {
|
|||
// check handle
|
||||
seekp = seekpos(h);
|
||||
if (seekp > entryFile.length()) {
|
||||
// repair last hande store position
|
||||
// repair last handle store position
|
||||
this.theLogger.severe("KELONDRO WARNING " + this.filename + ": seek position " + seekp + "/" + h.index + " out of file size " + entryFile.length() + "/" + ((entryFile.length() - POS_NODES) / recordsize) + " after " + markedDeleted.size() + " iterations; patched wrong node");
|
||||
entryFile.writeInt(repair_position, kelondroHandle.NUL);
|
||||
return markedDeleted;
|
||||
|
@ -871,6 +871,7 @@ public abstract class kelondroAbstractRecords implements kelondroRecords {
|
|||
return new contentRowIterator(maxInitTime);
|
||||
}
|
||||
|
||||
/*
|
||||
public final class contentRowIterator implements Iterator<EntryIndex> {
|
||||
// iterator that iterates all kelondroRow.Entry-objects in the file
|
||||
// all records that are marked as deleted are omitted
|
||||
|
@ -885,6 +886,15 @@ public abstract class kelondroAbstractRecords implements kelondroRecords {
|
|||
return nodeIterator.hasNext();
|
||||
}
|
||||
|
||||
public EntryIndex next0() {
|
||||
try {
|
||||
kelondroNode n = (kelondroNode) nodeIterator.next();
|
||||
return row().newEntryIndex(n.getValueRow(), n.handle().index);
|
||||
} catch (IOException e) {
|
||||
throw new kelondroException(filename, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public EntryIndex next() {
|
||||
try {
|
||||
kelondroNode n = (kelondroNode) nodeIterator.next();
|
||||
|
@ -898,6 +908,54 @@ public abstract class kelondroAbstractRecords implements kelondroRecords {
|
|||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
public final class contentRowIterator implements Iterator<EntryIndex> {
|
||||
// iterator that iterates all kelondroRow.Entry-objects in the file
|
||||
// all records that are marked as deleted are omitted
|
||||
|
||||
private Iterator<kelondroNode> nodeIterator;
|
||||
private EntryIndex nextEntry;
|
||||
|
||||
public contentRowIterator(long maxInitTime) {
|
||||
nodeIterator = contentNodes(maxInitTime);
|
||||
if (nodeIterator.hasNext()) nextEntry = next0(); else nextEntry = null;
|
||||
}
|
||||
|
||||
public boolean hasNext() {
|
||||
return nextEntry != null;
|
||||
}
|
||||
|
||||
public EntryIndex next0() {
|
||||
if (!nodeIterator.hasNext()) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
kelondroNode n = (kelondroNode) nodeIterator.next();
|
||||
return row().newEntryIndex(n.getValueRow(), n.handle().index);
|
||||
} catch (IOException e) {
|
||||
throw new kelondroException(filename, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public EntryIndex next() {
|
||||
EntryIndex ni = nextEntry;
|
||||
byte[] b;
|
||||
nextEntry = null;
|
||||
while (nodeIterator.hasNext()) {
|
||||
nextEntry = next0();
|
||||
if (nextEntry == null) break;
|
||||
b = nextEntry.bytes();
|
||||
if ((b[0] != -128) || (b[1] != 0)) break;
|
||||
}
|
||||
return ni;
|
||||
}
|
||||
|
||||
public void remove() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected final Iterator<kelondroNode> contentNodes(long maxInitTime) throws kelondroException {
|
||||
|
|
|
@ -55,7 +55,7 @@ public class kelondroBitfield implements Cloneable {
|
|||
}
|
||||
}
|
||||
|
||||
public Object clone() {
|
||||
public kelondroBitfield clone() {
|
||||
kelondroBitfield theClone = new kelondroBitfield(new byte[this.bb.length]);
|
||||
System.arraycopy(this.bb, 0, theClone.bb, 0, this.bb.length);
|
||||
return theClone;
|
||||
|
|
|
@ -272,13 +272,13 @@ public final class kelondroMScoreCluster<E> {
|
|||
return (int) ((keyrefDB.firstKey().longValue() & 0xFFFFFFFF00000000L) >> 32);
|
||||
}
|
||||
|
||||
public synchronized Object getMaxObject() {
|
||||
public synchronized E getMaxObject() {
|
||||
if (refkeyDB.size() == 0) return null;
|
||||
//return getScores(1, false)[0];
|
||||
return keyrefDB.get(keyrefDB.lastKey());
|
||||
}
|
||||
|
||||
public synchronized Object getMinObject() {
|
||||
public synchronized E getMinObject() {
|
||||
if (refkeyDB.size() == 0) return null;
|
||||
//return getScores(1, true)[0];
|
||||
return keyrefDB.get(keyrefDB.firstKey());
|
||||
|
|
|
@ -81,7 +81,7 @@ public class kelondroProfile implements Cloneable {
|
|||
accDelete += System.currentTimeMillis() - handle;
|
||||
}
|
||||
|
||||
public Object clone() {
|
||||
public kelondroProfile clone() {
|
||||
kelondroProfile clone = new kelondroProfile();
|
||||
clone.accRead = this.accRead;
|
||||
clone.accWrite = this.accWrite;
|
||||
|
|
|
@ -1705,7 +1705,7 @@ cd ..
|
|||
// write remote file to local file
|
||||
byte[] block = new byte[blockSize];
|
||||
int numRead;
|
||||
long length = 0;
|
||||
int length = 0;
|
||||
|
||||
while ((numRead = ClientStream.read(block)) != -1) {
|
||||
outFile.write(block, 0, numRead);
|
||||
|
@ -1726,7 +1726,7 @@ cd ..
|
|||
// write statistics
|
||||
long stop = System.currentTimeMillis();
|
||||
out.print("---- downloaded " +
|
||||
((length < 2048) ? length + " bytes" : ((int) length / 1024) + " kbytes") +
|
||||
((length < 2048) ? length + " bytes" : (length / 1024) + " kbytes") +
|
||||
" in " +
|
||||
(((stop - start) < 2000) ? (stop - start) + " milliseconds" : (((int) ((stop - start) / 100)) / 10) + " seconds"));
|
||||
if (start == stop) err.println(logPrefix + ""); else
|
||||
|
|
|
@ -1020,7 +1020,7 @@ public final class plasmaHTCache {
|
|||
*/
|
||||
private IResourceInfo resInfo;
|
||||
|
||||
protected Object clone() throws CloneNotSupportedException {
|
||||
protected Entry clone() throws CloneNotSupportedException {
|
||||
return new Entry(
|
||||
this.initDate,
|
||||
this.depth,
|
||||
|
|
|
@ -109,7 +109,7 @@ public interface serverHandler {
|
|||
// each time a server makes a new connection it clones the hanlder prototype
|
||||
// the clone method does not need to clone every detail of a handler connection,
|
||||
// but only the necessary one for a newly initialized instance
|
||||
public Object clone();
|
||||
public serverHandler clone();
|
||||
|
||||
/**
|
||||
* Instead of using clone this function can be used to reset an existing
|
||||
|
|
|
@ -58,7 +58,7 @@ public class disorderSet extends HashSet<String> implements Set<String> {
|
|||
return (this.size() > 0);
|
||||
}
|
||||
|
||||
public Object any() {
|
||||
public String any() {
|
||||
// return just any element
|
||||
if ((dh == null) || (dh.size() == 0)) {
|
||||
if (this.size() == 0) return null;
|
||||
|
|
|
@ -90,7 +90,7 @@ public class urlRedirectord implements serverHandler {
|
|||
return null;
|
||||
}
|
||||
|
||||
public Object clone() {
|
||||
public urlRedirectord clone() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -860,9 +860,9 @@ public class yacySeed {
|
|||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public final Object clone() {
|
||||
public final yacySeed clone() {
|
||||
synchronized (this.dna) {
|
||||
return new yacySeed(this.hash, (HashMap<String, String>) (new HashMap<String, String>(this.dna)).clone());
|
||||
return new yacySeed(this.hash, (HashMap<String, String>) (new HashMap<String, String>(this.dna).clone()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user