Increased the default timeout for ThreadBasedDispatcher to 10 seconds

This commit is contained in:
Viktor Klang 2010-08-31 09:33:34 +02:00
parent a7d7923af8
commit 4df0b66fbd
2 changed files with 11 additions and 1 deletions

View file

@ -10,6 +10,7 @@ import se.scalablesolutions.akka.config.Config.config
import net.lag.configgy.ConfigMap
import se.scalablesolutions.akka.util.UUID
import java.util.concurrent.ThreadPoolExecutor.{AbortPolicy, CallerRunsPolicy, DiscardOldestPolicy, DiscardPolicy}
import java.util.concurrent.TimeUnit
/**
* Scala API. Dispatcher factory.
@ -75,6 +76,7 @@ object Dispatchers extends Logging {
/**
* Creates an thread based dispatcher serving a single actor through the same single thread.
* Uses the default timeout
* <p/>
* E.g. each actor consumes its own thread.
*/
@ -82,11 +84,19 @@ object Dispatchers extends Logging {
/**
* Creates an thread based dispatcher serving a single actor through the same single thread.
* Uses the default timeout
* <p/>
* E.g. each actor consumes its own thread.
*/
def newThreadBasedDispatcher(actor: ActorRef, mailboxCapacity: Int) = new ThreadBasedDispatcher(actor, mailboxCapacity)
/**
* Creates an thread based dispatcher serving a single actor through the same single thread.
* <p/>
* E.g. each actor consumes its own thread.
*/
def newThreadBasedDispatcher(actor: ActorRef, mailboxCapacity: Int, pushTimeout: Long, pushTimeUnit: TimeUnit) = new ThreadBasedDispatcher(actor, mailboxCapacity, pushTimeout, pushTimeUnit)
/**
* Creates a executor-based event-driven dispatcher serving multiple (millions) of actors through a thread pool.
* <p/>

View file

@ -18,7 +18,7 @@ import concurrent.forkjoin.{TransferQueue, LinkedTransferQueue}
*/
class ThreadBasedDispatcher(private val actor: ActorRef,
val mailboxCapacity: Int = Dispatchers.MAILBOX_CAPACITY,
val pushTimeout: Long = 1000,
val pushTimeout: Long = 10000,
val pushTimeoutUnit: TimeUnit = TimeUnit.MILLISECONDS
) extends MessageDispatcher {
def this(actor: ActorRef) = this(actor, Dispatchers.MAILBOX_CAPACITY)// For Java