performance hack for Balancer and ip address parsing

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@7608 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 14 years ago
parent 43e1660512
commit 2b5f8585bf

@ -451,16 +451,16 @@ public class Balancer {
// this is only to protection against the worst case, where the crawler could
// behave in a DoS-manner
Log.logInfo("BALANCER", "forcing crawl-delay of " + sleeptime + " milliseconds for " + crawlEntry.url().getHost() + ": " + Latency.waitingRemainingExplain(crawlEntry.url(), minimumLocalDelta, minimumGlobalDelta) + ", top.size() = " + top.size() + ", delayed.size() = " + delayed.size() + ", domainStacks.size() = " + domainStacks.size() + ", domainStacksInitSize = " + this.domStackInitSize);
long loops = sleeptime / 3000;
long rest = sleeptime % 3000;
long loops = sleeptime / 1000;
long rest = sleeptime % 1000;
if (loops < 2) {
rest = rest + 3000 * loops;
rest = rest + 1000 * loops;
loops = 0;
}
if (rest > 0) {try {synchronized(this) { this.wait(rest); }} catch (final InterruptedException e) {}}
if (rest > 0) {try {this.wait(rest); } catch (final InterruptedException e) {}}
for (int i = 0; i < loops; i++) {
Log.logInfo("BALANCER", "waiting for " + crawlEntry.url().getHost() + ": " + ((loops - i) * 3) + " seconds remaining...");
try {synchronized(this) { this.wait(3000); }} catch (final InterruptedException e) {}
try {this.wait(1000); } catch (final InterruptedException e) {}
}
}
this.ddc.remove(crawlEntry.url().hash());

@ -532,9 +532,11 @@ public class Domains {
return null;
}
private final static Pattern dotPattern = Pattern.compile("\\.");
private static final InetAddress parseInetAddress(final String ip) {
if (ip == null || ip.length() < 8) return null;
final String[] ips = ip.split("\\.");
final String[] ips = dotPattern.split(ip);
if (ips.length != 4) return null;
final byte[] ipb = new byte[4];
try {

@ -47,7 +47,7 @@ public class ThreadDump extends HashMap<ThreadDump.StackTrace, List<String>> imp
private static final long serialVersionUID = -5587850671040354397L;
private static final String multiDumpFilter = ".*((java.net.DatagramSocket.receive)|(java.lang.Thread.getAllStackTraces)|(java.net.SocketInputStream.read)|(java.net.ServerSocket.accept)).*";
private static final String multiDumpFilter = ".*((java.net.DatagramSocket.receive)|(java.lang.Thread.getAllStackTraces)|(java.net.SocketInputStream.read)|(java.net.ServerSocket.accept)|(java.net.Socket.connect)).*";
private static final Pattern multiDumpFilterPattern = Pattern.compile(multiDumpFilter);
public static class StackTrace {

Loading…
Cancel
Save