missing code for last commit

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@6454 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 15 years ago
parent b6a8887ff5
commit 2889b9426e

@ -136,7 +136,7 @@ public final class serverCore extends AbstractBusyThread implements BusyThread {
private long lastAutoTermination; private long lastAutoTermination;
public final void terminateOldSessions(long minage) { public final void terminateOldSessions(long minage) {
if (System.currentTimeMillis() - lastAutoTermination < 30000) return; if (System.currentTimeMillis() - lastAutoTermination < 3000) return;
this.lastAutoTermination = System.currentTimeMillis(); this.lastAutoTermination = System.currentTimeMillis();
//if (serverCore.sessionThreadGroup.activeCount() < maxBusySessions - 10) return; // don't panic //if (serverCore.sessionThreadGroup.activeCount() < maxBusySessions - 10) return; // don't panic
final Thread[] threadList = new Thread[this.getJobCount()]; final Thread[] threadList = new Thread[this.getJobCount()];
@ -326,11 +326,13 @@ public final class serverCore extends AbstractBusyThread implements BusyThread {
announceThreadBlockRelease(); announceThreadBlockRelease();
int pp; int pp, trycount = 0;
while ((pp = sessionThreadGroup.activeCount()) >= this.maxBusySessions) { while ((pp = sessionThreadGroup.activeCount()) >= this.maxBusySessions) {
terminateOldSessions(3000); terminateOldSessions(3000);
this.log.logInfo("termination of old sessions: before = " + pp + ", after = " + sessionThreadGroup.activeCount()); this.log.logInfo("termination of old sessions: before = " + pp + ", after = " + sessionThreadGroup.activeCount());
if (sessionThreadGroup.activeCount() < this.maxBusySessions) break; if (sessionThreadGroup.activeCount() < this.maxBusySessions) break;
if (trycount++ > 5) break;
Thread.sleep(1000); // lets try again after a short break
} }
if (sessionThreadGroup.activeCount() >= this.maxBusySessions) { if (sessionThreadGroup.activeCount() >= this.maxBusySessions) {

Loading…
Cancel
Save