Skip to content

Commit

Permalink
Fix kestrel on uniprocessor boxes (maxthreads should always >= 4).
Browse files Browse the repository at this point in the history
  • Loading branch information
hugohallqvist committed Dec 3, 2009
1 parent e196c17 commit 35b2999
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/main/scala/net/lag/kestrel/Kestrel.scala
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,16 @@ object Kestrel {

def startup(config: Config): Unit = {
// this one is used by the actor initialization, so can only be set at startup.
val maxThreads = config.getInt("max_threads", Runtime.getRuntime().availableProcessors * 2)
var maxThreads = config.getInt("max_threads", Runtime.getRuntime().availableProcessors * 2)

// If we don't set this to atleast 4, we get an IllegalArgumentException
// when constructing the ThreadPoolExecutor from inside
// FJTaskScheduler2.scala
// This is due to minNumThreads = 4 in FJTaskScheduler2.scala
// and maxThreads is set to 2 above, when running on a uni-processor box
if (maxThreads < 4)
maxThreads = 4

System.setProperty("actors.maxPoolSize", maxThreads.toString)
log.debug("max_threads=%d", maxThreads)

Expand Down

0 comments on commit 35b2999

Please sign in to comment.