2006-02-06 20:47:59 +01:00
|
|
|
|
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;
|
2009-01-30 23:44:20 +01:00
|
|
|
import de.anomic.kelondro.util.MemoryControl;
|
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;
|
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();
|
2009-03-18 22:25:52 +01:00
|
|
|
final int cacheMaxSize = (int) sb.getConfigLong(plasmaSwitchboardConstants.WORDCACHE_MAX_COUNT, 10000);
|
2008-08-04 12:47:26 +02:00
|
|
|
prop.putNum("ppm", sb.currentPPM());
|
2009-03-13 11:34:51 +01:00
|
|
|
prop.putNum("qpm", sb.webIndex.peers().mySeed().getQPM());
|
2009-03-18 22:25:52 +01:00
|
|
|
prop.put("wordCacheSize", Integer.toString(sb.webIndex.index().getBufferSize()));
|
|
|
|
prop.put("wordCacheMaxSize", Integer.toString(cacheMaxSize));
|
2006-11-03 20:44:31 +01:00
|
|
|
//
|
|
|
|
// memory usage and system attributes
|
2009-01-30 16:33:00 +01:00
|
|
|
prop.putNum("freeMemory", MemoryControl.free());
|
|
|
|
prop.putNum("totalMemory", MemoryControl.total());
|
2009-04-17 00:45:39 +02:00
|
|
|
prop.putNum("maxMemory", MemoryControl.maxMemory);
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|