introduce akka.actor.creation-timeout to make Jenkins happy

- I had reused akka.actor.timeout for ActorSystem.actorOf calls (which
  “ask” the guardian to create the actor), but 5sec proved too short for
  Jenkins
- CreationTimeout defaults to 30sec now, let’s hope Jenkins is not
  slower than _that_.
This commit is contained in:
Roland 2011-12-06 16:27:10 +01:00
parent 66c1d62a51
commit d6fc97c48d
4 changed files with 20 additions and 16 deletions

View file

@ -36,6 +36,7 @@ akka {
actor { actor {
provider = "akka.actor.LocalActorRefProvider" provider = "akka.actor.LocalActorRefProvider"
creation-timeout = 20s # Timeout for ActorSystem.actorOf
timeout = 5s # Default timeout for Future based invocations timeout = 5s # Default timeout for Future based invocations
# - Actor: ask && ? # - Actor: ask && ?
# - UntypedActor: ask # - UntypedActor: ask

View file

@ -562,8 +562,8 @@ class LocalDeathWatch extends DeathWatch with ActorClassification {
* Scheduled tasks (Runnable and functions) are executed with the supplied dispatcher. * Scheduled tasks (Runnable and functions) are executed with the supplied dispatcher.
* Note that dispatcher is by-name parameter, because dispatcher might not be initialized * Note that dispatcher is by-name parameter, because dispatcher might not be initialized
* when the scheduler is created. * when the scheduler is created.
* *
* The HashedWheelTimer used by this class MUST throw an IllegalStateException * The HashedWheelTimer used by this class MUST throw an IllegalStateException
* if it does not enqueue a task. Once a task is queued, it MUST be executed or * if it does not enqueue a task. Once a task is queued, it MUST be executed or
* returned from stop(). * returned from stop().
*/ */

View file

@ -71,6 +71,7 @@ object ActorSystem {
val ProviderClass = getString("akka.actor.provider") val ProviderClass = getString("akka.actor.provider")
val CreationTimeout = Timeout(Duration(getMilliseconds("akka.actor.creation-timeout"), MILLISECONDS))
val ActorTimeout = Timeout(Duration(getMilliseconds("akka.actor.timeout"), MILLISECONDS)) val ActorTimeout = Timeout(Duration(getMilliseconds("akka.actor.timeout"), MILLISECONDS))
val SerializeAllMessages = getBoolean("akka.actor.serialize-messages") val SerializeAllMessages = getBoolean("akka.actor.serialize-messages")
@ -300,19 +301,21 @@ class ActorSystemImpl(val name: String, applicationConfig: Config) extends Actor
protected def systemImpl = this protected def systemImpl = this
implicit def timeout = settings.ActorTimeout private[akka] def systemActorOf(props: Props, name: String): ActorRef = {
implicit val timeout = settings.CreationTimeout
private[akka] def systemActorOf(props: Props, name: String): ActorRef =
(systemGuardian ? CreateChild(props, name)).get match { (systemGuardian ? CreateChild(props, name)).get match {
case ref: ActorRef ref case ref: ActorRef ref
case ex: Exception throw ex case ex: Exception throw ex
} }
}
def actorOf(props: Props, name: String): ActorRef = def actorOf(props: Props, name: String): ActorRef = {
implicit val timeout = settings.CreationTimeout
(guardian ? CreateChild(props, name)).get match { (guardian ? CreateChild(props, name)).get match {
case ref: ActorRef ref case ref: ActorRef ref
case ex: Exception throw ex case ex: Exception throw ex
} }
}
import settings._ import settings._
@ -398,7 +401,7 @@ class ActorSystemImpl(val name: String, applicationConfig: Config) extends Actor
* Create the scheduler service. This one needs one special behavior: if * Create the scheduler service. This one needs one special behavior: if
* Closeable, it MUST execute all outstanding tasks upon .close() in order * Closeable, it MUST execute all outstanding tasks upon .close() in order
* to properly shutdown all dispatchers. * to properly shutdown all dispatchers.
* *
* Furthermore, this timer service MUST throw IllegalStateException if it * Furthermore, this timer service MUST throw IllegalStateException if it
* cannot schedule a task. Once scheduled, the task MUST be executed. If * cannot schedule a task. Once scheduled, the task MUST be executed. If
* executed upon close(), the task may execute before its timeout. * executed upon close(), the task may execute before its timeout.

View file

@ -14,15 +14,15 @@ package akka.actor
import akka.util.Duration import akka.util.Duration
/** /**
* An Akka scheduler service. This one needs one special behavior: if * An Akka scheduler service. This one needs one special behavior: if
* Closeable, it MUST execute all outstanding tasks upon .close() in order * Closeable, it MUST execute all outstanding tasks upon .close() in order
* to properly shutdown all dispatchers. * to properly shutdown all dispatchers.
* *
* Furthermore, this timer service MUST throw IllegalStateException if it * Furthermore, this timer service MUST throw IllegalStateException if it
* cannot schedule a task. Once scheduled, the task MUST be executed. If * cannot schedule a task. Once scheduled, the task MUST be executed. If
* executed upon close(), the task may execute before its timeout. * executed upon close(), the task may execute before its timeout.
*/ */
trait Scheduler { trait Scheduler {
/** /**
* Schedules a message to be sent repeatedly with an initial delay and frequency. * Schedules a message to be sent repeatedly with an initial delay and frequency.