more generics

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@4305 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 17 years ago
parent e9ceae77df
commit 03e7782269

@ -126,7 +126,7 @@ public class AccessTracker_p {
prop.put("page_num", entCount);
}
if ((page == 2) || (page == 4)) {
ArrayList array = (page == 2) ? switchboard.localSearches : switchboard.remoteSearches;
ArrayList<HashMap<String, Object>> array = (page == 2) ? switchboard.localSearches : switchboard.remoteSearches;
Long trackerHandle;
HashMap searchProfile;
int m = Math.min(maxCount, array.size());
@ -138,7 +138,7 @@ public class AccessTracker_p {
long rtimeSum = 0;
for (int entCount = 0; entCount < m; entCount++) {
searchProfile = (HashMap) array.get(array.size() - entCount - 1);
searchProfile = (HashMap<String, Object>) array.get(array.size() - entCount - 1);
trackerHandle = (Long) searchProfile.get("time");
// put values in template
@ -150,7 +150,7 @@ public class AccessTracker_p {
if (page == 2) {
// local search
prop.putNum("page_list_" + entCount + "_offset", ((Integer) searchProfile.get("offset")).longValue());
prop.put("page_list_" + entCount + "_querystring", searchProfile.get("querystring"));
prop.put("page_list_" + entCount + "_querystring", (String) searchProfile.get("querystring"));
} else {
// remote search
prop.putHTML("page_list_" + entCount + "_peername", (String) searchProfile.get("peername"));

@ -247,13 +247,13 @@ public class Blog {
}
else prop.put("mode", "3"); //access denied (no rights)
}
else if(post.containsKey("import")) {
else if (post.containsKey("import")) {
prop.put("mode", "5");
prop.put("mode_state", "0");
}
else if(post.containsKey("xmlfile")) {
else if (post.containsKey("xmlfile")) {
prop.put("mode", "5");
if(switchboard.blogDB.importXML(new String((byte[])post.get("xmlfile$file")))) {
if(switchboard.blogDB.importXML(post.get("xmlfile$file"))) {
prop.put("mode_state", "1");
}
else {

@ -214,7 +214,7 @@ public class Bookmarks {
}
try {
File file=new File((String)post.get("bookmarksfile"));
switchboard.bookmarksDB.importFromBookmarks(new yacyURL(file) , new String((byte[])post.get("bookmarksfile$file")), tags, isPublic);
switchboard.bookmarksDB.importFromBookmarks(new yacyURL(file) , post.get("bookmarksfile$file"), tags, isPublic);
} catch (MalformedURLException e) {}
}else if(post.containsKey("xmlfile")){
@ -222,7 +222,7 @@ public class Bookmarks {
if(((String) post.get("public")).equals("public")){
isPublic=true;
}
switchboard.bookmarksDB.importFromXML(new String((byte[])post.get("xmlfile$file")), isPublic);
switchboard.bookmarksDB.importFromXML(post.get("xmlfile$file"), isPublic);
}else if(post.containsKey("delete")){
String urlHash=(String) post.get("delete");
switchboard.bookmarksDB.removeBookmark(urlHash);
@ -264,8 +264,8 @@ public class Bookmarks {
count++;
}
count=0;
Set tags;
Iterator tagsIt;
Set<String> tags;
Iterator<String> tagsIt;
int tagCount;
while(count<max_count && it.hasNext()){
bookmark=switchboard.bookmarksDB.getBookmark((String)it.next());
@ -284,7 +284,7 @@ public class Bookmarks {
tags=bookmark.getTags();
tagsIt=tags.iterator();
tagCount=0;
while(tagsIt.hasNext()){
while (tagsIt.hasNext()) {
prop.put("bookmarks_"+count+"_tags_"+tagCount+"_tag", tagsIt.next());
tagCount++;
}

@ -267,8 +267,8 @@ public class CacheAdmin_p {
Map.Entry entry;
while (iter.hasNext()) {
entry = (Map.Entry) iter.next();
prop.put("info_header_line_" + i + "_property", entry.getKey());
prop.put("info_header_line_" + i + "_value", entry.getValue());
prop.put("info_header_line_" + i + "_property", (String) entry.getKey());
prop.put("info_header_line_" + i + "_value", (String) entry.getValue());
i++;
}
prop.put("info_header_line", i);

@ -52,8 +52,6 @@ import java.net.URLEncoder;
import java.util.Arrays;
import java.util.Properties;
import org.apache.commons.pool.impl.GenericObjectPool;
import de.anomic.http.httpHeader;
import de.anomic.http.httpc;
import de.anomic.http.httpd;
@ -77,22 +75,16 @@ public final class Connections_p {
serverObjects prop = new serverObjects();
// getting the virtualHost string
// get the virtualHost string
String virtualHost = switchboard.getConfig("fileHost","localhost");
// getting the serverCore thread
// get the serverCore thread
serverThread httpd = switchboard.getThread("10_httpd");
// getting the session threadgroup
ThreadGroup httpSessions = ((serverCore)httpd).getSessionThreadGroup();
// getting the server core pool configuration
GenericObjectPool.Config httpdPoolConfig = ((serverCore)httpd).getPoolConfig();
/* waiting for all threads to finish */
int threadCount = httpSessions.activeCount();
Thread[] threadList = new Thread[httpdPoolConfig.maxActive];
threadCount = httpSessions.enumerate(threadList);
int threadCount = serverCore.sessionThreadGroup.activeCount();
Thread[] threadList = new Thread[((serverCore) httpd).getJobCount()];
threadCount = serverCore.sessionThreadGroup.enumerate(threadList);
// determines if name lookup should be done or not
boolean doNameLookup = false;
@ -130,19 +122,15 @@ public final class Connections_p {
if (currentThread.isAlive()) {
try { currentThread.join(500); } catch (InterruptedException ex) {}
}
}
}
}
prop.put("LOCATION","");
return prop;
}
}
int idx = 0, numActiveRunning = 0, numActivePending = 0, numMax = ((serverCore)httpd).getMaxSessionCount();
int idx = 0, numActiveRunning = 0, numActivePending = 0;
boolean dark = true;
for ( int currentThreadIdx = 0; currentThreadIdx < threadCount; currentThreadIdx++ ) {
Thread currentThread = threadList[currentThreadIdx];
@ -236,7 +224,7 @@ public final class Connections_p {
}
prop.put("list", idx);
prop.putNum("numMax", numMax);
prop.putNum("numMax", ((serverCore)httpd).getMaxSessionCount());
prop.putNum("numActiveRunning", numActiveRunning);
prop.putNum("numActivePending", numActivePending);

@ -171,13 +171,13 @@ public class CrawlProfileEditor_p {
count = 0;
while (it.hasNext()) {
eentry ee = (eentry) it.next();
Object val = selentry.map().get(ee.name);
String val = selentry.map().get(ee.name);
prop.put("edit_entries_" + count + "_readonly", ee.readonly ? "1" : "0");
prop.put("edit_entries_" + count + "_readonly_name", ee.name);
prop.put("edit_entries_" + count + "_readonly_label", ee.label);
prop.put("edit_entries_" + count + "_readonly_type", ee.type);
if (ee.type == eentry.BOOLEAN) {
prop.put("edit_entries_" + count + "_readonly_type_checked", Boolean.valueOf((String) val).booleanValue() ? "1" : "0");
prop.put("edit_entries_" + count + "_readonly_type_checked", Boolean.valueOf(val).booleanValue() ? "1" : "0");
} else {
prop.put("edit_entries_" + count + "_readonly_type_value", val);
}

@ -112,7 +112,7 @@ public class CrawlStartSimple_p {
peer = yacyCore.seedDB.get(record.originator());
if (peer == null) peername = record.originator(); else peername = peer.getName();
prop.put("otherCrawlStartInProgress_" + showedCrawl + "_dark", dark ? "1" : "0");
prop.put("otherCrawlStartInProgress_" + showedCrawl + "_cre", record.created());
prop.put("otherCrawlStartInProgress_" + showedCrawl + "_cre", record.created().toString());
prop.put("otherCrawlStartInProgress_" + showedCrawl + "_peername", peername);
prop.put("otherCrawlStartInProgress_" + showedCrawl + "_startURL", record.attributes().get("startURL").toString());
prop.put("otherCrawlStartInProgress_" + showedCrawl + "_intention", record.attributes().get("intention").toString());
@ -134,7 +134,7 @@ public class CrawlStartSimple_p {
peer = yacyCore.seedDB.get(record.originator());
if (peer == null) peername = record.originator(); else peername = peer.getName();
prop.put("otherCrawlStartFinished_" + showedCrawl + "_dark", dark ? "1" : "0");
prop.put("otherCrawlStartFinished_" + showedCrawl + "_cre", record.created());
prop.put("otherCrawlStartFinished_" + showedCrawl + "_cre", record.created().toString());
prop.put("otherCrawlStartFinished_" + showedCrawl + "_peername", peername);
prop.put("otherCrawlStartFinished_" + showedCrawl + "_startURL", record.attributes().get("startURL").toString());
prop.put("otherCrawlStartFinished_" + showedCrawl + "_intention", record.attributes().get("intention").toString());

@ -242,8 +242,8 @@ public class IndexControlURLs_p {
prop.putHTML("genUrlProfile_urlNormalform", comp.url().toNormalform(false, true));
prop.put("genUrlProfile_urlhash", urlhash);
prop.put("genUrlProfile_urlDescr", comp.title());
prop.put("genUrlProfile_moddate", entry.moddate());
prop.put("genUrlProfile_loaddate", entry.loaddate());
prop.put("genUrlProfile_moddate", entry.moddate().toString());
prop.put("genUrlProfile_loaddate", entry.loaddate().toString());
prop.put("genUrlProfile_referrer", (le == null) ? 0 : 1);
prop.putHTML("genUrlProfile_referrer_url", (le == null) ? "<unknown>" : le.comp().url().toNormalform(false, true));
prop.put("genUrlProfile_referrer_hash", (le == null) ? "" : le.hash());

@ -142,7 +142,7 @@ public class IndexCreateIndexingQueue_p {
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.getModificationDate());
prop.put("indexing-queue_list_"+entryCount+"_modified", pcentry.getModificationDate().toString());
prop.putHTML("indexing-queue_list_"+entryCount+"_anchor", (pcentry.anchorName()==null)?"":pcentry.anchorName());
prop.put("indexing-queue_list_"+entryCount+"_url", pcentry.url().toNormalform(false, true));
prop.put("indexing-queue_list_"+entryCount+"_size", serverMemory.bytesToString(entrySize));

@ -132,10 +132,10 @@ public final class IndexTransfer_p {
int hc = 0;
if ((yacyCore.seedDB != null) && (yacyCore.seedDB.sizeConnected() > 0)) {
Iterator e = yacyCore.dhtAgent.getAcceptRemoteIndexSeeds("------------");
TreeMap hostList = new TreeMap();
TreeMap<String, String> hostList = new TreeMap<String, String>();
while (e.hasNext()) {
seed = (yacySeed) e.next();
if (seed != null) hostList.put(seed.get(yacySeed.NAME, "nameless"),seed.hash);
if (seed != null) hostList.put(seed.get(yacySeed.NAME, "nameless"), seed.hash);
}
String hostName = null;

@ -68,7 +68,7 @@ public class LogStatistics_p {
Handler[] handlers = logger.getHandlers();
Hashtable r = null;
Hashtable<String, Object> r = null;
boolean displaySubmenu = false;
for (int i=0; i<handlers.length; i++) {
if (handlers[i] instanceof LogalizerHandler) {
@ -88,31 +88,31 @@ public class LogStatistics_p {
prop.put("results", "1");
String[] t;
float l;
prop.put(RESULTS + LogParserPLASMA.DHT_DISTANCE_AVERAGE, r.get(LogParserPLASMA.DHT_DISTANCE_AVERAGE));
prop.put(RESULTS + LogParserPLASMA.DHT_DISTANCE_MAX, r.get(LogParserPLASMA.DHT_DISTANCE_MAX));
prop.put(RESULTS + LogParserPLASMA.DHT_DISTANCE_MIN, r.get(LogParserPLASMA.DHT_DISTANCE_MIN));
prop.put(RESULTS + LogParserPLASMA.DHT_REJECTED, r.get(LogParserPLASMA.DHT_REJECTED));
prop.put(RESULTS + LogParserPLASMA.DHT_SELECTED, r.get(LogParserPLASMA.DHT_SELECTED));
prop.put(RESULTS + LogParserPLASMA.DHT_SENT_FAILED, r.get(LogParserPLASMA.DHT_SENT_FAILED));
prop.put(RESULTS + LogParserPLASMA.DHT_DISTANCE_AVERAGE, (String) r.get(LogParserPLASMA.DHT_DISTANCE_AVERAGE));
prop.put(RESULTS + LogParserPLASMA.DHT_DISTANCE_MAX, (String) r.get(LogParserPLASMA.DHT_DISTANCE_MAX));
prop.put(RESULTS + LogParserPLASMA.DHT_DISTANCE_MIN, (String) r.get(LogParserPLASMA.DHT_DISTANCE_MIN));
prop.put(RESULTS + LogParserPLASMA.DHT_REJECTED, (String) r.get(LogParserPLASMA.DHT_REJECTED));
prop.put(RESULTS + LogParserPLASMA.DHT_SELECTED, (String) r.get(LogParserPLASMA.DHT_SELECTED));
prop.put(RESULTS + LogParserPLASMA.DHT_SENT_FAILED, (String) r.get(LogParserPLASMA.DHT_SENT_FAILED));
t = transformMem(((Long)r.get(LogParserPLASMA.DHT_TRAFFIC_SENT)).longValue());
prop.put(RESULTS + LogParserPLASMA.DHT_TRAFFIC_SENT, t[0]);
prop.put(RESULTS + LogParserPLASMA.DHT_TRAFFIC_SENT + "Unit", t[1]);
prop.put(RESULTS + LogParserPLASMA.DHT_URLS_SENT, r.get(LogParserPLASMA.DHT_URLS_SENT));
prop.put(RESULTS + LogParserPLASMA.DHT_WORDS_SELECTED, r.get(LogParserPLASMA.DHT_WORDS_SELECTED));
prop.put(RESULTS + LogParserPLASMA.DHT_URLS_SENT, (String) r.get(LogParserPLASMA.DHT_URLS_SENT));
prop.put(RESULTS + LogParserPLASMA.DHT_WORDS_SELECTED, (String) r.get(LogParserPLASMA.DHT_WORDS_SELECTED));
t = transformTime(((Integer)r.get(LogParserPLASMA.DHT_WORDS_SELECTED_TIME)).longValue() * 1000L);
prop.put(RESULTS + LogParserPLASMA.DHT_WORDS_SELECTED_TIME, t[0]);
prop.put(RESULTS + LogParserPLASMA.DHT_WORDS_SELECTED_TIME + "Unit", t[1]);
prop.put(RESULTS + LogParserPLASMA.ERROR_CHILD_TWICE_LEFT, r.get(LogParserPLASMA.ERROR_CHILD_TWICE_LEFT));
prop.put(RESULTS + LogParserPLASMA.ERROR_CHILD_TWICE_RIGHT, r.get(LogParserPLASMA.ERROR_CHILD_TWICE_RIGHT));
prop.put(RESULTS + LogParserPLASMA.ERROR_MALFORMED_URL, r.get(LogParserPLASMA.ERROR_MALFORMED_URL));
prop.put(RESULTS + LogParserPLASMA.INDEXED_ANCHORS, r.get(LogParserPLASMA.INDEXED_ANCHORS));
prop.put(RESULTS + LogParserPLASMA.ERROR_CHILD_TWICE_LEFT, (String) r.get(LogParserPLASMA.ERROR_CHILD_TWICE_LEFT));
prop.put(RESULTS + LogParserPLASMA.ERROR_CHILD_TWICE_RIGHT, (String) r.get(LogParserPLASMA.ERROR_CHILD_TWICE_RIGHT));
prop.put(RESULTS + LogParserPLASMA.ERROR_MALFORMED_URL, (String) r.get(LogParserPLASMA.ERROR_MALFORMED_URL));
prop.put(RESULTS + LogParserPLASMA.INDEXED_ANCHORS, (String) r.get(LogParserPLASMA.INDEXED_ANCHORS));
t = transformTime(((Integer)r.get(LogParserPLASMA.INDEXED_INDEX_TIME)).longValue());
prop.put(RESULTS + LogParserPLASMA.INDEXED_INDEX_TIME, t[0]);
prop.put(RESULTS + LogParserPLASMA.INDEXED_INDEX_TIME + "Unit", t[1]);
t = transformTime(((Integer)r.get(LogParserPLASMA.INDEXED_PARSE_TIME)).longValue());
prop.put(RESULTS + LogParserPLASMA.INDEXED_PARSE_TIME, t[0]);
prop.put(RESULTS + LogParserPLASMA.INDEXED_PARSE_TIME + "Unit", t[1]);
prop.put(RESULTS + LogParserPLASMA.INDEXED_SITES, r.get(LogParserPLASMA.INDEXED_SITES));
prop.put(RESULTS + LogParserPLASMA.INDEXED_SITES, (String) r.get(LogParserPLASMA.INDEXED_SITES));
t = transformMem(((Integer)r.get(LogParserPLASMA.INDEXED_SITES_SIZE)).longValue());
prop.put(RESULTS + LogParserPLASMA.INDEXED_SITES_SIZE, t[0]);
prop.put(RESULTS + LogParserPLASMA.INDEXED_SITES_SIZE + "Unit", t[1]);
@ -122,31 +122,31 @@ public class LogStatistics_p {
t = transformTime(((Integer)r.get(LogParserPLASMA.INDEXED_STORE_TIME)).longValue());
prop.put(RESULTS + LogParserPLASMA.INDEXED_STORE_TIME, t[0]);
prop.put(RESULTS + LogParserPLASMA.INDEXED_STORE_TIME + "Unit", t[1]);
prop.put(RESULTS + LogParserPLASMA.INDEXED_WORDS, r.get(LogParserPLASMA.INDEXED_WORDS));
prop.put(RESULTS + LogParserPLASMA.PEERS_BUSY, r.get(LogParserPLASMA.PEERS_BUSY));
prop.put(RESULTS + LogParserPLASMA.PEERS_TOO_LESS, r.get(LogParserPLASMA.PEERS_TOO_LESS));
prop.put(RESULTS + LogParserPLASMA.RANKING_DIST, r.get(LogParserPLASMA.RANKING_DIST));
prop.put(RESULTS + LogParserPLASMA.RANKING_DIST_FAILED, r.get(LogParserPLASMA.RANKING_DIST_FAILED));
prop.put(RESULTS + LogParserPLASMA.INDEXED_WORDS, (String) r.get(LogParserPLASMA.INDEXED_WORDS));
prop.put(RESULTS + LogParserPLASMA.PEERS_BUSY, (String) r.get(LogParserPLASMA.PEERS_BUSY));
prop.put(RESULTS + LogParserPLASMA.PEERS_TOO_LESS, (String) r.get(LogParserPLASMA.PEERS_TOO_LESS));
prop.put(RESULTS + LogParserPLASMA.RANKING_DIST, (String) r.get(LogParserPLASMA.RANKING_DIST));
prop.put(RESULTS + LogParserPLASMA.RANKING_DIST_FAILED, (String) r.get(LogParserPLASMA.RANKING_DIST_FAILED));
t = transformTime(((Integer)r.get(LogParserPLASMA.RANKING_DIST_TIME)).longValue());
prop.put(RESULTS + LogParserPLASMA.RANKING_DIST_TIME, t[0]);
prop.put(RESULTS + LogParserPLASMA.RANKING_DIST_TIME + "Unit", t[1]);
prop.put(RESULTS + LogParserPLASMA.RWIS_BLOCKED, r.get(LogParserPLASMA.RWIS_BLOCKED));
prop.put(RESULTS + LogParserPLASMA.RWIS_RECEIVED, r.get(LogParserPLASMA.RWIS_RECEIVED));
prop.put(RESULTS + LogParserPLASMA.RWIS_BLOCKED, (String) r.get(LogParserPLASMA.RWIS_BLOCKED));
prop.put(RESULTS + LogParserPLASMA.RWIS_RECEIVED, (String) r.get(LogParserPLASMA.RWIS_RECEIVED));
t = transformTime(((Long)r.get(LogParserPLASMA.RWIS_RECEIVED_TIME)).longValue());
prop.put(RESULTS + LogParserPLASMA.RWIS_RECEIVED_TIME, t[0]);
prop.put(RESULTS + LogParserPLASMA.RWIS_RECEIVED_TIME + "Unit", t[1]);
prop.put(RESULTS + LogParserPLASMA.URLS_BLOCKED, r.get(LogParserPLASMA.URLS_BLOCKED));
prop.put(RESULTS + LogParserPLASMA.URLS_RECEIVED, r.get(LogParserPLASMA.URLS_RECEIVED));
prop.put(RESULTS + LogParserPLASMA.URLS_BLOCKED, (String) r.get(LogParserPLASMA.URLS_BLOCKED));
prop.put(RESULTS + LogParserPLASMA.URLS_RECEIVED, (String) r.get(LogParserPLASMA.URLS_RECEIVED));
t = transformTime(((Long)r.get(LogParserPLASMA.URLS_RECEIVED_TIME)).longValue());
prop.put(RESULTS + LogParserPLASMA.URLS_RECEIVED_TIME, t[0]);
prop.put(RESULTS + LogParserPLASMA.URLS_RECEIVED_TIME + "Unit", t[1]);
prop.put(RESULTS + LogParserPLASMA.URLS_REQUESTED, r.get(LogParserPLASMA.URLS_REQUESTED));
prop.put(RESULTS + LogParserPLASMA.WORDS_RECEIVED, r.get(LogParserPLASMA.WORDS_RECEIVED));
prop.put(RESULTS + LogParserPLASMA.URLS_REQUESTED, (String) r.get(LogParserPLASMA.URLS_REQUESTED));
prop.put(RESULTS + LogParserPLASMA.WORDS_RECEIVED, (String) r.get(LogParserPLASMA.WORDS_RECEIVED));
l = ((Long)r.get(LogParserPLASMA.TOTAL_PARSER_TIME)).floatValue();
t = transformTime((long)l);
prop.put(RESULTS + LogParserPLASMA.TOTAL_PARSER_TIME, t[0]);
prop.put(RESULTS + LogParserPLASMA.TOTAL_PARSER_TIME + "Unit", t[1]);
prop.put(RESULTS + LogParserPLASMA.TOTAL_PARSER_RUNS, r.get(LogParserPLASMA.TOTAL_PARSER_RUNS));
prop.put(RESULTS + LogParserPLASMA.TOTAL_PARSER_RUNS, (String) r.get(LogParserPLASMA.TOTAL_PARSER_RUNS));
if ((l /= 1000) == 0) {
prop.put(RESULTS + "avgExists", "0");
} else {
@ -154,8 +154,8 @@ public class LogStatistics_p {
prop.put(RESULTS + "avgExists_avgParserRunsPerMinute", (int) (((Integer) r.get(LogParserPLASMA.TOTAL_PARSER_RUNS)).floatValue() / l));
}
Object[] names = ((HashSet)r.get(LogParserPLASMA.DHT_REJECTED_PEERS_NAME)).toArray();
Object[] hashes = ((HashSet)r.get(LogParserPLASMA.DHT_REJECTED_PEERS_HASH)).toArray();
String[] names = (String[]) ((HashSet<String>) r.get(LogParserPLASMA.DHT_REJECTED_PEERS_NAME)).toArray();
String[] hashes = (String[]) ((HashSet<String>) r.get(LogParserPLASMA.DHT_REJECTED_PEERS_HASH)).toArray();
int i = 0;
for (; i<names.length && i<hashes.length; i++) {
prop.put(RESULTS + "useDHTRejectPeers_DHTRejectPeers_" + i + "_name", names[i]);
@ -165,8 +165,8 @@ public class LogStatistics_p {
prop.put(RESULTS + "useDHTRejectPeers", (i > 0) ? "1" : "0");
prop.put(RESULTS + "useDHTRejectPeers_DHTRejectPeers", i);
names = ((HashSet)r.get(LogParserPLASMA.DHT_SENT_PEERS_NAME)).toArray();
hashes = ((HashSet)r.get(LogParserPLASMA.DHT_SENT_PEERS_HASH)).toArray();
names = (String[]) ((HashSet<String>)r.get(LogParserPLASMA.DHT_SENT_PEERS_NAME)).toArray();
hashes = (String[]) ((HashSet<String>)r.get(LogParserPLASMA.DHT_SENT_PEERS_HASH)).toArray();
i = 0;
for (; i<names.length && i<hashes.length; i++) {
prop.put(RESULTS + "useDHTPeers_DHTPeers_" + i + "_name", names[i]);

@ -152,7 +152,7 @@ public class MessageSend_p {
HashMap result = yacyClient.postMessage(hash, subject, mb);
//message has been sent
prop.put("mode_status_response", result.get("response"));
prop.put("mode_status_response", (String) result.get("response"));
} catch (NumberFormatException e) {
prop.put("mode_status", "1");

@ -117,7 +117,7 @@ public class PerformanceMemory_p {
// write table for FlexTable index sizes
Iterator i = kelondroFlexTable.filenames();
String filename;
Map map;
Map<String, String> map;
int p, c = 0;
long mem, totalmem = 0;
while (i.hasNext()) {

@ -168,20 +168,14 @@
<tr class="TableHeader" valign="bottom">
<td>Thread Pool</td>
<td>maximum Active</td>
<td>maximum Idle</td>
<td>minimum Idle</td>
<td>current Active</td>
<td>current Idle</td>
<td>Full Description</td>
</tr>
#{pool}#
<tr class="TableCellDark">
<td align="left">#[name]#</td>
<td align="right"><input name="#[name]#_maxActive" type="text" size="8" maxlength="8" value="#[maxActive]#" /></td>
<td align="right"><input name="#[name]#_maxIdle" type="text" size="8" maxlength="8" value="#[maxIdle]#" /></td>
<td align="right"><input name="#[name]#_minIdle" type="text" size="8" maxlength="8" value="#[minIdle]#" #(minIdleConfigurable)#disabled="disabled"::#(/minIdleConfigurable)# /></td>
<td align="right">#[numActive]#</td>
<td align="right">#[numIdle]#</td>
<td align="left"></td>
</tr>
#{/pool}#

@ -47,8 +47,6 @@ import java.io.File;
import java.util.Iterator;
import java.util.Map;
import org.apache.commons.pool.impl.GenericObjectPool;
import de.anomic.http.httpHeader;
import de.anomic.plasma.plasmaSwitchboard;
import de.anomic.server.serverCore;
@ -65,8 +63,8 @@ public class PerformanceQueues_p {
plasmaSwitchboard switchboard = (plasmaSwitchboard) sb;
serverObjects prop = new serverObjects();
File defaultSettingsFile = new File(switchboard.getRootPath(), "yacy.init");
Map defaultSettings = ((post == null) || (!(post.containsKey("submitdefault")))) ? null : serverFileUtils.loadHashMap(defaultSettingsFile);
Iterator threads = switchboard.threadNames();
Map<String, String> defaultSettings = ((post == null) || (!(post.containsKey("submitdefault")))) ? null : serverFileUtils.loadHashMap(defaultSettingsFile);
Iterator<String> threads = switchboard.threadNames();
String threadName;
serverThread thread;
@ -202,45 +200,26 @@ public class PerformanceQueues_p {
* configuring the crawler pool
*/
// getting the current crawler pool configuration
int maxActive = Integer.parseInt(post.get("Crawler Pool_maxActive","8"));
int maxBusy = Integer.parseInt(post.get("Crawler Pool_maxActive","8"));
// storing the new values into configfile
switchboard.setConfig(plasmaSwitchboard.CRAWLER_THREADS_ACTIVE_MAX,maxActive);
switchboard.setConfig(plasmaSwitchboard.CRAWLER_THREADS_ACTIVE_MAX,maxBusy);
//switchboard.setConfig("crawler.MinIdleThreads",minIdle);
/*
* configuring the http pool
*/
serverThread httpd = switchboard.getThread("10_httpd");
GenericObjectPool.Config httpdPoolConfig = ((serverCore)httpd).getPoolConfig();
try {
maxActive = Integer.parseInt(post.get("httpd Session Pool_maxActive","8"));
} catch (NumberFormatException e) {
maxActive = 8;
}
int maxIdle = 0;
int minIdle = 0;
try {
maxIdle = Integer.parseInt(post.get("httpd Session Pool_maxIdle","4"));
maxBusy = Integer.parseInt(post.get("httpd Session Pool_maxActive","8"));
} catch (NumberFormatException e) {
maxIdle = 4;
}
try {
minIdle = Integer.parseInt(post.get("httpd Session Pool_minIdle","0"));
} catch (NumberFormatException e) {
minIdle = 0;
maxBusy = 8;
}
httpdPoolConfig.minIdle = (minIdle > maxIdle) ? maxIdle/2 : minIdle;
httpdPoolConfig.maxIdle = (maxIdle > maxActive) ? maxActive/2 : maxIdle;
httpdPoolConfig.maxActive = maxActive;
((serverCore)httpd).setPoolConfig(httpdPoolConfig);
((serverCore)httpd).setMaxSessionCount(maxBusy);
// storing the new values into configfile
switchboard.setConfig("httpdMaxActiveSessions",maxActive);
switchboard.setConfig("httpdMaxIdleSessions",maxIdle);
switchboard.setConfig("httpdMinIdleSessions",minIdle);
switchboard.setConfig("httpdMaxBusySessions",maxBusy);
}
@ -275,21 +254,12 @@ public class PerformanceQueues_p {
// table thread pool settings
prop.put("pool_0_name","Crawler Pool");
prop.put("pool_0_maxActive", switchboard.getConfigLong("crawler.MaxActiveThreads", 0));
prop.put("pool_0_maxIdle", 0);
prop.put("pool_0_minIdleConfigurable",0);
prop.put("pool_0_minIdle", 0);
prop.put("pool_0_numActive",switchboard.crawlQueues.size());
prop.put("pool_0_numIdle", 0);
prop.put("pool_0_numActive",switchboard.crawlQueues.size());
serverThread httpd = switchboard.getThread("10_httpd");
GenericObjectPool.Config httpdPoolConfig = ((serverCore)httpd).getPoolConfig();
prop.put("pool_1_name", "httpd Session Pool");
prop.put("pool_1_maxActive", httpdPoolConfig.maxActive);
prop.put("pool_1_maxIdle", httpdPoolConfig.maxIdle);
prop.put("pool_1_minIdleConfigurable", "1");
prop.put("pool_1_minIdle", httpdPoolConfig.minIdle);
prop.put("pool_1_numActive", ((serverCore)httpd).getActiveSessionCount());
prop.put("pool_1_numIdle", ((serverCore)httpd).getIdleSessionCount());
prop.put("pool_1_maxActive", ((serverCore)httpd).getMaxSessionCount());
prop.put("pool_1_numActive", ((serverCore)httpd).getJobCount());
prop.put("pool", "2");

@ -49,10 +49,7 @@
#{pool}#<Pool>
<Name><![CDATA[#[name]#]]></Name>
<maxActive>#[maxActive]#</maxActive>
<maxIdle>#[maxIdle]#</maxIdle>
<minIdle>#[minIdle]#</minIdle>
<numActive>#[numActive]#</numActive>
<numIdle>#[numIdle]#</numIdle>
</Pool>#{/pool}#
</ThreadPools>
</PerfmanceQueues>

@ -42,7 +42,7 @@ public class Ranking_p {
private static final int maxRankingRange = 16;
private static final HashMap rankingParameters = new HashMap();
private static final HashMap<String, String> rankingParameters = new HashMap<String, String>();
static {
rankingParameters.put(plasmaSearchRankingProfile.APPAUTHOR, "Appearance In Author");
rankingParameters.put(plasmaSearchRankingProfile.APPDESCR, "Appearance In Description");

@ -71,15 +71,15 @@ public class Statistics {
prop.put("page_backlinks", "0");
} else {
prop.put("page_backlinks", "1");
Iterator it = switchboard.facilityDB.maps("backlinks", false, "date");
Iterator<Map<String, String>> it = switchboard.facilityDB.maps("backlinks", false, "date");
int count = 0;
int maxCount = 100;
boolean dark = true;
Map map;
Map<String, String> map;
String urlString;
yacyURL url;
while ((it.hasNext()) && (count < maxCount)) {
map = (Map) it.next();
map = it.next();
if (count >= maxCount) break;
urlString = (String) map.get("key");
try { url = new yacyURL(urlString, null); } catch (MalformedURLException e) { url = null; }

@ -302,12 +302,8 @@ public class Status {
// connection information
serverCore httpd = (serverCore) sb.getThread("10_httpd");
int activeSessionCount = httpd.getActiveSessionCount();
int idleSessionCount = httpd.getIdleSessionCount();
int maxSessionCount = httpd.getMaxSessionCount();
prop.putNum("connectionsActive", activeSessionCount);
prop.putNum("connectionsMax", maxSessionCount);
prop.putNum("connectionsIdle", idleSessionCount);
prop.putNum("connectionsActive", httpd.getJobCount());
prop.putNum("connectionsMax", httpd.getMaxSessionCount());
// Queue information
int indexingJobCount = sb.getThread("80_indexing").getJobCount()+sb.indexingTasksInProcess.size();

@ -58,7 +58,7 @@
<dd>Proxy: #[trafficProxy]#<br/>Crawler: #[trafficCrawler]#</dd>
<dt><a href="Connections_p.html">Incoming Connections</a></dt>
<dd>Active: #[connectionsActive]# | Idle: #[connectionsIdle]# | Max: #[connectionsMax]#</dd>
<dd>Active: #[connectionsActive]# | Max: #[connectionsMax]#</dd>
<dt>Queues</dt>
<dd>

@ -399,12 +399,12 @@ public class ViewFile {
return message;
}
private static int putMediaInfo(serverObjects prop, String[] wordArray, int c, Map media, String name, boolean dark) {
Iterator mi = media.entrySet().iterator();
Map.Entry entry;
private static int putMediaInfo(serverObjects prop, String[] wordArray, int c, Map<String, String> media, String name, boolean dark) {
Iterator<Map.Entry<String, String>> mi = media.entrySet().iterator();
Map.Entry<String, String> entry;
int i = 0;
while (mi.hasNext()) {
entry = (Map.Entry) mi.next();
entry = mi.next();
prop.put("viewMode_links_" + c + "_nr", c);
prop.put("viewMode_links_" + c + "_dark", ((dark) ? 1 : 0));
prop.putHTML("viewMode_links_" + c + "_type", name);

@ -256,10 +256,7 @@ public class WatchCrawler_p {
File file = new File(fileName);
// getting the content of the bookmark file
byte[] fileContent = (byte[]) post.get("crawlingFile$file");
// TODO: determine the real charset here ....
String fileString = new String(fileContent,"UTF-8");
String fileString = post.get("crawlingFile$file");
// parsing the bookmark file and fetching the headline and contained links
htmlFilterContentScraper scraper = new htmlFilterContentScraper(new yacyURL(file));

@ -31,7 +31,7 @@ public class robots {
if (rbc.isProfileDisallowed()) prop.put(httpdRobotsTxtConfig.ALL + "_" + httpdRobotsTxtConfig.PROFILE, "1");
if (rbc.isLockedDisallowed() || rbc.isDirsDisallowed()) {
final ArrayList[] p = getFiles(env.getConfig(plasmaSwitchboard.HTROOT_PATH, plasmaSwitchboard.HTROOT_PATH_DEFAULT));
final ArrayList<String>[] p = getFiles(env.getConfig(plasmaSwitchboard.HTROOT_PATH, plasmaSwitchboard.HTROOT_PATH_DEFAULT));
if (rbc.isLockedDisallowed()) {
prop.put(httpdRobotsTxtConfig.ALL + "_" + httpdRobotsTxtConfig.LOCKED, p[0].size());
for (int i=0; i<p[0].size(); i++)
@ -48,11 +48,11 @@ public class robots {
return prop;
}
private static ArrayList[] getFiles(String htrootPath) {
private static ArrayList<String>[] getFiles(String htrootPath) {
final File htroot = new File(htrootPath);
if (!htroot.exists()) return null;
final ArrayList htrootFiles = new ArrayList();
final ArrayList htrootDirs = new ArrayList();
final ArrayList<String> htrootFiles = new ArrayList<String>();
final ArrayList<String> htrootDirs = new ArrayList<String>();
final String[] htroots = htroot.list();
File file;
for (int i=0, dot; i<htroots.length; i++) {

@ -78,7 +78,7 @@ public class welcome {
prop.put("hostip", "Unknown Host Exception");
}
prop.put("port", serverCore.getPortNr(env.getConfig("port","8080")));
prop.put("clientip", header.get("CLIENTIP", ""));
prop.put("clientip", (String) header.get("CLIENTIP", ""));
final String peertype = (yacyCore.seedDB.mySeed() == null) ? yacySeed.PEERTYPE_JUNIOR : yacyCore.seedDB.mySeed().get(yacySeed.PEERTYPE, yacySeed.PEERTYPE_VIRGIN);
final boolean senior = (peertype.equals(yacySeed.PEERTYPE_SENIOR)) || (peertype.equals(yacySeed.PEERTYPE_PRINCIPAL));

@ -119,7 +119,7 @@ public final class transfer {
if (process.equals("store")) {
prop.put("process", "1");
if (purpose.equals("crcon")) {
byte[] filebytes = (byte[]) post.get("filename$file");
String fileString = post.get("filename$file");
String accesscode = post.get("access", ""); // one-time authentication
String md5 = post.get("md5", ""); // one-time authentication
//java.util.HashMap perm = sb.rankingPermissions;
@ -137,7 +137,7 @@ public final class transfer {
File file = new File(path, filename);
try {
if (file.getCanonicalPath().toString().startsWith(path.getCanonicalPath().toString())){
serverFileUtils.write(filebytes, file);
serverFileUtils.write(fileString.getBytes(), file);
String md5t = serverCodings.encodeMD5Hex(file);
if (md5t.equals(md5)) {
prop.put("response", "ok");

@ -697,7 +697,7 @@ public class bookmarksDB {
public static final String BOOKMARK_OWNER="bookmarkOwner";
public static final String BOOKMARK_IS_FEED="bookmarkIsFeed";
private String urlHash;
private Set tags;
private Set<String> tags;
private long timestamp;
public Bookmark(String urlHash, Map map){
super(map);
@ -767,7 +767,7 @@ public class bookmarksDB {
public String getUrl(){
return (String) entry.get(BOOKMARK_URL);
}
public Set getTags(){
public Set<String> getTags(){
return tags;
}
public String getTagsString(){
@ -831,7 +831,7 @@ public class bookmarksDB {
* set the Tags of the bookmark, and write them into the tags table.
* @param tags2 a ArrayList with the tags
*/
public void setTags(Set tags2){
public void setTags(Set<String> tags2){
setTags(tags2, true);
}
/**
@ -839,9 +839,9 @@ public class bookmarksDB {
* @param tags ArrayList with the tagnames
* @param local sets, whether the updated tags should be stored to tagsDB
*/
public void setTags(Set tags2, boolean local){
public void setTags(Set<String> tags2, boolean local){
tags.addAll(tags2);
Iterator it=tags.iterator();
Iterator<String> it=tags.iterator();
while(it.hasNext()){
String tagName=(String) it.next();
Tag tag=getTag(tagHash(tagName));
@ -863,8 +863,8 @@ public class bookmarksDB {
this.timestamp=ts;
}
}
public class tagIterator implements Iterator{
kelondroCloneableIterator tagIter;
public class tagIterator implements Iterator<Tag> {
kelondroCloneableIterator<String> tagIter;
bookmarksDB.Tag nextEntry;
public tagIterator(boolean up) throws IOException {
flushTagCache(); //XXX: This costs performace :-((
@ -879,9 +879,9 @@ public class bookmarksDB {
return false;
}
}
public Object next() {
public Tag next() {
try {
return getTag((String) this.tagIter.next());
return getTag(this.tagIter.next());
} catch (kelondroException e) {
//resetDatabase();
return null;
@ -898,7 +898,7 @@ public class bookmarksDB {
}
}
}
public class bookmarkIterator implements Iterator{
public class bookmarkIterator implements Iterator<Bookmark> {
Iterator bookmarkIter;
bookmarksDB.Bookmark nextEntry;
public bookmarkIterator(boolean up) throws IOException {
@ -914,7 +914,7 @@ public class bookmarksDB {
return false;
}
}
public Object next() {
public Bookmark next() {
try {
return getBookmark((String) this.bookmarkIter.next());
} catch (kelondroException e) {
@ -936,7 +936,7 @@ public class bookmarksDB {
/**
* Comparator to sort the Bookmarks with Timestamps
*/
public class bookmarkComparator implements Comparator{
public class bookmarkComparator implements Comparator {
private boolean newestFirst;
/**

@ -375,7 +375,8 @@ public final class httpHeader extends TreeMap<String, Object> implements Map<Str
public String toString() {
return super.toString();
}
/*
/*
* example header
Connection=close
Content-Encoding=gzip
Content-Length=7281
@ -801,11 +802,10 @@ public final class httpHeader extends TreeMap<String, Object> implements Map<Str
/**
* Implementation of Map.Entry. Structure that hold two values - exactly what we need!
*/
class Entry implements Map.Entry
{
class Entry implements Map.Entry {
private Object Key;
private Object Value;
Entry(Object Key,String Value){this.Key=Key;this.Value=Value;}
Entry(Object Key, String Value){this.Key=Key;this.Value=Value;}
public Object getKey() {return Key;}
public Object getValue() {return Value;}
public Object setValue(Object Value) {return(this.Value=Value);}
@ -829,16 +829,12 @@ public final class httpHeader extends TreeMap<String, Object> implements Map<Str
* For example semicolon should be not in any of the values
* However an exception in this case would be an overhead IMHO.
*/
String cookieString=name+"="+value+";";
if(expires!=null)
cookieString+=" expires="+expires+";";
if(path!=null)
cookieString+=" path="+path+";";
if(domain!=null)
cookieString+=" domain="+domain+";";
if(secure)
cookieString+=" secure;";
cookies.add(new Entry("Set-Cookie",cookieString));
String cookieString = name + "=" + value + ";";
if (expires != null) cookieString += " expires=" + expires + ";";
if (path != null) cookieString += " path=" + path + ";";
if (domain != null) cookieString += " domain=" + domain + ";";
if (secure) cookieString += " secure;";
cookies.add(new Entry("Set-Cookie", cookieString));
}
/**
* Sets Cookie on the client machine.

@ -109,14 +109,14 @@ public final class httpc {
private static final String vDATE = "20040602";
private static final int terminalMaxLength = 30000;
private static final SimpleDateFormat HTTPGMTFormatter = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz", Locale.US);
private static final HashMap reverseMappingCache = new HashMap();
private static final HashSet activeConnections = new HashSet(); // all connections are stored here and deleted when they are finished
private static final HashMap<String, String> reverseMappingCache = new HashMap<String, String>();
private static final HashSet<httpc> activeConnections = new HashSet<httpc>(); // all connections are stored here and deleted when they are finished
private static final long minimumTime_before_activeConnections_cleanup = 3600000; // 1 Hour
private static final long minimumTime_before_idleConnections_cleanup = 120000; // 2 Minutes
private static final int activeConnections_maximum = 64;
public static final connectionTimeComparator connectionTimeComparatorInstance = new connectionTimeComparator();
private static int objCounter = 0; // will be increased with each object and is use to return a hash code
private static int objCounter = 0; // will be increased with each object and is used to return a hash code
// defined during set-up of switchboard
public static boolean yacyDebugMode = false;
@ -234,9 +234,6 @@ public final class httpc {
checkIdleConnections();
assert timeout != 0;
// register new connection
this.hashIndex = objCounter;
// register new connection
this.hashIndex = objCounter;
objCounter++;
@ -499,26 +496,24 @@ public final class httpc {
httpc[] a = null;
synchronized (activeConnections) {
a = new httpc[activeConnections.size()];
Iterator i = httpc.activeConnections.iterator();
Iterator<httpc> i = httpc.activeConnections.iterator();
int c = 0;
while (i.hasNext()) {
a[c++] = (httpc) i.next();
a[c++] = i.next();
}
}
return a;
}
public static class connectionTimeComparator implements Comparator {
public static class connectionTimeComparator implements Comparator<httpc> {
public connectionTimeComparator() {
super();
}
public int compare(Object o1, Object o2) {
httpc c1 = (httpc) o1;
httpc c2 = (httpc) o2;
long l1 = System.currentTimeMillis() - c1.lastIO;
long l2 = System.currentTimeMillis() - c2.lastIO;
public int compare(httpc o1, httpc o2) {
long l1 = System.currentTimeMillis() - o1.lastIO;
long l2 = System.currentTimeMillis() - o2.lastIO;
if (l1 < l2) return 1;
if (l1 > l2) return -1;
return 0;
@ -662,12 +657,12 @@ public final class httpc {
// send header
//System.out.println("***HEADER for path " + path + ": PROXY TO SERVER = " + header.toString()); // DEBUG
Iterator i = header.keySet().iterator();
Iterator<String> i = header.keySet().iterator();
String key;
int count;
char tag;
while (i.hasNext()) {
key = (String) i.next();
key = i.next();
tag = key.charAt(0);
if ((tag != '*') && (tag != '#')) {
count = header.keyCount(key);
@ -805,7 +800,7 @@ public final class httpc {
* @return Instance of response with the content.
* @throws IOException
*/
public response POST(String path, httpHeader requestHeader, serverObjects args, HashMap files) throws IOException {
public response POST(String path, httpHeader requestHeader, serverObjects args, HashMap<String, byte[]> files) throws IOException {
// make shure, the header has a boundary information like
// CONTENT-TYPE=multipart/form-data; boundary=----------0xKhTmLbOuNdArY
if (requestHeader == null) requestHeader = new httpHeader();
@ -843,7 +838,7 @@ public final class httpc {
if (args.size() != 0) {
// we have values for the POST, start with one boundary
String key, value;
Enumeration e = args.keys();
Enumeration<String> e = args.keys();
while (e.hasMoreElements()) {
// start with a boundary
out.write(boundary.getBytes("UTF-8"));
@ -967,7 +962,7 @@ public final class httpc {
httpRemoteProxyConfig theRemoteProxyConfig,
httpHeader requestHeader,
serverObjects props,
HashMap files
HashMap<String, byte[]> files
) throws IOException {
if (requestHeader == null) requestHeader = new httpHeader();
@ -1000,7 +995,7 @@ public final class httpc {
String password,
httpRemoteProxyConfig theRemoteProxyConfig,
serverObjects props,
HashMap files
HashMap<String, byte[]> files
) throws IOException {
int port = u.getPort();
boolean ssl = u.getProtocol().equals("https");
@ -1066,7 +1061,7 @@ public final class httpc {
return a;
}
public static Map loadHashMap(yacyURL url, httpRemoteProxyConfig proxy) {
public static Map<String, String> loadHashMap(yacyURL url, httpRemoteProxyConfig proxy) {
try {
// should we use the proxy?
boolean useProxy = (proxy != null) &&
@ -1074,7 +1069,7 @@ public final class httpc {
(proxy.useProxy4Yacy());
// sending request
final HashMap result = nxTools.table(
final HashMap<String, String> result = nxTools.table(
httpc.wget(
url,
url.getHost(),
@ -1087,10 +1082,10 @@ public final class httpc {
)
, "UTF-8");
if (result == null) return new HashMap();
if (result == null) return new HashMap<String, String>();
return result;
} catch (Exception e) {
return new HashMap();
return new HashMap<String, String>();
}
}
@ -1145,7 +1140,7 @@ public final class httpc {
String password,
httpRemoteProxyConfig theRemoteProxyConfig,
serverObjects props,
HashMap files
HashMap<String, byte[]> files
) throws IOException {
// splitting of the byte array into lines
byte[] a = singlePOST(
@ -1175,7 +1170,7 @@ public final class httpc {
System.out.println("ANOMIC.DE HTTP CLIENT v" + vDATE);
String url = args[0];
if (!(url.toUpperCase().startsWith("HTTP://"))) url = "http://" + url;
ArrayList text = new ArrayList();
ArrayList<String> text = new ArrayList<String>();
if (args.length == 4) {
int timeout = Integer.parseInt(args[1]);
String proxyHost = args[2];
@ -1199,8 +1194,8 @@ public final class httpc {
}
text = wput(url, post);
}*/
Iterator i = text.listIterator();
while (i.hasNext()) System.out.println((String) i.next());
Iterator<String> i = text.listIterator();
while (i.hasNext()) System.out.println(i.next());
}
/**

@ -853,7 +853,7 @@ public final class httpd implements serverHandler {
return b.toString();
}
public static HashMap parseMultipart(httpHeader header, serverObjects args, InputStream in, int length) throws IOException {
public static HashMap<String, byte[]> parseMultipart(httpHeader header, serverObjects args, InputStream in, int length) throws IOException {
// this is a quick hack using a previously coded parseMultipart based on a buffer
// should be replaced sometime by a 'right' implementation
@ -877,12 +877,12 @@ public final class httpd implements serverHandler {
}
//System.out.println("MULTIPART-BUFFER=" + new String(buffer));
HashMap files = parseMultipart(header, args, buffer);
HashMap<String, byte[]> files = parseMultipart(header, args, buffer);
buffer = null;
return files;
}
public static HashMap parseMultipart(httpHeader header, serverObjects args, byte[] buffer) throws IOException {
public static HashMap<String, byte[]> parseMultipart(httpHeader header, serverObjects args, byte[] buffer) throws IOException {
// we parse a multipart message and put results into the properties
// find/identify boundary marker
//System.out.println("DEBUG parseMultipart = <<" + new String(buffer) + ">>");
@ -910,7 +910,7 @@ public final class httpd implements serverHandler {
// now loop over boundaries
byte [] name;
byte [] filename;
HashMap files = new HashMap();
HashMap<String, byte[]> files = new HashMap<String, byte[]>();
int argc = 0;
//System.out.println("DEBUG: parsing multipart body:" + new String(buffer));
while (pos < buffer.length) { // boundary enumerator
@ -1184,7 +1184,7 @@ public final class httpd implements serverHandler {
tp.put("errorMessageType_detailedErrorMsg", (detailedErrorMsgText == null) ? "" : detailedErrorMsgText.replaceAll("\n", "<br />"));
break;
case ERRORCASE_FILE:
tp.put("errorMessageType_file", (detailedErrorMsgFile == null) ? "" : detailedErrorMsgFile);
tp.put("errorMessageType_file", (detailedErrorMsgFile == null) ? "" : detailedErrorMsgFile.toString());
if ((detailedErrorMsgValues != null) && (detailedErrorMsgValues.size() > 0)) {
// rewriting the value-names and add the proper name prefix:
Iterator nameIter = detailedErrorMsgValues.keySet().iterator();

@ -367,14 +367,14 @@ public final class httpdFileHandler {
if ((requestHeader.containsKey(httpHeader.CONTENT_TYPE)) &&
(((String) requestHeader.get(httpHeader.CONTENT_TYPE)).toLowerCase().startsWith("multipart"))) {
// parse multipart
HashMap files = httpd.parseMultipart(requestHeader, args, (gzipBody!=null)?gzipBody:body, length);
HashMap<String, byte[]> files = httpd.parseMultipart(requestHeader, args, (gzipBody!=null)?gzipBody:body, length);
// integrate these files into the args
if (files != null) {
Iterator fit = files.entrySet().iterator();
Map.Entry entry;
Iterator<Map.Entry<String, byte[]>> fit = files.entrySet().iterator();
Map.Entry<String, byte[]> entry;
while (fit.hasNext()) {
entry = (Map.Entry) fit.next();
args.put(((String) entry.getKey()) + "$file", entry.getValue());
entry = fit.next();
args.put(entry.getKey() + "$file", entry.getValue());
}
}
argc = Integer.parseInt((String) requestHeader.get("ARGC"));

@ -256,7 +256,7 @@ public class indexCachedRI implements indexRI {
}
public kelondroCloneableIterator<indexContainer> wordContainers(String startHash, boolean ramOnly, boolean rot) {
kelondroCloneableIterator i;
kelondroCloneableIterator<indexContainer> i;
if (ramOnly) {
i = riExtern.wordContainers(startHash, false);
} else {

@ -271,12 +271,12 @@ public class kelondroBytesIntMap {
String combined = "";
if ((index0 == null) && (index1 == null)) return "all null";
if ((index0 != null) && (index1 != null)) {
Iterator i;
Iterator<kelondroRow.Entry> i;
try {
i = index0.rows(true, null);
kelondroRow.Entry entry;
while (i.hasNext()) {
entry = (kelondroRow.Entry) i.next();
entry = i.next();
if (index1.has(entry.getColBytes(0))) {
combined = combined + ", common = " + new String(entry.getColBytes(0));
}
@ -292,12 +292,12 @@ public class kelondroBytesIntMap {
if (!(s0 && s1)) return false;
if ((index0 == null) && (index1 == null)) return true;
if ((index0 != null) && (index1 != null)) {
Iterator i;
Iterator<kelondroRow.Entry> i;
try {
i = index0.rows(true, null);
kelondroRow.Entry entry;
while (i.hasNext()) {
entry = (kelondroRow.Entry) i.next();
entry = i.next();
if (index1.has(entry.getColBytes(0))) return false;
}
} catch (IOException e) {}

@ -386,7 +386,7 @@ public class kelondroCollectionIndex {
while (i.hasNext()) {
entry = i.next();
actionList = entry.getValue();
partitionNumber = entry.getKey();
partitionNumber = entry.getKey().intValue();
array = getArray(partitionNumber, serialNumber, index.row().objectOrder, chunkSize);
j = actionList.iterator();
while (j.hasNext()) {

@ -46,15 +46,15 @@ package de.anomic.kelondro;
import java.io.File;
import java.io.IOException;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.HashMap;
import java.util.Iterator;
public class kelondroDynTree {
// basic data structures
private kelondroRow rowdef;
private kelondroDyn table;
private Hashtable treeRAHandles;
private HashMap<String, kelondroRA> treeRAHandles;
private File file;
// some properties to control caching and buffering
@ -65,7 +65,8 @@ public class kelondroDynTree {
private long preloadTime = 0;
// data structures for the cache and buffer
private Hashtable buffer, cache;
private HashMap<String, treeBuffer> buffer;
private HashMap<String, treeCache> cache;
private long cycleBuffer;
public kelondroDynTree(File file, long preloadTime, int keylength, int nodesize, kelondroRow rowdef, char fillChar, boolean resetOnFail) {
@ -73,17 +74,17 @@ public class kelondroDynTree {
this.file = file;
this.preloadTime = preloadTime;
this.rowdef = rowdef;
this.buffer = new Hashtable();
this.cache = new Hashtable();
this.buffer = new HashMap<String, treeBuffer>();
this.cache = new HashMap<String, treeCache>();
//this.cycleCache = Long.MIN_VALUE;
this.cycleBuffer = Long.MIN_VALUE;
this.table = new kelondroDyn(file, true, true, preloadTime, keylength, nodesize, fillChar, rowdef.objectOrder, true, false, resetOnFail);
this.treeRAHandles = new Hashtable();
this.treeRAHandles = new HashMap<String, kelondroRA>();
}
public void close() throws IOException {
Enumeration e = treeRAHandles.keys();
while (e.hasMoreElements()) closeTree((String) e.nextElement());
Iterator<String> e = treeRAHandles.keySet().iterator();
while (e.hasNext()) closeTree((String) e.next());
int size = table.sizeDyn();
table.close();
if (size == 0) this.file.delete();
@ -143,34 +144,34 @@ public class kelondroDynTree {
protected class treeCache {
private String tablename;
private Hashtable tcache;
private HashMap<String, kelondroRow.Entry> tcache;
public long timestamp;
treeCache(String tablename) {
this.tablename = tablename;
this.tcache = new Hashtable(); // for key-row relations
this.tcache = new HashMap<String, kelondroRow.Entry>(); // for key-row relations
this.timestamp = Long.MAX_VALUE; // to flag no-update
}
public kelondroRow.Entry get(byte[] key) throws IOException {
kelondroRow.Entry entry = (kelondroRow.Entry) tcache.get(key);
kelondroRow.Entry entry = (kelondroRow.Entry) tcache.get(new String(key));
if (entry == null) {
kelondroTree t = getTree(this.tablename);
entry = t.get(key);
t.close();
this.tcache.put(key, entry);
this.tcache.put(new String(key), entry);
this.timestamp = System.currentTimeMillis();
}
return entry;
}
protected void put(kelondroRow.Entry entry) { // this is only used internal
this.tcache.put(entry.getColBytes(0), entry);
this.tcache.put(entry.getColString(0, null), entry);
this.timestamp = System.currentTimeMillis();
}
protected void remove(byte[] key) {
this.tcache.remove(key);
this.tcache.remove(new String(key));
this.timestamp = System.currentTimeMillis();
}
}
@ -178,34 +179,34 @@ public class kelondroDynTree {
protected class treeBuffer {
private String tablename;
protected Hashtable tbuffer;
protected HashMap<String, kelondroRow.Entry> tbuffer;
public long timestamp;
treeBuffer(String tablename) {
this.tablename = tablename;
this.tbuffer = new Hashtable(); // for key-row relations
this.tbuffer = new HashMap<String, kelondroRow.Entry>(); // for key-row relations
this.timestamp = Long.MAX_VALUE; // to flag no-update
}
public void put(kelondroRow.Entry entry) {
this.tbuffer.put(entry.getColBytes(0), entry);
this.tbuffer.put(entry.getColString(0, null), entry);
this.timestamp = System.currentTimeMillis();
}
public void remove(byte[] key) {
this.tbuffer.remove(key);
this.tbuffer.remove(new String(key));
this.timestamp = System.currentTimeMillis();
}
protected void flush() throws IOException {
this.timestamp = System.currentTimeMillis();
if (this.tbuffer.size() == 0) return;
Enumeration e = this.tbuffer.keys();
Iterator<String> e = this.tbuffer.keySet().iterator();
kelondroTree t = getTree(this.tablename);
kelondroRow.Entry entry;
byte[] key;
while (e.hasMoreElements()) {
key = (byte[]) e.nextElement();
String key;
while (e.hasNext()) {
key = e.next();
entry = (kelondroRow.Entry) this.tbuffer.get(key);
t.put(entry);
}
@ -271,11 +272,11 @@ public class kelondroDynTree {
(buffer.size() < this.maxcountBuffer)) return;
this.cycleBuffer = System.currentTimeMillis();
// collect all buffers which have a time > maxageBuffer
Enumeration e = buffer.keys();
Iterator<String> e = buffer.keySet().iterator();
String tablename;
treeBuffer tb;
while (e.hasMoreElements()) {
tablename = (String) e.nextElement();
while (e.hasNext()) {
tablename = e.next();
tb = (treeBuffer) buffer.get(tablename);
if ((System.currentTimeMillis() - tb.timestamp > this.maxageBuffer) ||
(tb.tbuffer.size() > this.maxsizeBuffer) ||

@ -33,8 +33,8 @@ import java.util.TreeMap;
public class kelondroEcoRecords extends kelondroAbstractRecords {
// static supervision objects: recognize and coordinate all activites
private static TreeMap recordTracker = new TreeMap(); // a String/filename - kelondroTray mapping
// static supervision objects: recognize and coordinate all activities
private static TreeMap<String, kelondroEcoRecords> recordTracker = new TreeMap<String, kelondroEcoRecords>();
public kelondroEcoRecords(
File file,
@ -59,7 +59,7 @@ public class kelondroEcoRecords extends kelondroAbstractRecords {
recordTracker.put(this.filename, this);
}
public static final Iterator filenames() {
public static final Iterator<String> filenames() {
// iterates string objects; all file names from record tracker
return recordTracker.keySet().iterator();
}

@ -104,7 +104,7 @@ public final class kelondroFileRA extends kelondroAbstractRA implements kelondro
}
// some static tools
public static void writeMap(File f, Map map, String comment) throws IOException {
public static void writeMap(File f, Map<String, String> map, String comment) throws IOException {
File fp = f.getParentFile();
if (fp != null) fp.mkdirs();
kelondroRA kra = null;
@ -117,11 +117,11 @@ public final class kelondroFileRA extends kelondroAbstractRA implements kelondro
}
}
public static Map readMap(File f) throws IOException {
public static Map<String, String> readMap(File f) throws IOException {
kelondroRA kra = null;
try {
kra = new kelondroFileRA(f);
Map map = kra.readMap();
Map<String, String> map = kra.readMap();
kra.close();
return map;
} finally {

@ -113,14 +113,14 @@ public class kelondroFixedWidthArray extends kelondroEcoRecords implements kelon
// the OHbytes and OHhandles are zero.
}
public synchronized void setMultiple(TreeMap /* of Integer/kelondroRow.Entry */ rows) throws IOException {
Iterator i = rows.entrySet().iterator();
Map.Entry entry;
Integer k;
public synchronized void setMultiple(TreeMap<Integer, kelondroRow.Entry> rows) throws IOException {
Iterator<Map.Entry<Integer, kelondroRow.Entry>> i = rows.entrySet().iterator();
Map.Entry<Integer, kelondroRow.Entry> entry;
int k;
while (i.hasNext()) {
entry = (Map.Entry) i.next();
k = (Integer) entry.getKey();
set(k.intValue(), (kelondroRow.Entry) entry.getValue());
entry = i.next();
k = entry.getKey().intValue();
set(k, entry.getValue());
}
}

@ -41,7 +41,7 @@ public class kelondroFlexSplitTable implements kelondroIndex {
// this is a set of kelondroFlex tables
// the set is divided into FlexTables with different entry date
private HashMap tables; // a map from a date string to a kelondroIndex object
private HashMap<String, kelondroIndex> tables; // a map from a date string to a kelondroIndex object
private kelondroRow rowdef;
private File path;
private String tablename;
@ -56,13 +56,13 @@ public class kelondroFlexSplitTable implements kelondroIndex {
public void init(long preloadTime, boolean resetOnFail) {
// initialized tables map
this.tables = new HashMap();
this.tables = new HashMap<String, kelondroIndex>();
if (!(path.exists())) path.mkdirs();
String[] dir = path.list();
String date;
// first pass: find tables
HashMap t = new HashMap(); // file/Integer(size) relation
HashMap<String, Long> t = new HashMap<String, Long>();
long ram, sum = 0;
for (int i = 0; i < dir.length; i++) {
if ((dir[i].startsWith(tablename)) &&
@ -77,9 +77,9 @@ public class kelondroFlexSplitTable implements kelondroIndex {
}
// second pass: open tables
Iterator i;
Map.Entry entry;
String f, maxf;
Iterator<Map.Entry<String, Long>> i;
Map.Entry<String, Long> entry;
String maxf;
long maxram;
kelondroIndex table;
while (t.size() > 0) {
@ -88,11 +88,10 @@ public class kelondroFlexSplitTable implements kelondroIndex {
maxf = null;
i = t.entrySet().iterator();
while (i.hasNext()) {
entry = (Map.Entry) i.next();
f = (String) entry.getKey();
ram = ((Long) entry.getValue()).longValue();
entry = i.next();
ram = entry.getValue().longValue();
if (ram > maxram) {
maxf = f;
maxf = entry.getKey();
maxram = ram;
}
}
@ -138,11 +137,9 @@ public class kelondroFlexSplitTable implements kelondroIndex {
}
public int size() {
Iterator i = tables.values().iterator();
Iterator<kelondroIndex> i = tables.values().iterator();
int s = 0;
while (i.hasNext()) {
s += ((kelondroIndex) i.next()).size();
}
while (i.hasNext()) s += i.next().size();
return s;
}
@ -250,22 +247,22 @@ public class kelondroFlexSplitTable implements kelondroIndex {
table.addUnique(row);
}
public synchronized void addUniqueMultiple(List rows) throws IOException {
Iterator i = rows.iterator();
while (i.hasNext()) addUnique((kelondroRow.Entry) i.next());
public synchronized void addUniqueMultiple(List<kelondroRow.Entry> rows) throws IOException {
Iterator<kelondroRow.Entry> i = rows.iterator();
while (i.hasNext()) addUnique(i.next());
}
public synchronized void addUniqueMultiple(List rows, Date entryDate) throws IOException {
Iterator i = rows.iterator();
while (i.hasNext()) addUnique((kelondroRow.Entry) i.next(), entryDate);
public synchronized void addUniqueMultiple(List<kelondroRow.Entry> rows, Date entryDate) throws IOException {
Iterator<kelondroRow.Entry> i = rows.iterator();
while (i.hasNext()) addUnique(i.next(), entryDate);
}
public synchronized kelondroRow.Entry remove(byte[] key, boolean keepOrder) throws IOException {
Iterator i = tables.values().iterator();
Iterator<kelondroIndex> i = tables.values().iterator();
kelondroIndex table;
kelondroRow.Entry entry;
while (i.hasNext()) {
table = (kelondroIndex) i.next();
table = i.next();
entry = table.remove(key, keepOrder);
if (entry != null) return entry;
}
@ -273,7 +270,7 @@ public class kelondroFlexSplitTable implements kelondroIndex {
}
public synchronized kelondroRow.Entry removeOne() throws IOException {
Iterator i = tables.values().iterator();
Iterator<kelondroIndex> i = tables.values().iterator();
kelondroIndex table, maxtable = null;
int maxcount = -1;
while (i.hasNext()) {
@ -291,19 +288,19 @@ public class kelondroFlexSplitTable implements kelondroIndex {
}
public synchronized kelondroCloneableIterator keys(boolean up, byte[] firstKey) throws IOException {
HashSet set = new HashSet();
Iterator i = tables.values().iterator();
HashSet<kelondroCloneableIterator<?>> set = new HashSet<kelondroCloneableIterator<?>>();
Iterator<kelondroIndex> i = tables.values().iterator();
while (i.hasNext()) {
set.add(((kelondroIndex) i.next()).keys(up, firstKey));
set.add(i.next().keys(up, firstKey));
}
return kelondroMergeIterator.cascade(set, rowdef.objectOrder, kelondroMergeIterator.simpleMerge, up);
}
public synchronized kelondroCloneableIterator rows(boolean up, byte[] firstKey) throws IOException {
HashSet set = new HashSet();
Iterator i = tables.values().iterator();
HashSet<kelondroCloneableIterator<?>> set = new HashSet<kelondroCloneableIterator<?>>();
Iterator<kelondroIndex> i = tables.values().iterator();
while (i.hasNext()) {
set.add(((kelondroIndex) i.next()).rows(up, firstKey));
set.add(i.next().rows(up, firstKey));
}
return kelondroMergeIterator.cascade(set, rowdef.objectOrder, kelondroMergeIterator.simpleMerge, up);
}
@ -330,9 +327,9 @@ public class kelondroFlexSplitTable implements kelondroIndex {
public synchronized void close() {
if (tables == null) return;
Iterator i = tables.values().iterator();
Iterator<kelondroIndex> i = tables.values().iterator();
while (i.hasNext()) {
((kelondroIndex) i.next()).close();
i.next().close();
}
tables = null;
}

@ -419,17 +419,17 @@ public class kelondroFlexTable extends kelondroFlexWidthArray implements kelondr
return theFlexTable.profile();
}
public static final Map memoryStats(String filename) {
public static final Map<String, String> memoryStats(String filename) {
// returns a map for each file in the tracker;
// the map represents properties for each record oobjects,
// the map represents properties for each record objects,
// i.e. for cache memory allocation
kelondroFlexTable theFlexTable = (kelondroFlexTable) tableTracker.get(filename);
return theFlexTable.memoryStats();
}
private final Map memoryStats() {
private final Map<String, String> memoryStats() {
// returns statistical data about this object
HashMap map = new HashMap();
HashMap<String, String> map = new HashMap<String, String>();
map.put("tableIndexChunkSize", (!RAMIndex) ? "0" : Integer.toString(index.row().objectsize));
map.put("tableIndexCount", (!RAMIndex) ? "0" : Integer.toString(index.size()));
map.put("tableIndexMem", (!RAMIndex) ? "0" : Integer.toString((int) (index.row().objectsize * index.size() * kelondroRowCollection.growfactor)));

@ -60,7 +60,7 @@ import de.anomic.yacy.yacyURL;
public class plasmaCrawlProfile {
private static HashMap domsCache = new HashMap();
private static HashMap<String, Map<String, DomProfile>> domsCache = new HashMap<String, Map<String, DomProfile>>();
private kelondroMapObjects profileTable;
private File profileTableFile;
@ -204,7 +204,7 @@ public class plasmaCrawlProfile {
}
public entry getEntry(String handle) {
Map m = profileTable.getMap(handle);
Map<String, String> m = profileTable.getMap(handle);
if (m == null) return null;
return new entry(m);
}
@ -254,8 +254,8 @@ public class plasmaCrawlProfile {
public static final String XDSTOPW = "xdstopw";
public static final String XPSTOPW = "xpstopw";
private Map mem;
private Map doms;
private Map<String, String> mem;
private Map<String, DomProfile> doms;
public entry(String name, yacyURL startURL, String generalFilter, String specificFilter,
int generalDepth, int specificDepth,
@ -267,7 +267,7 @@ public class plasmaCrawlProfile {
boolean xsstopw, boolean xdstopw, boolean xpstopw) {
if (name == null || name.length() == 0) throw new NullPointerException("name must not be null");
String handle = (startURL == null) ? kelondroBase64Order.enhancedCoder.encode(serverCodings.encodeMD5Raw(Long.toString(System.currentTimeMillis()))).substring(0, yacySeedDB.commonHashLength) : startURL.hash();
mem = new HashMap();
mem = new HashMap<String, String>();
mem.put(HANDLE, handle);
mem.put(NAME, name);
mem.put(START_URL, (startURL == null) ? "" : startURL.toNormalform(true, false));
@ -288,7 +288,7 @@ public class plasmaCrawlProfile {
mem.put(XDSTOPW, Boolean.toString(xdstopw)); // exclude dynamic stop-word
mem.put(XPSTOPW, Boolean.toString(xpstopw)); // exclude parent stop-words
doms = new HashMap();
doms = new HashMap<String, DomProfile>();
}
public String toString() {
@ -301,13 +301,13 @@ public class plasmaCrawlProfile {
return str.toString();
}
public entry(Map mem) {
public entry(Map<String, String> mem) {
this.mem = mem;
this.doms = (HashMap) domsCache.get(this.mem.get(HANDLE));
if (this.doms == null) this.doms = new HashMap();
this.doms = (HashMap<String, DomProfile>) domsCache.get(this.mem.get(HANDLE));
if (this.doms == null) this.doms = new HashMap<String, DomProfile>();
}
public Map map() {
public Map<String, String> map() {
return mem;
}
public String handle() {

@ -229,7 +229,7 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
public dbImportManager dbImportManager;
public plasmaDHTFlush transferIdxThread = null;
private plasmaDHTChunk dhtTransferChunk = null;
public ArrayList localSearches, remoteSearches; // array of search result properties as HashMaps
public ArrayList<HashMap<String, Object>> localSearches, remoteSearches; // array of search result properties as HashMaps
public HashMap localSearchTracker, remoteSearchTracker; // mappings from requesting host to a TreeSet of Long(access time)
public long lastseedcheckuptime = -1;
public long indexedPages = 0;
@ -1207,8 +1207,8 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
// init search history trackers
this.localSearchTracker = new HashMap(); // String:TreeSet - IP:set of Long(accessTime)
this.remoteSearchTracker = new HashMap();
this.localSearches = new ArrayList(); // contains search result properties as HashMaps
this.remoteSearches = new ArrayList();
this.localSearches = new ArrayList<HashMap<String, Object>>(); // contains search result properties as HashMaps
this.remoteSearches = new ArrayList<HashMap<String, Object>>();
// init messages: clean up message symbol
File notifierSource = new File(getRootPath(), getConfig(HTROOT_PATH, HTROOT_PATH_DEFAULT) + "/env/grafics/empty.gif");

@ -161,7 +161,7 @@ public class LogalizerHandler extends Handler {
return null;
}
public Hashtable getParserResults(LogParser parsername) {
public Hashtable<String, Object> getParserResults(LogParser parsername) {
return parsername.getResults();
}

@ -77,6 +77,6 @@ public interface LogParser {
* <b>PLASMA</b> or <b>YACY</b>
*/
public String getParserType();
public Hashtable getResults();
public Hashtable<String, Object> getResults();
public double getParserVersion();
}

@ -56,18 +56,18 @@ public abstract class serverAbstractSwitch implements serverSwitch {
private static final long maxTrackingTimeDefault = 1000 * 60 * 60; // store only access data from the last hour to save ram space
// configuration management
private final File configFile;
private Map configProps;
private final String configComment;
private Map configRemoved;
private final HashMap authorization;
private String rootPath;
private final TreeMap workerThreads;
private final TreeMap switchActions;
protected serverLog log;
protected int serverJobs;
protected HashMap accessTracker; // mappings from requesting host to an ArrayList of serverTrack-entries
protected long maxTrackingTime;
private File configFile;
private String configComment;
private String rootPath;
protected serverLog log;
protected int serverJobs;
protected long maxTrackingTime;
private Map<String, String> configProps;
private Map<String, String> configRemoved;
private HashMap<InetAddress, String> authorization;
private TreeMap<String, serverThread> workerThreads;
private TreeMap<String, serverSwitchAction> switchActions;
protected HashMap<String, TreeMap<Long, String>> accessTracker; // mappings from requesting host to an ArrayList of serverTrack-entries
public serverAbstractSwitch(String rootPath, String initPath, String configPath, boolean applyPro) {
// we initialize the switchboard with a property file,
@ -83,17 +83,17 @@ public abstract class serverAbstractSwitch implements serverSwitch {
new File(configFile.getParent()).mkdir();
// predefine init's
Map initProps;
Map<String, String> initProps;
if (initFile.exists())
initProps = serverFileUtils.loadHashMap(initFile);
else
initProps = new HashMap();
initProps = new HashMap<String, String>();
// if 'pro'-version is selected, overload standard settings with 'pro'-settings
Iterator i;
Iterator<String> i;
String prop;
if (applyPro) {
i = new HashMap(initProps).keySet().iterator(); // clone the map to avoid concurrent modification exceptions
i = new HashMap<String, String>(initProps).keySet().iterator(); // clone the map to avoid concurrent modification exceptions
while (i.hasNext()) {
prop = (String) i.next();
if (prop.endsWith("__pro")) {
@ -114,15 +114,15 @@ public abstract class serverAbstractSwitch implements serverSwitch {
if (configFile.exists())
configProps = serverFileUtils.loadHashMap(configFile);
else
configProps = new HashMap();
configProps = new HashMap<String, String>();
// remove all values from config that do not appear in init
configRemoved = new HashMap();
configRemoved = new HashMap<String, String>();
synchronized (configProps) {
i = configProps.keySet().iterator();
String key;
while (i.hasNext()) {
key = (String) i.next();
key = i.next();
if (!(initProps.containsKey(key))) {
configRemoved.put(key, this.configProps.get(key));
i.remove();
@ -144,14 +144,14 @@ public abstract class serverAbstractSwitch implements serverSwitch {
}
// other settings
authorization = new HashMap();
accessTracker = new HashMap();
authorization = new HashMap<InetAddress, String>();
accessTracker = new HashMap<String, TreeMap<Long, String>>();
// init thread control
workerThreads = new TreeMap();
workerThreads = new TreeMap<String, serverThread>();
// init switch actions
switchActions = new TreeMap();
switchActions = new TreeMap<String, serverSwitchAction>();
// init busy state control
serverJobs = 0;
@ -172,8 +172,8 @@ public abstract class serverAbstractSwitch implements serverSwitch {
public void track(String host, String accessPath) {
// learn that a specific host has accessed a specific path
if (accessPath == null) accessPath="NULL";
TreeMap access = (TreeMap) accessTracker.get(host);
if (access == null) access = new TreeMap();
TreeMap<Long, String> access = accessTracker.get(host);
if (access == null) access = new TreeMap<Long, String>();
synchronized (access) {
access.put(new Long(System.currentTimeMillis()), accessPath);
@ -184,10 +184,10 @@ public abstract class serverAbstractSwitch implements serverSwitch {
}
}
public TreeMap accessTrack(String host) {
public TreeMap<Long, String> accessTrack(String host) {
// returns mapping from Long(accesstime) to path
TreeMap access = (TreeMap) accessTracker.get(host);
TreeMap<Long, String> access = accessTracker.get(host);
if (access == null) return null;
synchronized (access) {
// clear too old entries
@ -205,25 +205,25 @@ public abstract class serverAbstractSwitch implements serverSwitch {
}
}
private TreeMap clearTooOldAccess(TreeMap access) {
return new TreeMap(access.tailMap(new Long(System.currentTimeMillis() - maxTrackingTime)));
private TreeMap<Long, String> clearTooOldAccess(TreeMap<Long, String> access) {
return new TreeMap<Long, String>(access.tailMap(new Long(System.currentTimeMillis() - maxTrackingTime)));
}
public Iterator accessHosts() {
public Iterator<String> accessHosts() {
// returns an iterator of hosts in tracker (String)
HashMap accessTrackerClone = new HashMap();
HashMap<String, TreeMap<Long, String>> accessTrackerClone = new HashMap<String, TreeMap<Long, String>>();
try {
accessTrackerClone.putAll(accessTracker);
} catch (ConcurrentModificationException e) {}
return accessTrackerClone.keySet().iterator();
}
public void setConfig(Map otherConfigs) {
Iterator i = otherConfigs.entrySet().iterator();
Map.Entry entry;
public void setConfig(Map<String, String> otherConfigs) {
Iterator<Map.Entry<String, String>> i = otherConfigs.entrySet().iterator();
Map.Entry<String, String> entry;
while (i.hasNext()) {
entry = (Map.Entry) i.next();
setConfig((String) entry.getKey(), (String) entry.getValue());
entry = i.next();
setConfig(entry.getKey(), entry.getValue());
}
}
@ -241,15 +241,13 @@ public abstract class serverAbstractSwitch implements serverSwitch {
public void setConfig(String key, String value) {
// perform action before setting new value
Iterator bevore = switchActions.entrySet().iterator();
Iterator after = switchActions.entrySet().iterator();
Iterator<serverSwitchAction> bevore = switchActions.values().iterator();
Iterator<serverSwitchAction> after = switchActions.values().iterator();
synchronized (configProps) {
Map.Entry entry;
serverSwitchAction action;
while (bevore.hasNext()) {
entry = (Map.Entry) bevore.next();
action = (serverSwitchAction) entry.getValue();
action = bevore.next();
try {
action.doBevoreSetConfig(key, value);
} catch (Exception e) {
@ -263,8 +261,7 @@ public abstract class serverAbstractSwitch implements serverSwitch {
// perform actions afterwards
while (after.hasNext()) {
entry = (Map.Entry) after.next();
action = (serverSwitchAction) entry.getValue();
action = after.next();
try {
action.doAfterSetConfig(key, value, (oldValue == null) ? null : (String) oldValue);
} catch (Exception e) {
@ -275,17 +272,15 @@ public abstract class serverAbstractSwitch implements serverSwitch {
}
public String getConfig(String key, String dflt) {
Iterator i = switchActions.entrySet().iterator();
Iterator<serverSwitchAction> i = switchActions.values().iterator();
synchronized (configProps) {
// get the value
Object s = configProps.get(key);
// do action
Map.Entry entry;
serverSwitchAction action;
while (i.hasNext()) {
entry = (Map.Entry) i.next();
action = (serverSwitchAction) entry.getValue();
action = i.next();
try {
action.doWhenGetConfig(key, (s == null) ? null : (String) s, dflt);
} catch (Exception e) {
@ -341,8 +336,8 @@ public abstract class serverAbstractSwitch implements serverSwitch {
return ret;
}
public Iterator configKeys() {
return configProps.keySet().iterator();
public Iterator<String> configKeys() {
return configProps.keySet().iterator();
}
private void saveConfig() {
@ -355,7 +350,7 @@ public abstract class serverAbstractSwitch implements serverSwitch {
}
}
public Map getRemoved() {
public Map<String, String> getRemoved() {
// returns configuration that had been removed during initialization
return configRemoved;
}
@ -366,7 +361,7 @@ public abstract class serverAbstractSwitch implements serverSwitch {
newAction.setLog(log);
newAction.setDescription(actionShortDescription, actionLongDescription);
switchActions.put(actionName, newAction);
log.logInfo("Deployed Action '" + actionShortDescription + "', (" + switchActions.size() + " actions registered)");
log.logInfo("Deployed Action '" + actionShortDescription + "', (" + switchActions.size() + " actions registered)");
}
public void undeployAction(String actionName) {
@ -452,14 +447,14 @@ public abstract class serverAbstractSwitch implements serverSwitch {
}
public void intermissionAllThreads(long pause) {
Iterator e = workerThreads.keySet().iterator();
Iterator<String> e = workerThreads.keySet().iterator();
while (e.hasNext()) {
((serverThread) workerThreads.get(e.next())).intermission(pause);
}
}
public synchronized void terminateAllThreads(boolean waitFor) {
Iterator e = workerThreads.keySet().iterator();
Iterator<String> e = workerThreads.keySet().iterator();
while (e.hasNext()) {
((serverThread) workerThreads.get(e.next())).terminate(false);
}
@ -472,7 +467,7 @@ public abstract class serverAbstractSwitch implements serverSwitch {
}
}
public Iterator /*of serverThread-Names (String)*/ threadNames() {
public Iterator<String> /*of serverThread-Names (String)*/ threadNames() {
return workerThreads.keySet().iterator();
}
@ -484,13 +479,13 @@ public abstract class serverAbstractSwitch implements serverSwitch {
// authentification routines:
public void setAuthentify(InetAddress host, String user, String rights) {
// sets access attributes according to host addresses
authorization.put(host, user + "@" + rights);
// sets access attributes according to host addresses
authorization.put(host, user + "@" + rights);
}
public void removeAuthentify(InetAddress host) {
// remove access attributes according to host addresses
authorization.remove(host);
// remove access attributes according to host addresses
authorization.remove(host);
}
public String getAuthentifyUser(InetAddress host) {

@ -176,10 +176,10 @@ public final class serverCodings {
return p;
}
public static Map string2map(String string, String separator) {
public static Map<String, String> string2map(String string, String separator) {
// this can be used to parse a Map.toString() into a Map again
if (string == null) return null;
Map map = Collections.synchronizedMap(new HashMap());
Map<String, String> map = Collections.synchronizedMap(new HashMap<String, String>());
int pos;
if ((pos = string.indexOf("{")) >= 0) string = string.substring(pos + 1).trim();
if ((pos = string.lastIndexOf("}")) >= 0) string = string.substring(0, pos).trim();
@ -193,12 +193,12 @@ public final class serverCodings {
return map;
}
public static String map2string(Map m, String separator, boolean braces) {
public static String map2string(Map<String, String> m, String separator, boolean braces) {
final StringBuffer buf = new StringBuffer(20 * m.size());
if (braces) { buf.append("{"); }
final Iterator i = m.entrySet().iterator();
final Iterator<Map.Entry<String, String>> i = m.entrySet().iterator();
while (i.hasNext()) {
final Entry e = (Entry) (i.next());
final Entry<String, String> e = i.next();
buf.append(e.getKey()).append('=');
if (e.getValue() != null) { buf.append(e.getValue()); }
buf.append(separator);
@ -208,10 +208,10 @@ public final class serverCodings {
return new String(buf);
}
public static Set string2set(String string, String separator) {
public static Set<String> string2set(String string, String separator) {
// this can be used to parse a Map.toString() into a Map again
if (string == null) return null;
Set set = Collections.synchronizedSet(new HashSet());
Set<String> set = Collections.synchronizedSet(new HashSet<String>());
int pos;
if ((pos = string.indexOf("{")) >= 0) string = string.substring(pos + 1).trim();
if ((pos = string.lastIndexOf("}")) >= 0) string = string.substring(0, pos).trim();
@ -222,10 +222,10 @@ public final class serverCodings {
return set;
}
public static String set2string(Set s, String separator, boolean braces) {
public static String set2string(Set<String> s, String separator, boolean braces) {
StringBuffer buf = new StringBuffer();
if (braces) buf.append("{");
Iterator i = s.iterator();
Iterator<String> i = s.iterator();
boolean hasNext = i.hasNext();
while (hasNext) {
buf.append(i.next().toString());

@ -64,7 +64,9 @@ import java.net.SocketException;
import java.nio.channels.ClosedByInterruptException;
import java.security.KeyStore;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import javax.net.ssl.HandshakeCompletedEvent;
import javax.net.ssl.HandshakeCompletedListener;
@ -73,9 +75,6 @@ import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import org.apache.commons.pool.impl.GenericObjectPool;
import org.apache.commons.pool.impl.GenericObjectPool.Config;
import de.anomic.icap.icapd;
import de.anomic.server.logging.serverLog;
import de.anomic.server.portForwarding.serverPortForwarding;
@ -94,21 +93,20 @@ public final class serverCore extends serverAbstractThread implements serverThre
public static final byte[] CRLF = {CR, LF}; // Line End of HTTP/ICAP headers
public static final String CRLF_STRING = new String(CRLF);
public static final String LF_STRING = new String(new byte[]{LF});
public static final Class[] stringType = {"".getClass()}; // set up some reflection
public static final Class<?>[] stringType = {"".getClass()}; // set up some reflection
public static final long startupTime = System.currentTimeMillis();
//Class[] exceptionType = {Class.forName("java.lang.Throwable")};
public static final ThreadGroup sessionThreadGroup = new ThreadGroup("sessionThreadGroup");
private static int sessionCounter = 0; // will be increased with each session and is used to return a hash code
// static variables
public static final Boolean TERMINATE_CONNECTION = Boolean.FALSE;
public static final Boolean RESUME_CONNECTION = Boolean.TRUE;
public static Hashtable bfHost = new Hashtable(); // for brute-force prevention
public static HashMap<String, Integer> bfHost = new HashMap<String, Integer>(); // for brute-force prevention
// class variables
private String extendedPort; // the port, which is visible from outside (in most cases bind-port)
private String bindPort; // if set, yacy will bind to this port, but set extendedPort in the seed
public boolean forceRestart = false; // specifies if the server should try to do a restart
private String extendedPort; // the port, which is visible from outside (in most cases bind-port)
private String bindPort; // if set, yacy will bind to this port, but set extendedPort in the seed
public boolean forceRestart = false; // specifies if the server should try to do a restart
public static boolean portForwardingEnabled = false;
public static boolean useStaticIP = false;
@ -118,24 +116,13 @@ public final class serverCore extends serverAbstractThread implements serverThre
private ServerSocket socket; // listener
serverLog log; // log object
private int timeout; // connection time-out of the socket
private int thresholdSleep = 30000; // after that time a thread is considered as beeing sleeping (30 seconds)
serverHandler handlerPrototype; // the command class (a serverHandler)
private serverSwitch switchboard; // the command class switchboard
Hashtable denyHost;
HashMap<String, String> denyHost;
int commandMaxLength;
/**
* The session-object pool
*/
SessionPool theSessionPool;
final ThreadGroup theSessionThreadGroup = new ThreadGroup("sessionThreadGroup");
private Config sessionPoolConfig = null;
public ThreadGroup getSessionThreadGroup() {
return this.theSessionThreadGroup;
}
private int maxBusySessions;
private HashSet<Session> busySessions;
/*
private static ServerSocketFactory getServerSocketFactory(boolean dflt, File keyfile, String passphrase) {
@ -197,7 +184,7 @@ public final class serverCore extends serverAbstractThread implements serverThre
this.timeout = timeout;
this.commandMaxLength = commandMaxLength;
this.denyHost = (blockAttack) ? new Hashtable() : null;
this.denyHost = (blockAttack) ? new HashMap<String, String>() : null;
this.handlerPrototype = handlerPrototype;
this.switchboard = switchboard;
@ -206,6 +193,10 @@ public final class serverCore extends serverAbstractThread implements serverThre
// init the ssl socket factory
this.sslSocketFactory = initSSLFactory();
// init session parameter
maxBusySessions = Integer.valueOf(switchboard.getConfig("httpdMaxBusySessions","100")).intValue();
busySessions = new HashSet<Session>();
// init servercore
init();
@ -224,7 +215,20 @@ public final class serverCore extends serverAbstractThread implements serverThre
// Open a new server-socket channel
try {
this.initPort(this.extendedPort, this.bindPort);
// bind the ServerSocket to a specific address
// InetSocketAddress bindAddress = null;
this.socket = new ServerSocket();
if (bindPort == null || bindPort.equals("")) {
this.log.logInfo("Trying to bind server to port " + extendedPort);
this.socket.bind(/*bindAddress = */generateSocketAddress(extendedPort));
} else { //bindPort set, use another port to bind than the port reachable from outside
this.log.logInfo("Trying to bind server to port " + bindPort+ " with "+ extendedPort + "as seedPort.");
this.socket.bind(/*bindAddress = */generateSocketAddress(bindPort));
}
// updating the port information
//yacyCore.seedDB.mySeed.put(yacySeed.PORT,Integer.toString(bindAddress.getPort()));
yacyCore.seedDB.mySeed().put(yacySeed.PORT, extendedPort);
} catch (Exception e) {
String errorMsg = "FATAL ERROR: " + e.getMessage() + " - probably root access rights needed. check port number";
this.log.logSevere(errorMsg);
@ -242,55 +246,7 @@ public final class serverCore extends serverAbstractThread implements serverThre
this.log.logSevere("Unable to initialize server port forwarding.",e);
this.switchboard.setConfig("portForwardingEnabled","false");
}
// init session pool
initSessionPool();
}
public void initSessionPool() {
this.log.logInfo("Initializing session pool ...");
// implementation of session thread pool
this.sessionPoolConfig = new GenericObjectPool.Config();
// The maximum number of active connections that can be allocated from pool at the same time,
// 0 for no limit
this.sessionPoolConfig.maxActive = Integer.valueOf(switchboard.getConfig("httpdMaxActiveSessions","150")).intValue();
// The maximum number of idle connections connections in the pool
// 0 = no limit.
this.sessionPoolConfig.maxIdle = Integer.valueOf(switchboard.getConfig("httpdMaxIdleSessions","75")).intValue();
this.sessionPoolConfig.minIdle = Integer.valueOf(switchboard.getConfig("httpdMinIdleSessions","5")).intValue();
// block undefinitely
this.sessionPoolConfig.maxWait = timeout;
// Action to take in case of an exhausted DBCP statement pool
// 0 = fail, 1 = block, 2= grow
this.sessionPoolConfig.whenExhaustedAction = GenericObjectPool.WHEN_EXHAUSTED_BLOCK;
this.sessionPoolConfig.minEvictableIdleTimeMillis = this.thresholdSleep;
//this.sessionPoolConfig.timeBetweenEvictionRunsMillis = 30000;
this.sessionPoolConfig.testOnReturn = true;
this.theSessionPool = new SessionPool(new SessionFactory(this.theSessionThreadGroup),this.sessionPoolConfig);
}
public void initPort(String seedPort, String bindPort) throws IOException {
// Binds the ServerSocket to a specific address
//InetSocketAddress bindAddress = null;
this.socket = new ServerSocket();
if(bindPort == null || bindPort.equals("")){
this.log.logInfo("Trying to bind server to port " + seedPort);
this.socket.bind(/*bindAddress = */generateSocketAddress(seedPort));
}else{ //bindPort set, use another port to bind than the port reachable from outside
this.log.logInfo("Trying to bind server to port " + bindPort+ " with "+ seedPort + "as seedPort.");
this.socket.bind(/*bindAddress = */generateSocketAddress(bindPort));
}
// updating the port information
//yacyCore.seedDB.mySeed.put(yacySeed.PORT,Integer.toString(bindAddress.getPort()));
yacyCore.seedDB.mySeed().put(yacySeed.PORT, seedPort);
}
public static int getPortNr(String extendedPortString) {
@ -317,12 +273,12 @@ public final class serverCore extends serverAbstractThread implements serverThre
String hostName = null;
this.log.logFine("Trying to determine IP address of interface '" + interfaceName + "'.");
Enumeration interfaces = NetworkInterface.getNetworkInterfaces();
Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces();
if (interfaces != null) {
while (interfaces.hasMoreElements()) {
NetworkInterface interf = (NetworkInterface) interfaces.nextElement();
NetworkInterface interf = interfaces.nextElement();
if (interf.getName().equalsIgnoreCase(interfaceName)) {
Enumeration addresses = interf.getInetAddresses();
Enumeration<InetAddress> addresses = interf.getInetAddresses();
if (addresses != null) {
while (addresses.hasMoreElements()) {
InetAddress address = (InetAddress)addresses.nextElement();
@ -363,7 +319,7 @@ public final class serverCore extends serverAbstractThread implements serverThre
this.log.logInfo("Trying to load port forwarding class for forwarding type '" + forwardingType + "'.");
String forwardingClass = this.switchboard.getConfig("portForwarding." + forwardingType ,"");
Class forwarderClass = Class.forName(forwardingClass);
Class<?> forwarderClass = Class.forName(forwardingClass);
serverCore.portForwarding = (serverPortForwarding) forwarderClass.newInstance();
// initializing port forwarding
@ -401,15 +357,7 @@ public final class serverCore extends serverAbstractThread implements serverThre
serverCore.useStaticIP=true;
}
public GenericObjectPool.Config getPoolConfig() {
return this.sessionPoolConfig ;
}
public void setPoolConfig(GenericObjectPool.Config newConfig) {
this.theSessionPool.setConfig(newConfig);
}
public void open() {
this.log.logConfig("* server started on " + serverDomains.myPublicLocalIP() + ":" + this.extendedPort);
}
@ -424,11 +372,8 @@ public final class serverCore extends serverAbstractThread implements serverThre
try {
// prepare for new connection
// idleThreadCheck();
this.switchboard.handleBusyState(this.theSessionPool.getNumActive() /*activeThreads.size() */);
this.log.logFinest(
"* waiting for connections, " + this.theSessionPool.getNumActive() + " sessions running, " +
this.theSessionPool.getNumIdle() + " sleeping");
this.switchboard.handleBusyState(this.busySessions.size());
this.log.logFinest("* waiting for connections, " + this.busySessions.size() + " sessions running");
announceThreadBlockApply();
@ -467,11 +412,9 @@ public final class serverCore extends serverAbstractThread implements serverThre
// setting the timeout properly
controlSocket.setSoTimeout(this.timeout);
// getting a free session thread from the pool
Session connection = (Session) this.theSessionPool.borrowObject();
// processing the new request
connection.execute(controlSocket,this.timeout);
// create session
Session connection = new Session(sessionThreadGroup, controlSocket, this.timeout);
this.busySessions.add(connection);
} else {
this.log.logWarning("ACCESS FROM " + cIP + " DENIED");
}
@ -504,7 +447,7 @@ public final class serverCore extends serverAbstractThread implements serverThre
}
}
// closing the serverchannel and socket
// close the serverchannel and socket
try {
this.log.logInfo("Closing server socket ...");
this.socket.close();
@ -512,243 +455,47 @@ public final class serverCore extends serverAbstractThread implements serverThre
this.log.logWarning("Unable to close the server socket.");
}
// closing the session pool
try {
this.log.logInfo("Closing server session pool ...");
this.theSessionPool.close();
} catch (Exception e) {
this.log.logWarning("Unable to close the session pool.");
}
// close all sessions
this.log.logInfo("Closing server sessions ...");
Iterator<Session> i = this.busySessions.iterator();
Session s;
while (i.hasNext()) {
s = i.next();
s.interrupt();
s.close();
}
this.busySessions = null;
this.log.logConfig("* terminated");
}
public int getJobCount() {
return this.theSessionPool.getNumActive();
return this.busySessions.size();
}
public int getActiveSessionCount() {
return this.theSessionPool.getNumActive();
}
public int getIdleSessionCount() {
return this.theSessionPool.getNumIdle();
public int getMaxSessionCount() {
return this.maxBusySessions;
}
public int getMaxSessionCount() {
return this.theSessionPool.getMaxActive();
public void setMaxSessionCount(int count) {
this.maxBusySessions = count;
}
// idle sensor: the thread is idle if there are no sessions running
public boolean idle() {
// idleThreadCheck();
return (this.theSessionPool.getNumActive() == 0);
}
public final class SessionPool extends GenericObjectPool {
public boolean isClosed = false;
/**
* First constructor.
* @param objFactory
*/
public SessionPool(SessionFactory objFactory) {
super(objFactory);
this.setMaxIdle(50); // Maximum idle threads.
this.setMaxActive(100); // Maximum active threads.
this.setMinEvictableIdleTimeMillis(30000); //Evictor runs every 30 secs.
//this.setMaxWait(1000); // Wait 1 second till a thread is available
}
public SessionPool(SessionFactory objFactory,
GenericObjectPool.Config config) {
super(objFactory, config);
}
/**
* @see org.apache.commons.pool.impl.GenericObjectPool#borrowObject()
*/
public Object borrowObject() throws Exception {
return super.borrowObject();
}
/**
* @see org.apache.commons.pool.impl.GenericObjectPool#returnObject(java.lang.Object)
*/
public void returnObject(Object obj) {
if (obj == null) return;
if (obj instanceof Session) {
try {
((Session)obj).setName("Session_inPool");
super.returnObject(obj);
} catch (Exception e) {
((Session)obj).setStopped(true);
serverLog.logSevere("SESSION-POOL","Unable to return session thread to pool.",e);
}
} else {
serverLog.logSevere("SESSION-POOL","Object of wront type '" + obj.getClass().getName() +
"' returned to pool.");
}
}
public void invalidateObject(Object obj) {
if (obj == null) return;
if (this.isClosed) return;
if (obj instanceof Session) {
try {
((Session)obj).setName("Session_invalidated");
((Session)obj).setStopped(true);
super.invalidateObject(obj);
} catch (Exception e) {
serverLog.logSevere("SESSION-POOL","Unable to invalidate session thread.",e);
}
}
}
public synchronized void close() throws Exception {
/*
* shutdown all still running session threads ...
*/
this.isClosed = true;
/* waiting for all threads to finish */
int threadCount = serverCore.this.theSessionThreadGroup.activeCount();
Thread[] threadList = new Thread[threadCount];
threadCount = serverCore.this.theSessionThreadGroup.enumerate(threadList);
try {
// trying to gracefull stop all still running sessions ...
serverCore.this.log.logInfo("Signaling shutdown to " + threadCount + " remaining session threads ...");
for ( int currentThreadIdx = 0; currentThreadIdx < threadCount; currentThreadIdx++ ) {
Thread currentThread = threadList[currentThreadIdx];
if (currentThread.isAlive()) {
if (currentThread instanceof Session) {
((Session)currentThread).setStopped(true);
}
}
}
// waiting a frew ms for the session objects to continue processing
try { Thread.sleep(500); } catch (InterruptedException ex) {}
// interrupting all still running or pooled threads ...
serverCore.this.log.logInfo("Sending interruption signal to " + serverCore.this.theSessionThreadGroup.activeCount() + " remaining session threads ...");
serverCore.this.theSessionThreadGroup.interrupt();
// if there are some sessions that are blocking in IO, we simply close the socket
serverCore.this.log.logFine("Trying to abort " + serverCore.this.theSessionThreadGroup.activeCount() + " remaining session threads ...");
for ( int currentThreadIdx = 0; currentThreadIdx < threadCount; currentThreadIdx++ ) {
Thread currentThread = threadList[currentThreadIdx];
if (currentThread.isAlive()) {
if (currentThread instanceof Session) {
serverCore.this.log.logInfo("Trying to shutdown session thread '" + currentThread.getName() + "' [" + currentThreadIdx + "].");
((Session)currentThread).close();
}
}
}
// we need to use a timeout here because of missing interruptable session threads ...
serverCore.this.log.logFine("Waiting for " + serverCore.this.theSessionThreadGroup.activeCount() + " remaining session threads to finish shutdown ...");
for ( int currentThreadIdx = 0; currentThreadIdx < threadCount; currentThreadIdx++ ) {
Thread currentThread = threadList[currentThreadIdx];
if (currentThread.isAlive()) {
if (currentThread instanceof Session) {
serverCore.this.log.logFine("Waiting for session thread '" + currentThread.getName() + "' [" + currentThreadIdx + "] to finish shutdown.");
try { currentThread.join(500); } catch (InterruptedException ex) {}
}
}
}
serverCore.this.log.logInfo("Shutdown of remaining session threads finish.");
} catch (Exception e) {
serverCore.this.log.logSevere("Unexpected error while trying to shutdown all remaining session threads.",e);
}
super.close();
}
return (this.busySessions.size() == 0);
}
public final class SessionFactory implements org.apache.commons.pool.PoolableObjectFactory {
final ThreadGroup sessionThreadGroup;
public SessionFactory(ThreadGroup theSessionThreadGroup) {
super();
if (theSessionThreadGroup == null)
throw new IllegalArgumentException("The threadgroup object must not be null.");
this.sessionThreadGroup = theSessionThreadGroup;
}
/**
* @see org.apache.commons.pool.PoolableObjectFactory#makeObject()
*/
public Object makeObject() {
Session newSession = new Session(this.sessionThreadGroup);
newSession.setPriority(Thread.MAX_PRIORITY);
return newSession;
}
/**
* @see org.apache.commons.pool.PoolableObjectFactory#destroyObject(java.lang.Object)
*/
public void destroyObject(Object obj) {
if (obj instanceof Session) {
Session theSession = (Session) obj;
synchronized(theSession) {
theSession.destroyed = true;
theSession.setName("Session_destroyed");
theSession.setStopped(true);
theSession.interrupt();
}
}
}
/**
* @see org.apache.commons.pool.PoolableObjectFactory#validateObject(java.lang.Object)
*/
public boolean validateObject(Object obj) {
return true;
}
/**
* @param obj
*
*/
public void activateObject(Object obj) {
//log.debug(" activateObject...");
}
/**
* @param obj
*
*/
public void passivateObject(Object obj) {
//log.debug(" passivateObject..." + obj);
// if (obj instanceof Session) {
// Session theSession = (Session) obj;
// }
}
}
public final class Session extends Thread {
// used as replacement for activeThreads, sleepingThreads
// static ThreadGroup sessionThreadGroup = new ThreadGroup("sessionThreadGroup");
// synchronization object needed for the threadpool implementation
private Object syncObject;
boolean destroyed = false;
private boolean running = false;
private boolean stopped = false;
private boolean done = false;
private long start; // startup time
private serverHandler commandObj;
private Hashtable commandObjMethodCache = new Hashtable(5);
private HashMap<String, Object> commandObjMethodCache = new HashMap<String, Object>(5);
private String request; // current command line
private int commandCounter; // for logging: number of commands in this session
@ -759,13 +506,30 @@ public final class serverCore extends serverAbstractThread implements serverThre
public InetAddress userAddress; // the address of the client
public int userPort; // the ip port used by the client
public PushbackInputStream in; // on control input stream
public OutputStream out; // on control output stream, autoflush
public OutputStream out; // on control output stream, auto-flush
public int socketTimeout;
public int hashIndex;
public Session(ThreadGroup theThreadGroup) {
super(theThreadGroup,"Session_created");
}
public Session(ThreadGroup theThreadGroup, Socket controlSocket, int socketTimeout) {
super(theThreadGroup, controlSocket.getInetAddress().toString() + "@" + Long.toString(System.currentTimeMillis()));
this.socketTimeout = socketTimeout;
this.controlSocket = controlSocket;
this.hashIndex = sessionCounter;
sessionCounter++;
if (!this.running) {
// this.setDaemon(true);
this.start();
} else {
this.notifyAll();
}
}
public int hashCode() {
// return a hash code so it is possible to store objects of httpc objects in a HashSet
return this.hashIndex;
}
public int getCommandCount() {
return this.commandCounter;
}
@ -805,24 +569,6 @@ public final class serverCore extends serverAbstractThread implements serverThre
} catch (Exception e) {}
}
}
public void execute(Socket controlSocket, int socketTimeout) {
this.execute(controlSocket, socketTimeout, null);
}
public synchronized void execute(Socket controlSocket, int socketTimeout, Object synObj) {
this.socketTimeout = socketTimeout;
this.controlSocket = controlSocket;
this.syncObject = synObj;
this.done = false;
if (!this.running) {
// this.setDaemon(true);
this.start();
} else {
this.notifyAll();
}
}
public long getRequestStartTime() {
return this.start;
@ -844,7 +590,7 @@ public final class serverCore extends serverAbstractThread implements serverThre
public void log(boolean outgoing, String request) {
serverCore.this.log.logFine(this.userAddress.getHostAddress() + "/" + this.identity + " " +
"[" + ((serverCore.this.theSessionPool.isClosed)? -1 : serverCore.this.theSessionPool.getNumActive()) + ", " + this.commandCounter +
"[" + ((busySessions == null)? -1 : busySessions.size()) + ", " + this.commandCounter +
((outgoing) ? "] > " : "] < ") +
request);
}
@ -874,23 +620,6 @@ public final class serverCore extends serverAbstractThread implements serverThre
public boolean isRunning() {
return this.running;
}
/**
*
*/
public void reset() {
this.done = true;
this.syncObject = null;
if (this.commandObj !=null) this.commandObj.reset();
this.userAddress = null;
this.userPort = 0;
this.controlSocket = null;
this.request = null;
}
private void shortReset() {
this.request = null;
}
/**
*
@ -900,48 +629,11 @@ public final class serverCore extends serverAbstractThread implements serverThre
public void run() {
this.running = true;
try {
// The thread keeps running.
while (!this.stopped && !this.isInterrupted() && !serverCore.this.theSessionPool.isClosed) {
if (this.done) {
synchronized (this) {
// return thread back into pool
serverCore.this.theSessionPool.returnObject(this);
// We are waiting for a new task now.
if (!this.stopped && !this.destroyed && !this.isInterrupted()) {
this.wait();
}
}
} else {
try {
// executing the new task
execute();
} finally {
// Notify the completion.
if (this.syncObject != null) {
synchronized (this.syncObject) { this.syncObject.notifyAll(); }
}
// reset thread
reset();
}
}
}
} catch (InterruptedException ex) {
serverLog.logFiner("SESSION-POOL","Interruption of thread '" + this.getName() + "' detected.");
} finally {
if (serverCore.this.theSessionPool != null && !this.destroyed)
serverCore.this.theSessionPool.invalidateObject(this);
}
}
private void execute() throws InterruptedException {
try {
// setting the session startup time
this.start = System.currentTimeMillis();
// settin the session identity
// set the session identity
this.identity = "-";
// getting some client information
@ -963,15 +655,14 @@ public final class serverCore extends serverAbstractThread implements serverThre
this.commandCounter = 0;
// listen for commands
listen();
listen();
} catch (Exception e) {
if (e instanceof InterruptedException) throw (InterruptedException) e;
System.err.println("ERROR: (internal) " + e);
} finally {
try {
if (this.controlSocket.isClosed()) return;
// flush data
} finally {
try {
if (this.controlSocket.isClosed()) return;
// flush data
this.out.flush();
// maybe this doesn't work for all SSL socket implementations
@ -991,14 +682,14 @@ public final class serverCore extends serverAbstractThread implements serverThre
this.controlSocket.close();
this.controlSocket = null;
} catch (IOException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
busySessions.remove(this);
}
//log.logDebug("* session " + handle + " completed. time = " + (System.currentTimeMillis() - handle));
}
}
private void listen() {
try {
@ -1076,7 +767,7 @@ public final class serverCore extends serverAbstractThread implements serverThre
if (commandMethod == null) {
try {
commandMethod = this.commandObj.getClass().getMethod(reqCmd, stringType);
this.commandObjMethodCache.put(reqProtocol + "_" + reqCmd,commandMethod);
this.commandObjMethodCache.put(reqProtocol + "_" + reqCmd, commandMethod);
} catch (NoSuchMethodException noMethod) {
commandMethod = this.commandObj.getClass().getMethod("UNKNOWN", stringType);
stringParameter[0] = this.request.trim();
@ -1144,10 +835,7 @@ public final class serverCore extends serverAbstractThread implements serverThre
System.out.println("ERROR E " + this.userAddress.getHostAddress());
// whatever happens: the thread has to survive!
writeLine("UNKNOWN REASON:" + this.commandObj.error(e));
}
shortReset();
}
} // end of while
} /* catch (java.lang.ClassNotFoundException e) {
System.out.println("Internal error: Wrapper class not found: " + e.getMessage());
@ -1248,7 +936,6 @@ public final class serverCore extends serverAbstractThread implements serverThre
}
protected void finalize() throws Throwable {
if (!this.theSessionPool.isClosed) this.theSessionPool.close();
super.finalize();
}

@ -66,6 +66,7 @@ import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.InetAddress;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Hashtable;
@ -75,7 +76,7 @@ import de.anomic.data.htmlTools;
import de.anomic.plasma.plasmaSwitchboard;
import de.anomic.tools.yFormatter;
public class serverObjects extends Hashtable implements Cloneable {
public class serverObjects extends Hashtable<String, String> implements Cloneable {
private static final long serialVersionUID = 1L;
private boolean localized = true;
@ -88,7 +89,7 @@ public class serverObjects extends Hashtable implements Cloneable {
super(initialCapacity);
}
public serverObjects(Map input) {
public serverObjects(Map<String, String> input) {
super(input);
}
@ -101,7 +102,7 @@ public class serverObjects extends Hashtable implements Cloneable {
* @return The value that was added to the map.
* @see java.util.Hashtable#put(K, V)
*/
public Object put(Object key, Object value) {
public String put(String key, String value) {
if (key == null) {
// this does nothing
return null;
@ -113,21 +114,14 @@ public class serverObjects extends Hashtable implements Cloneable {
}
}
/**
* This method just calls {@link #put(Object, Object)}.
*/
public String put(String key, String value) {
return (String) this.put((Object) key, value);
}
/**
* Add byte array to the map, value is kept as it is.
* @param key key name as String.
* @param value mapped value as a byte array.
* @return the added value.
* @return the previous value as String.
*/
public byte[] put(String key, byte[] value) {
return (byte[]) this.put((Object) key, (Object) value); //TODO: do we need an encoding method for byte[]?
public String put(String key, byte[] value) {
return this.put(key, new String(value)); //TODO: do we need an encoding method for byte[]?
}
/**
@ -157,6 +151,18 @@ public class serverObjects extends Hashtable implements Cloneable {
}
}
public String put(String key, java.util.Date value) {
return this.put(key, value.toString());
}
public String put(String key, serverDate value) {
return this.put(key, value.toString());
}
public String put(String key, InetAddress value) {
return this.put(key, value.toString());
}
/**
* Add a String to the map. The content of the String is escaped to be usable in HTML output.
* @param key key name as String.
@ -175,7 +181,7 @@ public class serverObjects extends Hashtable implements Cloneable {
* replaced in the returned String.
*/
public String putHTML(String key, String value, boolean forXML) {
return (String) put((Object) key, htmlTools.encodeUnicode2html(value, true, forXML));
return (String) put(key, htmlTools.encodeUnicode2html(value, true, forXML));
}
/**
@ -187,7 +193,7 @@ public class serverObjects extends Hashtable implements Cloneable {
* @return the String value added to the map.
*/
public String putNum(String key, long value) {
return (String) this.put((Object) key, yFormatter.number(value, this.localized));
return (String) this.put(key, yFormatter.number(value, this.localized));
}
/**
@ -195,7 +201,7 @@ public class serverObjects extends Hashtable implements Cloneable {
* @see #putNum(String, long)
*/
public String putNum(String key, double value) {
return (String) this.put((Object) key, yFormatter.number(value, this.localized));
return (String) this.put(key, yFormatter.number(value, this.localized));
}
/**
@ -203,28 +209,28 @@ public class serverObjects extends Hashtable implements Cloneable {
* @see #putNum(String, long)
*/
public String putNum(String key, String value) {
return (String) this.put((Object) key, yFormatter.number(value));
return (String) this.put(key, yFormatter.number(value));
}
public String putWiki(String key, String wikiCode){
return this.put(key, plasmaSwitchboard.wikiParser.transform(wikiCode));
return (String) this.put(key, plasmaSwitchboard.wikiParser.transform(wikiCode));
}
public String putWiki(String key, byte[] wikiCode) {
try {
return this.put(key, plasmaSwitchboard.wikiParser.transform(wikiCode));
return (String) this.put(key, plasmaSwitchboard.wikiParser.transform(wikiCode));
} catch (UnsupportedEncodingException e) {
return this.put(key, "Internal error pasting wiki-code: " + e.getMessage());
return (String) this.put(key, "Internal error pasting wiki-code: " + e.getMessage());
}
}
public String putWiki(String key, String wikiCode, String publicAddress) {
return this.put(key, plasmaSwitchboard.wikiParser.transform(wikiCode, publicAddress));
return (String) this.put(key, plasmaSwitchboard.wikiParser.transform(wikiCode, publicAddress));
}
public String putWiki(String key, byte[] wikiCode, String publicAddress) {
try {
return this.put(key, plasmaSwitchboard.wikiParser.transform(wikiCode, "UTF-8", publicAddress));
return (String) this.put(key, plasmaSwitchboard.wikiParser.transform(wikiCode, "UTF-8", publicAddress));
} catch (UnsupportedEncodingException e) {
return this.put(key, "Internal error pasting wiki-code: " + e.getMessage());
return (String) this.put(key, "Internal error pasting wiki-code: " + e.getMessage());
}
}
@ -245,7 +251,8 @@ public class serverObjects extends Hashtable implements Cloneable {
// string variant
public String get(String key, String dflt) {
return (String) this.get(key, (Object) dflt);
Object result = super.get(key);
if (result == null) return dflt; else return (String) result;
}
public int getInt(String key, int dflt) {
@ -272,12 +279,12 @@ public class serverObjects extends Hashtable implements Cloneable {
public String[] getAll(String keyMapper) {
// the keyMapper may contain regular expressions as defined in String.matches
// this method is particulary useful when parsing the result of checkbox forms
ArrayList v = new ArrayList();
Enumeration e = keys();
ArrayList<String> v = new ArrayList<String>();
Enumeration<String> e = keys();
String key;
while (e.hasMoreElements()) {
key = (String) e.nextElement();
if (key.matches(keyMapper)) v.add(get(key));
key = e.nextElement();
if (key.matches(keyMapper)) v.add((String) get(key));
}
// make a String[]
String[] result = new String[v.size()];
@ -285,10 +292,10 @@ public class serverObjects extends Hashtable implements Cloneable {
return result;
}
// put all elements of another hastable into the own table
// put all elements of another hashtable into the own table
public void putAll(serverObjects add) {
Enumeration e = add.keys();
Object k;
Enumeration<String> e = add.keys();
String k;
while (e.hasMoreElements()) {
k = e.nextElement();
put(k, add.get(k));
@ -300,10 +307,10 @@ public class serverObjects extends Hashtable implements Cloneable {
BufferedOutputStream fos = null;
try {
fos = new BufferedOutputStream(new FileOutputStream(f));
Enumeration e = keys();
Enumeration<String> e = keys();
String key, value;
while (e.hasMoreElements()) {
key = (String) e.nextElement();
key = e.nextElement();
value = ((String) get(key)).replaceAll("\n", "\\\\n");
fos.write((key + "=" + value + "\r\n").getBytes());
}

@ -68,8 +68,8 @@ public interface serverSwitch {
// access tracker
public void track(String host, String accessPath); // learn that a specific host has accessed a specific path
public TreeMap accessTrack(String host); // returns mapping from Long(accesstime) to path
public Iterator accessHosts(); // returns an iterator of hosts in tracker (String)
public TreeMap<Long, String> accessTrack(String host); // returns mapping from Long(accesstime) to path
public Iterator<String> accessHosts(); // returns an iterator of hosts in tracker (String)
// a switchboard can have action listener
// these listeners are hooks for numerous methods below
@ -94,18 +94,18 @@ public interface serverSwitch {
public void intermissionAllThreads(long pause);
public void terminateAllThreads(boolean waitFor);
public Iterator /*of serverThread-Names (String)*/ threadNames();
public Iterator<String> /*of serverThread-Names (String)*/ threadNames();
// the switchboard can be used to set and read properties
public void setConfig(Map otherConfigs);
public void setConfig(Map<String, String> otherConfigs);
public void setConfig(String key, long value);
public void setConfig(String key, String value);
public String getConfig(String key, String dflt);
public long getConfigLong(String key, long dflt);
public boolean getConfigBool(String key, boolean dflt);
public File getConfigPath(String key, String dflt);
public Iterator configKeys();
public Map getRemoved();
public Iterator<String> configKeys();
public Map<String, String> getRemoved();
// the switchboard also shall maintain a job list
// jobs can be queued by submitting a job object

@ -38,48 +38,54 @@ public class servletProperties extends serverObjects {
private String prefix="";
private httpHeader outgoingHeader;
public servletProperties(){
super();
}
public servletProperties(serverObjects so){
public servletProperties(serverObjects so) {
super(so);
}
public void setOutgoingHeader(httpHeader outgoingHeader)
{
this.outgoingHeader=outgoingHeader;
public void setOutgoingHeader(httpHeader outgoingHeader) {
this.outgoingHeader = outgoingHeader;
}
public httpHeader getOutgoingHeader()
{
public httpHeader getOutgoingHeader() {
if(outgoingHeader!=null)
return outgoingHeader;
else
return new httpHeader();
}
public void setPrefix(String myprefix){
public void setPrefix(String myprefix) {
prefix=myprefix;
}
public byte[] put(String key, byte[] value) {
return super.put(prefix+key, value);
}
public String put(String key, String value) {
return super.put(prefix+key, value);
public String put(String key, byte[] value) {
return super.put(prefix + key, value);
}
public long put(String key, long value) {
return super.put(prefix+key, value);
return super.put(prefix + key, value);
}
public long inc(String key) {
return super.inc(prefix+key);
}
public Object get(String key, Object dflt) {
return super.get(prefix+key, dflt);
}
public String get(String key, String dflt) {
return super.get(prefix+key, dflt);
}
public int getInt(String key, int dflt) {
return super.getInt(prefix+key, dflt);
}
public long getLong(String key, long dflt) {
return super.getLong(prefix+key, dflt);
}

@ -45,7 +45,11 @@
package de.anomic.yacy;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Properties;
import java.util.Map.Entry;
import de.anomic.kelondro.kelondroNaturalOrder;
import de.anomic.kelondro.kelondroRow;
@ -63,7 +67,7 @@ public class yacyNewsRecord {
private Date received; // Date when news was received here at this peer
private String category; // keyword that adresses possible actions
private int distributed; // counter that counts number of distributions of this news record
private Map attributes; // elemets of the news for a special category
private Map<String, String> attributes; // elemets of the news for a special category
public static final int attributesMaxLength = maxNewsRecordLength
- idLength
@ -88,8 +92,24 @@ public class yacyNewsRecord {
return null;
}
}
public static yacyNewsRecord newRecord(String category, Properties attributes) {
try {
HashMap<String, String> m = new HashMap<String, String>();
Iterator<Entry<Object, Object>> e = attributes.entrySet().iterator();
Map.Entry<Object, Object> entry;
while (e.hasNext()) {
entry = e.next();
m.put((String) entry.getKey(), (String) entry.getValue());
}
return new yacyNewsRecord(category, m);
} catch (IllegalArgumentException e) {
yacyCore.log.logWarning("rejected bad yacy news record: " + e.getMessage());
return null;
}
}
public static yacyNewsRecord newRecord(String category, Map attributes) {
public static yacyNewsRecord newRecord(String category, Map<String, String> attributes) {
try {
return new yacyNewsRecord(category, attributes);
} catch (IllegalArgumentException e) {
@ -98,7 +118,7 @@ public class yacyNewsRecord {
}
}
public static yacyNewsRecord newRecord(String id, String category, Date received, int distributed, Map attributes) {
public static yacyNewsRecord newRecord(String id, String category, Date received, int distributed, Map<String, String> attributes) {
try {
return new yacyNewsRecord(id, category, received, distributed, attributes);
} catch (IllegalArgumentException e) {
@ -119,7 +139,7 @@ public class yacyNewsRecord {
removeStandards();
}
public yacyNewsRecord(String category, Map attributes) {
public yacyNewsRecord(String category, Map<String, String> attributes) {
if (category.length() > categoryStringLength) throw new IllegalArgumentException("category length (" + category.length() + ") exceeds maximum (" + categoryStringLength + ")");
if (attributes.toString().length() > attributesMaxLength) throw new IllegalArgumentException("attributes length (" + attributes.toString().length() + ") exceeds maximum (" + attributesMaxLength + ")");
this.attributes = attributes;
@ -131,7 +151,7 @@ public class yacyNewsRecord {
removeStandards();
}
protected yacyNewsRecord(String id, String category, Date received, int distributed, Map attributes) {
protected yacyNewsRecord(String id, String category, Date received, int distributed, Map<String, String> attributes) {
if (category.length() > categoryStringLength) throw new IllegalArgumentException("category length (" + category.length() + ") exceeds maximum (" + categoryStringLength + ")");
if (attributes.toString().length() > attributesMaxLength) throw new IllegalArgumentException("attributes length (" + attributes.toString().length() + ") exceeds maximum (" + attributesMaxLength + ")");
this.attributes = attributes;
@ -192,7 +212,7 @@ public class yacyNewsRecord {
distributed++;
}
public Map attributes() {
public Map<String, String> attributes() {
return attributes;
}

@ -354,8 +354,8 @@ public class yacyURL {
public static String dummyHash;
private static HashMap TLDID = new HashMap();
private static HashMap TLDName = new HashMap();
private static HashMap<String, Integer> TLDID = new HashMap<String, Integer>();
private static HashMap<String, String> TLDName = new HashMap<String, String>();
private static void insertTLDProps(String[] TLDList, int id) {
int p;
@ -1004,11 +1004,11 @@ public class yacyURL {
private static String[] testTLDs = new String[] { "com", "net", "org", "uk", "fr", "de", "es", "it" };
public static final yacyURL probablyWordURL(String urlHash, TreeSet words) {
Iterator wi = words.iterator();
public static final yacyURL probablyWordURL(String urlHash, TreeSet<String> words) {
Iterator<String> wi = words.iterator();
String word;
while (wi.hasNext()) {
word = (String) wi.next();
word = wi.next();
if ((word == null) || (word.length() == 0)) continue;
String pattern = urlHash.substring(6, 11);
for (int i = 0; i < testTLDs.length; i++) {
@ -1023,7 +1023,7 @@ public class yacyURL {
return null;
}
public static final boolean isWordRootURL(String givenURLHash, TreeSet words) {
public static final boolean isWordRootURL(String givenURLHash, TreeSet<String> words) {
if (!(probablyRootURL(givenURLHash))) return false;
yacyURL wordURL = probablyWordURL(givenURLHash, words);
if (wordURL == null) return false;

@ -903,13 +903,6 @@ public final class yacy {
// go into headless awt mode
System.setProperty("java.awt.headless", "true");
//which XML Parser?
// if(System.getProperty("javax.xml.parsers.DocumentBuilderFactory")==null){
// System.setProperty("javax.xml.parsers.DocumentBuilderFactory", "org.apache.crimson.jaxp.DocumentBuilderFactoryImpl");
// }
// if(System.getProperty("javax.xml.parsers.SAXParserFactory")==null){
// System.setProperty("javax.xml.parsers.SAXParserFactory", "org.apache.crimson.jaxp.SAXParserFactoryImpl");
// }
String applicationRoot = System.getProperty("user.dir").replace('\\', '/');
//System.out.println("args.length=" + args.length);

@ -141,11 +141,10 @@ bootstrapLoadTimeout = 6000
clientTimeout = 10000
# maximal number of httpd sessions
# a client may open several connections at one, and the httpdMaxActiveSessions value sets
# a client may open several connections at once, and the httpdMaxBusySessions value sets
# a limit on the number of concurrent connections
httpdMaxActiveSessions = 150
httpdMaxIdleSessions = 75
httpdMinIdleSessions = 5
httpdMaxBusySessions = 100
httpdMaxBusySessions__pro = 200
# default root path for the file server
# may be overridden by the htdocs parameter

Loading…
Cancel
Save