This is the first step towards more type-safety in Actor interactions,
comprising:
* generic ActorRef[T] that only accepts T messages
* generic ActorSystem[T] extends ActorRef[T] (sending to the guardian,
whose Props[T] are provided for ActorSystem construction)
* removed the Actor trait: everything in there has been made into
messages and signals
* new Behavior[T] abstraction that consumes messages (of type T) or
Signals (lifecycle hooks, Terminated, ReceiveTimeout, Failed),
producing the next Behavior[T] as the result each time
* the ask pattern is provided and yields properly typed Futures
* variants of ActorContext are provided for synchronous testing of
Behaviors
All of this is implemented without touching code outside akka-typed
(apart from making guardianProps configurable), creating wrapper objects
around ActorRef, ActorContext, ActorSystem, Props and providing an Actor
implementation that just runs a Behavior.
Changed the parameter type of targetName in PromiseActorRef#apply and changed so that toString of targetName is called once the value is actually needed, eg in the case of timeout.
The creating of the String used in the AskTimeOutException will then be deferred to when timeouts actually occur rather than before, as it was before this change.
Callsites of PromiseActorRef#apply are changed so that they instead of ActorSel#toString and ActorRef#toString send the ActorSel / ActorRef itself, thus not creating the Strings from toString unless necessary, saving StringBuilders and char[] used in ActorRef#toString and ActorSel#toString
- Moved system messages to their own package.
- All queueing operations are now hidden behind a SystemMessageList value class
- Introduced dual SystemMessageList types to encode the ordering in the type.
- Protects against accidentally missed reverse calls or accidentally reversed lists
- Makes ordering expectations by fields/parameters explicit
- Fixed serialization tests
- Fixes to logging in HierarchyStressSpec
This means tightening types from Duration to FiniteDuration in several
places; a good thing, since we replace runtime complaints by compile
time errors.
the previous patch of including the UID in the Terminated message did
suffer from the system vs. normal message ordering problem, hence I
reverted the previous fix and replaced it by sending a NullMessage after
ChildTerminated, exactly like in the Supervise case.
By only registering a PromiseActorRef on access to `path`
we can shave off about 30% of the overhead involved in the common,
purely local `ask` use case.
Unfortunately `path` is accessed not only for ActorRef serialization
but also during `toString`, `equals` and `hashCode`, so one should
be careful how to handle PromiseActorRefs in hot paths.