!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

@ -65,19 +65,19 @@ public class PersistenceDocTest {
abstract class MyProcessor1 extends UntypedProcessor {
//#recover-on-start-disabled
@Override
public void preStartProcessor() {}
public void preStart() {}
//#recover-on-start-disabled
//#recover-on-restart-disabled
@Override
public void preRestartProcessor(Throwable reason, Option<Object> message) {}
public void preRestart(Throwable reason, Option<Object> message) {}
//#recover-on-restart-disabled
}
abstract class MyProcessor2 extends UntypedProcessor {
//#recover-on-start-custom
@Override
public void preStartProcessor() {
public void preStart() {
getSelf().tell(Recover.create(457L), null);
}
//#recover-on-start-custom
@ -86,11 +86,11 @@ public class PersistenceDocTest {
abstract class MyProcessor3 extends UntypedProcessor {
//#deletion
@Override
public void preRestartProcessor(Throwable reason, Option<Object> message) throws Exception {
public void preRestart(Throwable reason, Option<Object> message) {
if (message.isDefined() && message.get() instanceof Persistent) {
delete((Persistent) message.get());
}
super.preRestartProcessor(reason, message);
super.preRestart(reason, message);
}
//#deletion
}