Merge branch 'master' of git://github.com/f1ori/yacy

pull/1/head
admin 13 years ago
commit 3c875f0841

@ -3,7 +3,7 @@ javacSource=1.6
javacTarget=1.6 javacTarget=1.6
# Release Configuration # Release Configuration
releaseVersion=0.99 releaseVersion=1.0
stdReleaseFile=yacy_v${releaseVersion}_${DSTAMP}_${releaseNr}.tar.gz stdReleaseFile=yacy_v${releaseVersion}_${DSTAMP}_${releaseNr}.tar.gz
sourceReleaseFile=yacy_src_v${releaseVersion}_${DSTAMP}_${releaseNr}.tar.gz sourceReleaseFile=yacy_src_v${releaseVersion}_${DSTAMP}_${releaseNr}.tar.gz
releaseFileParentDir=yacy releaseFileParentDir=yacy

@ -20,7 +20,7 @@ var modifiertype = "";
function search(search, count, offset) { function search(search, count, offset) {
var navhtml = document.getElementById("searchnavigation"); var navhtml = document.getElementById("searchnavigation");
if (navhtml != null) navhtml.innerHTML = "<div>loading...</div>"; if (navhtml != null) navhtml.innerHTML = "<div>loading from local index...</div>";
query = search; query = search;
maximumRecords = count; maximumRecords = count;
if (count == "") maximumRecords = 1000; if (count == "") maximumRecords = 1000;

@ -48,7 +48,7 @@ To see a list of all APIs, please visit the <a href="http://www.yacy-websuche.de
#%env/templates/simpleheader.template%# #%env/templates/simpleheader.template%#
#(/topmenu)# #(/topmenu)#
<div> <div>
<form class="search small" id="searchform" action="yacyinteractive.html" method="get" #(allowrealtime)#onsubmit="document.getElementById('searchnavigation').innerHTML = '<div>loading...</div>'"::onkeyup="xmlhttpPost(); return false;"#(/allowrealtime)#> <form class="search small" id="searchform" action="yacyinteractive.html" method="get" #(allowrealtime)#onsubmit="document.getElementById('searchnavigation').innerHTML = '<div>loading from local index...</div>'"::onkeyup="xmlhttpPost(); return false;"#(/allowrealtime)#>
<h2>#[promoteSearchPageGreeting]#</h2> <h2>#[promoteSearchPageGreeting]#</h2>
<div class="yacylogo"> <div class="yacylogo">
<a href="#[promoteSearchPageGreeting.homepage]#" class="yacylogo"><img src="#[promoteSearchPageGreeting.smallImage]#" alt="yacysearch"/></a> <a href="#[promoteSearchPageGreeting.homepage]#" class="yacylogo"><img src="#[promoteSearchPageGreeting.smallImage]#" alt="yacysearch"/></a>

@ -41,10 +41,11 @@ The source code is inside the release package (see /source and /htroot).
== WHERE IS THE DOCUMENTATION? == == WHERE IS THE DOCUMENTATION? ==
Documentation can be found at: Documentation can be found at:
(Home Page) http://yacy.net/ (Home Page) http://yacy.net/
(German Forum) http://forum.yacy.de/ (German Forum) http://forum.yacy.de/
(Wiki:de) http://www.yacy-websuche.de/wiki/index.php/De:Start (Wiki:de) http://www.yacy-websuche.de/wiki/index.php/De:Start
(Wiki:en) http://www.yacy-websearch.net/wiki/index.php/En:Start (Wiki:en) http://www.yacy-websearch.net/wiki/index.php/En:Start
(Tutorial Videos) http://yacy.net/en/Tutorials.html and http://yacy.net/de/Lehrfilme.html
Every of these locations has a (YaCy) search functionality which combines Every of these locations has a (YaCy) search functionality which combines
all these locations into one search result. all these locations into one search result.

@ -355,7 +355,7 @@ public final class CrawlStacker {
(entry.url().getFileExtension().length() > 0 && TextParser.supports(entry.url(), null) != null) (entry.url().getFileExtension().length() > 0 && TextParser.supports(entry.url(), null) != null)
*/) { */) {
warning = this.nextQueue.noticeURL.push(NoticedURL.StackType.NOLOAD, entry); warning = this.nextQueue.noticeURL.push(NoticedURL.StackType.NOLOAD, entry);
if (warning != null) this.log.logWarning("CrawlStacker.stackCrawl of URL " + entry.url().toNormalform(true, false) + " - not pushed: " + warning); //if (warning != null) this.log.logWarning("CrawlStacker.stackCrawl of URL " + entry.url().toNormalform(true, false) + " - not pushed: " + warning);
return null; return null;
} }

@ -52,21 +52,21 @@ import net.yacy.kelondro.order.Base64Order;
public final class Cache { public final class Cache {
private static final String RESPONSE_HEADER_DB_NAME = "responseHeader.heap"; private static final String RESPONSE_HEADER_DB_NAME = "responseHeader.heap";
private static final String FILE_DB_NAME = "file.array"; private static final String FILE_DB_NAME = "file.array";
private static Map<byte[], Map<String, String>> responseHeaderDB = null; private static Map<byte[], Map<String, String>> responseHeaderDB = null;
private static Compressor fileDB = null; private static Compressor fileDB = null;
private static ArrayStack fileDBunbuffered = null; private static ArrayStack fileDBunbuffered = null;
private static long maxCacheSize = Long.MAX_VALUE; private static long maxCacheSize = Long.MAX_VALUE;
private static File cachePath = null; private static File cachePath = null;
private static String prefix; private static String prefix;
public static final Log log = new Log("HTCACHE"); public static final Log log = new Log("HTCACHE");
public static void init(final File htCachePath, final String peerSalt, final long CacheSizeMax) { public static void init(final File htCachePath, final String peerSalt, final long CacheSizeMax) {
cachePath = htCachePath; cachePath = htCachePath;
maxCacheSize = CacheSizeMax; maxCacheSize = CacheSizeMax;
prefix = peerSalt; prefix = peerSalt;
@ -87,11 +87,11 @@ public final class Cache {
fileDBunbuffered = new ArrayStack(new File(cachePath, FILE_DB_NAME), prefix, Base64Order.enhancedCoder, 12, 1024 * 1024 * 2, false); fileDBunbuffered = new ArrayStack(new File(cachePath, FILE_DB_NAME), prefix, Base64Order.enhancedCoder, 12, 1024 * 1024 * 2, false);
fileDBunbuffered.setMaxSize(maxCacheSize); fileDBunbuffered.setMaxSize(maxCacheSize);
fileDB = new Compressor(fileDBunbuffered, 2 * 1024 * 1024); fileDB = new Compressor(fileDBunbuffered, 2 * 1024 * 1024);
} catch (IOException e) { } catch (final IOException e) {
Log.logException(e); Log.logException(e);
} }
} }
/** /**
* clear the cache * clear the cache
*/ */
@ -99,12 +99,12 @@ public final class Cache {
responseHeaderDB.clear(); responseHeaderDB.clear();
try { try {
fileDB.clear(); fileDB.clear();
} catch (IOException e) { } catch (final IOException e) {
Log.logException(e); Log.logException(e);
} }
try { try {
fileDBunbuffered.clear(); fileDBunbuffered.clear();
} catch (IOException e) { } catch (final IOException e) {
Log.logException(e); Log.logException(e);
} }
} }
@ -117,7 +117,7 @@ public final class Cache {
maxCacheSize = newCacheSize; maxCacheSize = newCacheSize;
fileDBunbuffered.setMaxSize(maxCacheSize); fileDBunbuffered.setMaxSize(maxCacheSize);
} }
/** /**
* get the current actual cache size * get the current actual cache size
* @return * @return
@ -125,7 +125,7 @@ public final class Cache {
public static long getActualCacheSize() { public static long getActualCacheSize() {
return fileDBunbuffered.length(); return fileDBunbuffered.length();
} }
/** /**
* close the databases * close the databases
*/ */
@ -135,7 +135,7 @@ public final class Cache {
} }
fileDB.close(true); fileDB.close(true);
} }
public static void store(final DigestURI url, final ResponseHeader responseHeader, final byte[] file) throws IOException { public static void store(final DigestURI url, final ResponseHeader responseHeader, final byte[] file) throws IOException {
if (responseHeader == null) throw new IOException("Cache.store of url " + url.toString() + " not possible: responseHeader == null"); if (responseHeader == null) throw new IOException("Cache.store of url " + url.toString() + " not possible: responseHeader == null");
if (file == null) throw new IOException("Cache.store of url " + url.toString() + " not possible: file == null"); if (file == null) throw new IOException("Cache.store of url " + url.toString() + " not possible: file == null");
@ -144,12 +144,12 @@ public final class Cache {
// store the file // store the file
try { try {
fileDB.insert(url.hash(), file); fileDB.insert(url.hash(), file);
} catch (UnsupportedEncodingException e) { } catch (final UnsupportedEncodingException e) {
throw new IOException("Cache.store: cannot write to fileDB (1): " + e.getMessage()); throw new IOException("Cache.store: cannot write to fileDB (1): " + e.getMessage());
} catch (IOException e) { } catch (final IOException e) {
throw new IOException("Cache.store: cannot write to fileDB (2): " + e.getMessage()); throw new IOException("Cache.store: cannot write to fileDB (2): " + e.getMessage());
} }
// store the response header into the header database // store the response header into the header database
final HashMap<String, String> hm = new HashMap<String, String>(); final HashMap<String, String> hm = new HashMap<String, String>();
hm.putAll(responseHeader); hm.putAll(responseHeader);
@ -160,12 +160,12 @@ public final class Cache {
} else { } else {
responseHeaderDB.put(url.hash(), hm); responseHeaderDB.put(url.hash(), hm);
} }
} catch (Exception e) { } catch (final Exception e) {
throw new IOException("Cache.store: cannot write to headerDB: " + e.getMessage()); throw new IOException("Cache.store: cannot write to headerDB: " + e.getMessage());
} }
if (log.isFine()) log.logFine("stored in cache: " + url.toNormalform(true, false)); if (log.isFine()) log.logFine("stored in cache: " + url.toNormalform(true, false));
} }
/** /**
* check if the responseHeaderDB and the fileDB has an entry for the given url * check if the responseHeaderDB and the fileDB has an entry for the given url
* @param url the url of the resource * @param url the url of the resource
@ -188,14 +188,14 @@ public final class Cache {
} else { } else {
responseHeaderDB.remove(url.hash()); responseHeaderDB.remove(url.hash());
} }
} catch (IOException e) {} } catch (final IOException e) {}
if (fileExists) try { if (fileExists) try {
log.logWarning("content but not header of url " + url.toString() + " in cache; cleaned up"); //log.logWarning("content but not header of url " + url.toString() + " in cache; cleaned up");
fileDB.delete(url.hash()); fileDB.delete(url.hash());
} catch (IOException e) {} } catch (final IOException e) {}
return false; return false;
} }
/** /**
* Returns an object containing metadata about a cached resource * Returns an object containing metadata about a cached resource
* @param url the {@link URL} of the resource * @param url the {@link URL} of the resource
@ -205,46 +205,46 @@ public final class Cache {
* @throws <b>UnsupportedProtocolException</b> if the protocol is not supported and therefore the * @throws <b>UnsupportedProtocolException</b> if the protocol is not supported and therefore the
* info object couldn't be created * info object couldn't be created
*/ */
public static ResponseHeader getResponseHeader(final byte[] hash) { public static ResponseHeader getResponseHeader(final byte[] hash) {
// loading data from database // loading data from database
Map<String, String> hdb; Map<String, String> hdb;
hdb = responseHeaderDB.get(hash); hdb = responseHeaderDB.get(hash);
if (hdb == null) return null; if (hdb == null) return null;
return new ResponseHeader(null, hdb); return new ResponseHeader(null, hdb);
} }
/** /**
* Returns the content of a cached resource as byte[] * Returns the content of a cached resource as byte[]
* @param url the requested resource * @param url the requested resource
* @return the resource content as byte[]. If no data * @return the resource content as byte[]. If no data
* is available or the cached file is not readable, <code>null</code> * is available or the cached file is not readable, <code>null</code>
* is returned. * is returned.
* @throws IOException * @throws IOException
*/ */
public static byte[] getContent(final byte[] hash) { public static byte[] getContent(final byte[] hash) {
// load the url as resource from the cache // load the url as resource from the cache
try { try {
byte[] b = fileDB.get(hash); final byte[] b = fileDB.get(hash);
if (b == null) return null; if (b == null) return null;
return b; return b;
} catch (UnsupportedEncodingException e) { } catch (final UnsupportedEncodingException e) {
Log.logException(e); Log.logException(e);
return null; return null;
} catch (IOException e) { } catch (final IOException e) {
Log.logException(e); Log.logException(e);
return null; return null;
} catch (RowSpaceExceededException e) { } catch (final RowSpaceExceededException e) {
Log.logException(e); Log.logException(e);
return null; return null;
} catch (OutOfMemoryError e) { } catch (final OutOfMemoryError e) {
Log.logException(e); Log.logException(e);
return null; return null;
} }
} }
/** /**
* removed response header and cached content from the database * removed response header and cached content from the database
* @param url * @param url

@ -7,7 +7,7 @@
// $LastChangedBy$ // $LastChangedBy$
// //
// LICENSE // LICENSE
// //
// This program is free software; you can redistribute it and/or modify // This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or // the Free Software Foundation; either version 2 of the License, or
@ -33,7 +33,6 @@ import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import net.yacy.kelondro.logging.Log; import net.yacy.kelondro.logging.Log;
import net.yacy.kelondro.util.NamePrefixThreadFactory; import net.yacy.kelondro.util.NamePrefixThreadFactory;
@ -50,9 +49,9 @@ public class WorkflowProcessor<J extends WorkflowJob> {
private final Object environment; private final Object environment;
private final String processName, methodName, description; private final String processName, methodName, description;
private final String[] childs; private final String[] childs;
private long blockTime, execTime, passOnTime; private long blockTime, execTime, passOnTime;
private long execCount; private long execCount;
public WorkflowProcessor( public WorkflowProcessor(
final String name, final String description, final String[] childnames, final String name, final String description, final String[] childnames,
final Object env, final String jobExecMethod, final Object env, final String jobExecMethod,
@ -71,57 +70,57 @@ public class WorkflowProcessor<J extends WorkflowJob> {
this.executor.submit(new InstantBlockingThread<J>(env, jobExecMethod, this)); this.executor.submit(new InstantBlockingThread<J>(env, jobExecMethod, this));
} }
// init statistics // init statistics
blockTime = 0; this.blockTime = 0;
execTime = 0; this.execTime = 0;
passOnTime = 0; this.passOnTime = 0;
execCount = 0; this.execCount = 0;
// store this object for easy monitoring // store this object for easy monitoring
processMonitor.add(this); processMonitor.add(this);
} }
public int queueSize() { public int queueSize() {
return this.input.size(); return this.input.size();
} }
public boolean queueIsEmpty() { public boolean queueIsEmpty() {
return this.input.isEmpty(); return this.input.isEmpty();
} }
public int queueSizeMax() { public int queueSizeMax() {
return this.input.size() + this.input.remainingCapacity(); return this.input.size() + this.input.remainingCapacity();
} }
public int concurrency() { public int concurrency() {
return this.poolsize; return this.poolsize;
} }
public J take() throws InterruptedException { public J take() throws InterruptedException {
// read from the input queue // read from the input queue
if (this.input == null) return null; if (this.input == null) return null;
long t = System.currentTimeMillis(); final long t = System.currentTimeMillis();
J j = this.input.take(); final J j = this.input.take();
this.blockTime += System.currentTimeMillis() - t; this.blockTime += System.currentTimeMillis() - t;
return j; return j;
} }
public void passOn(final J next) throws InterruptedException { public void passOn(final J next) throws InterruptedException {
// don't mix this method up with enQueue()! // don't mix this method up with enQueue()!
// this method enqueues into the _next_ queue, not this queue! // this method enqueues into the _next_ queue, not this queue!
if (this.output == null) return; if (this.output == null) return;
long t = System.currentTimeMillis(); final long t = System.currentTimeMillis();
this.output.enQueue(next); this.output.enQueue(next);
this.passOnTime += System.currentTimeMillis() - t; this.passOnTime += System.currentTimeMillis() - t;
} }
public void clear() { public void clear() {
if (this.input != null) this.input.clear(); if (this.input != null) this.input.clear();
} }
public synchronized void relaxCapacity() { public synchronized void relaxCapacity() {
if (this.input.isEmpty()) return; if (this.input.isEmpty()) return;
if (this.input.remainingCapacity() > 1000) return; if (this.input.remainingCapacity() > 1000) return;
BlockingQueue<J> i = new LinkedBlockingQueue<J>(); final BlockingQueue<J> i = new LinkedBlockingQueue<J>();
J e; J e;
while (!this.input.isEmpty()) { while (!this.input.isEmpty()) {
e = this.input.poll(); e = this.input.poll();
@ -130,15 +129,15 @@ public class WorkflowProcessor<J extends WorkflowJob> {
} }
this.input = i; this.input = i;
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void enQueue(final J in) throws InterruptedException { public void enQueue(final J in) throws InterruptedException {
// ensure that enough job executors are running // ensure that enough job executors are running
if ((this.input == null) || (executor == null) || (executor.isShutdown()) || (executor.isTerminated())) { if ((this.input == null) || (this.executor == null) || (this.executor.isShutdown()) || (this.executor.isTerminated())) {
// execute serialized without extra thread // execute serialized without extra thread
Log.logWarning("PROCESSOR", "executing job " + environment.getClass().getName() + "." + methodName + " serialized"); //Log.logWarning("PROCESSOR", "executing job " + environment.getClass().getName() + "." + methodName + " serialized");
try { try {
final J out = (J) InstantBlockingThread.execMethod(this.environment, this.methodName).invoke(environment, new Object[]{in}); final J out = (J) InstantBlockingThread.execMethod(this.environment, this.methodName).invoke(this.environment, new Object[]{in});
if (out != null && this.output != null) this.output.enQueue(out); if (out != null && this.output != null) this.output.enQueue(out);
} catch (final IllegalArgumentException e) { } catch (final IllegalArgumentException e) {
Log.logException(e); Log.logException(e);
@ -154,41 +153,41 @@ public class WorkflowProcessor<J extends WorkflowJob> {
try { try {
this.input.put(in); this.input.put(in);
break; break;
} catch (InterruptedException e) { } catch (final InterruptedException e) {
try {Thread.sleep(10);} catch (InterruptedException ee) {} try {Thread.sleep(10);} catch (final InterruptedException ee) {}
} }
} }
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void announceShutdown() { public void announceShutdown() {
if (executor == null) return; if (this.executor == null) return;
if (executor.isShutdown()) return; if (this.executor.isShutdown()) return;
// before we put pills into the queue, make sure that they will take them // before we put pills into the queue, make sure that they will take them
relaxCapacity(); relaxCapacity();
// put poison pills into the queue // put poison pills into the queue
for (int i = 0; i < poolsize; i++) { for (int i = 0; i < this.poolsize; i++) {
try { try {
Log.logInfo("serverProcessor", "putting poison pill in queue " + this.processName + ", thread " + i); Log.logInfo("serverProcessor", "putting poison pill in queue " + this.processName + ", thread " + i);
input.put((J) WorkflowJob.poisonPill); // put a poison pill into the queue which will kill the job this.input.put((J) WorkflowJob.poisonPill); // put a poison pill into the queue which will kill the job
Log.logInfo("serverProcessor", ".. poison pill is in queue " + this.processName + ", thread " + i + ". awaiting termination"); Log.logInfo("serverProcessor", ".. poison pill is in queue " + this.processName + ", thread " + i + ". awaiting termination");
} catch (final InterruptedException e) { } } catch (final InterruptedException e) { }
} }
} }
public void awaitShutdown(final long millisTimeout) { public void awaitShutdown(final long millisTimeout) {
if (executor != null & !executor.isShutdown()) { if (this.executor != null & !this.executor.isShutdown()) {
// wait for shutdown // wait for shutdown
try { try {
executor.shutdown(); this.executor.shutdown();
executor.awaitTermination(millisTimeout, TimeUnit.MILLISECONDS); this.executor.awaitTermination(millisTimeout, TimeUnit.MILLISECONDS);
} catch (final InterruptedException e) {} } catch (final InterruptedException e) {}
} }
Log.logInfo("serverProcessor", "queue " + this.processName + ": shutdown."); Log.logInfo("serverProcessor", "queue " + this.processName + ": shutdown.");
this.executor = null; this.executor = null;
this.input = null; this.input = null;
// remove entry from monitor // remove entry from monitor
Iterator<WorkflowProcessor<?>> i = processes(); final Iterator<WorkflowProcessor<?>> i = processes();
WorkflowProcessor<?> p; WorkflowProcessor<?> p;
while (i.hasNext()) { while (i.hasNext()) {
p = i.next(); p = i.next();
@ -198,59 +197,59 @@ public class WorkflowProcessor<J extends WorkflowJob> {
} }
} }
} }
public static Iterator<WorkflowProcessor<?>> processes() { public static Iterator<WorkflowProcessor<?>> processes() {
return processMonitor.iterator(); return processMonitor.iterator();
} }
protected void increaseJobTime(final long time) { protected void increaseJobTime(final long time) {
this.execTime += time; this.execTime += time;
this.execCount++; this.execCount++;
} }
public String getName() { public String getName() {
return this.processName; return this.processName;
} }
public String getDescription() { public String getDescription() {
return this.description; return this.description;
} }
public String getChilds() { public String getChilds() {
StringBuilder s = new StringBuilder(this.childs.length * 40 + 1); final StringBuilder s = new StringBuilder(this.childs.length * 40 + 1);
for (int i = 0; i < this.childs.length; i++) { for (final String child : this.childs) {
s.append(this.childs[i]); s.append(child);
s.append(' '); s.append(' ');
} }
return s.toString(); return s.toString();
} }
/** /**
* the block time is the time that a take() blocks until it gets a value * the block time is the time that a take() blocks until it gets a value
* @return * @return
*/ */
public long getBlockTime() { public long getBlockTime() {
return blockTime; return this.blockTime;
} }
/** /**
* the exec time is the complete time of the execution and processing of the value from take() * the exec time is the complete time of the execution and processing of the value from take()
* @return * @return
*/ */
public long getExecTime() { public long getExecTime() {
return execTime; return this.execTime;
} }
public long getExecCount() { public long getExecCount() {
return execCount; return this.execCount;
} }
/** /**
* the passOn time is the time that a put() takes to enqueue a result value to the next queue * the passOn time is the time that a put() takes to enqueue a result value to the next queue
* in case that the target queue is limited and may be full, this value may increase * in case that the target queue is limited and may be full, this value may increase
* @return * @return
*/ */
public long getPassOnTime() { public long getPassOnTime() {
return passOnTime; return this.passOnTime;
} }
} }

@ -315,7 +315,7 @@ public final class yacy {
//boolean properPW = (sb.getConfig("adminAccount", "").length() == 0) && (sb.getConfig(httpd.ADMIN_ACCOUNT_B64MD5, "").length() > 0); //boolean properPW = (sb.getConfig("adminAccount", "").length() == 0) && (sb.getConfig(httpd.ADMIN_ACCOUNT_B64MD5, "").length() > 0);
//if (!properPW) browserPopUpPage = "ConfigBasic.html"; //if (!properPW) browserPopUpPage = "ConfigBasic.html";
Browser.openBrowser((server.withSSL()?"https":"http") + "://localhost:" + serverCore.getPortNr(port) + "/" + browserPopUpPage); Browser.openBrowser((server.withSSL()?"https":"http") + "://localhost:" + serverCore.getPortNr(port) + "/" + browserPopUpPage);
} catch (final RuntimeException e) { } catch (final Throwable e) {
// cannot open browser. This may be normal in headless environments // cannot open browser. This may be normal in headless environments
//Log.logException(e); //Log.logException(e);
} }

Loading…
Cancel
Save