2006-02-06 20:47:59 +01:00
|
|
|
// /xml.queues/status_p.java
|
|
|
|
// -------------------------------
|
2006-11-03 20:44:31 +01:00
|
|
|
// part of the yacy
|
2006-02-06 20:47:59 +01:00
|
|
|
//
|
2006-11-03 20:44:31 +01:00
|
|
|
// (C) 2006 Alexander Schier
|
|
|
|
// last major change: 03.11.2006
|
2006-02-06 20:47:59 +01:00
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation; either version 2 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
2006-11-03 20:44:31 +01:00
|
|
|
// along with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2006-02-06 20:47:59 +01:00
|
|
|
|
|
|
|
package xml;
|
2008-08-25 20:11:47 +02:00
|
|
|
|
|
|
|
import de.anomic.http.httpRequestHeader;
|
2008-01-06 01:31:26 +01:00
|
|
|
import de.anomic.http.httpdByteCountInputStream;
|
|
|
|
import de.anomic.http.httpdByteCountOutputStream;
|
2006-02-06 20:47:59 +01:00
|
|
|
import de.anomic.plasma.plasmaSwitchboard;
|
2008-08-02 15:57:00 +02:00
|
|
|
import de.anomic.plasma.plasmaSwitchboardConstants;
|
2008-03-02 16:42:50 +01:00
|
|
|
import de.anomic.server.serverMemory;
|
2006-02-06 20:47:59 +01:00
|
|
|
import de.anomic.server.serverObjects;
|
2008-02-27 16:16:47 +01:00
|
|
|
import de.anomic.server.serverProcessor;
|
2006-02-06 20:47:59 +01:00
|
|
|
import de.anomic.server.serverSwitch;
|
|
|
|
|
|
|
|
public class status_p {
|
|
|
|
|
|
|
|
|
2008-08-25 20:11:47 +02:00
|
|
|
public static serverObjects respond(final httpRequestHeader header, final serverObjects post, final serverSwitch<?> env) {
|
2006-02-06 20:47:59 +01:00
|
|
|
// return variable that accumulates replacements
|
2008-08-02 14:12:04 +02:00
|
|
|
final plasmaSwitchboard sb = (plasmaSwitchboard) env;
|
|
|
|
final serverObjects prop = new serverObjects();
|
2007-10-24 23:38:19 +02:00
|
|
|
if (post == null || !post.containsKey("html"))
|
|
|
|
prop.setLocalized(false);
|
|
|
|
prop.put("rejected", "0");
|
2008-06-04 23:34:57 +02:00
|
|
|
sb.updateMySeed();
|
2008-05-14 23:36:02 +02:00
|
|
|
final int cacheOutSize = sb.webIndex.dhtOutCacheSize();
|
2008-08-02 15:57:00 +02:00
|
|
|
final long cacheMaxSize = sb.getConfigLong(plasmaSwitchboardConstants.WORDCACHE_MAX_COUNT, 10000);
|
2008-08-04 12:47:26 +02:00
|
|
|
prop.putNum("ppm", sb.currentPPM());
|
2008-05-14 23:36:02 +02:00
|
|
|
prop.putNum("qpm", sb.webIndex.seedDB.mySeed().getQPM());
|
|
|
|
prop.putNum("wordCacheSize", sb.webIndex.dhtOutCacheSize() + sb.webIndex.dhtInCacheSize());
|
2007-10-24 23:38:19 +02:00
|
|
|
prop.putNum("wordCacheWSize", cacheOutSize);
|
2008-05-14 23:36:02 +02:00
|
|
|
prop.putNum("wordCacheKSize", sb.webIndex.dhtInCacheSize());
|
2007-10-24 23:38:19 +02:00
|
|
|
prop.putNum("wordCacheMaxSize", cacheMaxSize);
|
|
|
|
prop.put("wordCacheWCount", cacheOutSize);
|
|
|
|
prop.put("wordCacheMaxCount", cacheMaxSize);
|
2006-02-06 20:47:59 +01:00
|
|
|
|
2006-11-03 20:44:31 +01:00
|
|
|
//
|
|
|
|
// memory usage and system attributes
|
2008-03-02 16:42:50 +01:00
|
|
|
prop.putNum("freeMemory", serverMemory.free());
|
|
|
|
prop.putNum("totalMemory", serverMemory.total());
|
|
|
|
prop.putNum("maxMemory", serverMemory.max());
|
2008-02-27 16:16:47 +01:00
|
|
|
prop.putNum("processors", serverProcessor.availableCPU);
|
2006-11-03 20:44:31 +01:00
|
|
|
|
|
|
|
// proxy traffic
|
|
|
|
prop.put("trafficIn", httpdByteCountInputStream.getGlobalCount());
|
2007-03-16 14:52:48 +01:00
|
|
|
prop.put("trafficProxy", httpdByteCountOutputStream.getAccountCount("PROXY"));
|
2006-11-03 20:44:31 +01:00
|
|
|
prop.put("trafficCrawler", httpdByteCountInputStream.getAccountCount("CRAWLER"));
|
|
|
|
|
2006-02-06 20:47:59 +01:00
|
|
|
// return rewrite properties
|
|
|
|
return prop;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|