*) Setting higher priority for session threads

See: http://www.yacy-forum.de/viewtopic.php?p=6120#6120

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@490 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
theli 20 years ago
parent 2dd2533e6d
commit e6aced0162

@ -101,11 +101,9 @@ public final class serverCore extends serverAbstractThread implements serverThre
public static serverPortForwarding portForwarding = null;
private ServerSocket socket; // listener
public int maxSessions = 0; // max. number of sessions; 0=unlimited
serverLog log; // log object
private int timeout; // connection time-out of the socket
private boolean termSleepingThreads; // if true then threads over sleepthreashold are killed
private int thresholdActive = 5000; // after that time a thread should have got a command line
private int thresholdSleep = 30000; // after that time a thread is considered as beeing sleeping (30 seconds)
private int thresholdDead = 3600000; // after that time a thread is considered as beeing dead-locked (1 hour)
@ -174,9 +172,7 @@ public final class serverCore extends serverAbstractThread implements serverThre
// class initializer
public serverCore(
int port,
int maxSessions,
int timeout,
boolean termSleepingThreads,
boolean blockAttack,
serverHandler handlerPrototype,
serverSwitch switchboard,
@ -215,9 +211,7 @@ public final class serverCore extends serverAbstractThread implements serverThre
this.switchboard = switchboard;
this.initHandlerClasses = new Class[] {Class.forName("de.anomic.server.serverSwitch")};
this.initSessionClasses = new Class[] {Class.forName("de.anomic.server.serverCore$Session")};
this.maxSessions = maxSessions;
this.timeout = timeout;
this.termSleepingThreads = termSleepingThreads;
} catch (java.lang.ClassNotFoundException e) {
System.out.println("FATAL ERROR: " + e.getMessage() + " - Class Not Found"); System.exit(0);
}
@ -238,12 +232,12 @@ public final class serverCore extends serverAbstractThread implements serverThre
// The maximum number of active connections that can be allocated from pool at the same time,
// 0 for no limit
this.cralwerPoolConfig.maxActive = this.maxSessions;
this.cralwerPoolConfig.maxActive = Integer.valueOf(switchboard.getConfig("httpdMaxActiveSessions","150")).intValue();
// The maximum number of idle connections connections in the pool
// 0 = no limit.
this.cralwerPoolConfig.maxIdle = this.maxSessions / 2;
this.cralwerPoolConfig.minIdle = this.maxSessions / 4;
this.cralwerPoolConfig.maxIdle = Integer.valueOf(switchboard.getConfig("httpdMaxIdleSessions","75")).intValue();
this.cralwerPoolConfig.minIdle = Integer.valueOf(switchboard.getConfig("httpdMinIdleSessions","5")).intValue();
// block undefinitely
this.cralwerPoolConfig.maxWait = timeout;
@ -580,7 +574,9 @@ public final class serverCore extends serverAbstractThread implements serverThre
* @see org.apache.commons.pool.PoolableObjectFactory#makeObject()
*/
public Object makeObject() {
return new Session(this.sessionThreadGroup);
Session newSession = new Session(this.sessionThreadGroup);
newSession.setPriority(Thread.MAX_PRIORITY);
return newSession;
}
/**

@ -247,7 +247,6 @@ public final class yacy {
int port = Integer.parseInt(sb.getConfig("port", "8080"));
int timeout = Integer.parseInt(sb.getConfig("httpdTimeout", "60000"));
if (timeout < 60000) timeout = 60000;
int maxSessions = Integer.parseInt(sb.getConfig("httpdMaxSessions", "100"));
// create some directories
File htRootPath = new File(sb.getRootPath(), sb.getConfig("htRootPath", "htroot"));
@ -342,9 +341,7 @@ public final class yacy {
try {
httpd protocolHandler = new httpd(sb, new httpdFileHandler(sb), new httpdProxyHandler(sb));
serverCore server = new serverCore(port,
maxSessions /*sessions*/,
timeout /*control socket timeout in milliseconds*/,
true /* terminate sleeping threads */,
true /* block attacks (wrong protocol) */,
protocolHandler /*command class*/,
sb,

Loading…
Cancel
Save