fixed bug in timeout handling that caused tests to fail

This commit is contained in:
Jonas Bonér 2010-07-01 23:56:08 +02:00
parent 4e80e2fc7f
commit bb36faf6c7
2 changed files with 3 additions and 2 deletions

View file

@ -464,7 +464,8 @@ trait Actor extends Logging {
}
private[akka] def checkReceiveTimeout = {
if (self.isDefinedAt(ReceiveTimeout)) {
//if ((self.hotswap getOrElse receive).isDefinedAt(ReceiveTimeout)) { // FIXME use when 'self' is safe to use, throws NPE sometimes
if ((receive ne null) && receive.isDefinedAt(ReceiveTimeout)) {
log.debug("Scheduling timeout for Actor [" + toString + "]")
timeoutActor = Some(Scheduler.scheduleOnce(self, ReceiveTimeout, self.receiveTimeout, TimeUnit.MILLISECONDS))
}

View file

@ -63,6 +63,6 @@ class ReceiveTimeoutSpec extends JUnitSuite {
timeoutActor ! Tick
// timeout already after 500 ms, so 1 second wait should be enough
assert(timeoutLatch.tryAwait(1, TimeUnit.SECONDS) == false)
assert(timeoutLatch.tryAwait(3, TimeUnit.SECONDS) == false)
}
}