Skip to content

Commit

Permalink
missing code for last commit
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@6454 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
orbiter committed Nov 4, 2009
1 parent b6a8887 commit 2889b94
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions source/de/anomic/server/serverCore.java
Expand Up @@ -136,7 +136,7 @@ public final class serverCore extends AbstractBusyThread implements BusyThread {
private long lastAutoTermination;

public final void terminateOldSessions(long minage) {
if (System.currentTimeMillis() - lastAutoTermination < 30000) return;
if (System.currentTimeMillis() - lastAutoTermination < 3000) return;
this.lastAutoTermination = System.currentTimeMillis();
//if (serverCore.sessionThreadGroup.activeCount() < maxBusySessions - 10) return; // don't panic
final Thread[] threadList = new Thread[this.getJobCount()];
Expand Down Expand Up @@ -326,11 +326,13 @@ public boolean job() throws Exception {

announceThreadBlockRelease();

int pp;
int pp, trycount = 0;
while ((pp = sessionThreadGroup.activeCount()) >= this.maxBusySessions) {
terminateOldSessions(3000);
this.log.logInfo("termination of old sessions: before = " + pp + ", after = " + sessionThreadGroup.activeCount());
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) {
Expand Down

0 comments on commit 2889b94

Please sign in to comment.