akka/akka — pull request #1742 by krasserm (2013-09-18 12:55:50+00:00)
Title: !per #3618 Cleanup duplication of life cycle hooks in Processor

`Processor` currently defines the life cycle hooks, `preStartProcessor`, `preRestartProcessor` etc. which duplicates the Actor life cycle hooks `preStart`, `preRestart` and so on. These have been introduced to establish a symmetry to `receive` and `aroundReceive` on `Actor`:

For example, a processor's `aroundReceive` is called with a wrapped message, such as `Written(msg)` or `Replayed(msg)`. Method `aroundReceive` unwraps the message and calls `receive` with the unwrapped `msg`. In case of an exception, `preRestart` is called again with the wrapped message. Method `preRestart` unwraps the message and calls `preRestartProcessor` with the unwrapped `msg`.

A more general solution (implemented by this PR) is to define life cycle interceptors on `Actor` directly: `aroundPreStart`, `aroundPreRestart` … that delegate to the standard hooks `preStart`, `preRestart` etc. This allows interceptors, such as `Processor`, to unwrap messages before delegating to the standard `Actor` life cycle hooks and users don't have to deal with proprietary life cycle methods. These around-hooks also fix a missing symmetry to `aroundReceive`.

Commit message details:

- 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, ...)