!per #3618 Cleanup duplication of life cycle hooks in Processor

- introduce around life cycle hooks for symmetry with aroundReceive
 - no custom processor-specific life cycle hooks needed any more
 - preStart and preRestart can be overridden with empty implementation
    (interceptors ensure that super.preXxx calls are still executed)
 - all around life cycle hooks can be final
 - standard life cycle hooks are non-final to preserve composability with existing traits (FSM, ...)
This commit is contained in:
Martin Krasser 2013-09-15 09:04:05 +02:00
parent d0684c2f7e
commit 6c78629cdb
14 changed files with 97 additions and 120 deletions

View file

@ -44,16 +44,16 @@ trait PersistenceDocSpec {
new AnyRef {
trait MyProcessor1 extends Processor {
//#recover-on-start-disabled
override def preStartProcessor() = ()
override def preStart() = ()
//#recover-on-start-disabled
//#recover-on-restart-disabled
override def preRestartProcessor(reason: Throwable, message: Option[Any]) = ()
override def preRestart(reason: Throwable, message: Option[Any]) = ()
//#recover-on-restart-disabled
}
trait MyProcessor2 extends Processor {
//#recover-on-start-custom
override def preStartProcessor() {
override def preStart() {
self ! Recover(toSequenceNr = 457L)
}
//#recover-on-start-custom
@ -61,12 +61,12 @@ trait PersistenceDocSpec {
trait MyProcessor3 extends Processor {
//#deletion
override def preRestartProcessor(reason: Throwable, message: Option[Any]) {
override def preRestart(reason: Throwable, message: Option[Any]) {
message match {
case Some(p: Persistent) delete(p)
case _
}
super.preRestartProcessor(reason, message)
super.preRestart(reason, message)
}
//#deletion
}