* Split config reference to one for each module/extension.
* Adjusted signature of registerExtension to avoid race of extension init
* Moved Duration.dilated to testkit
* TestKitExtension
* RemoteExtension
* SerializationExtension
* Durable mailboxes extensions
* Fixed broken serialization bindings and added test
* Updated configuration documentation
* System properties akka.remote.hostname akka.remote.port replaced with akka.remote.server.hostname and akka.remote.server.port
* Adjustments of ActorSystem initialization. Still don't like the two-phase constructor/init flow. Very fragile for changes.
Review fixes. SerializationExtension
- ensure that no “complex” things are attached to a LogEvent (think
serialization)
- ensure no escaping the “this” reference via LoggingBus during
constructors (e.g. ActorSystem)
- change it so that
+ Actor/ActorRef are represented by their address
+ Class[_] by simpleName
+ String by itself
- this means that people need to think a little more while deciding how
“this” should look like in logging (which I think is a good thing)
* All default values removed from code and loaded from akka-actor-reference.conf, located in src/main/resources (included in jar)
* Default test configuration included in AkkaSpec instead of using akka.test.conf, avoids problems when running test (in IDE) and forgetting to use -Dakka.mode=test.
* System.properties used first, if availble
* Next step will be to split akka-actor-reference.conf in separate -reference for each module
- create ActorSystemImpl trait to make ActorSystem fully abstract
- add Java API for constructing (ActorSystem.create(...))
- only go through factory methods because .start() has become necessary
- rename all user-facing occurrences of “app” to “system” (Actor trait
and TestKit/AkkaSpec)
- pass ActorSystemImpl to ActorRefs upon creation, which means that
actorOf() and friends need such an argument, which must be provided to
the ActorRefProvider by the ActorRefFactory implementation
(cascading into all dispatchers, mailboxes, other stuff; had to move
deadLetter stuff to ActorSystem again and split its initialization due
to cyclic dependency)
- remove Props.randomName and associated logic
- ActorRefFactory contains AtomicLong which is used to generate unique
children names
- base64-like encoding is used with reverse “digit” order
- disallow given names which are null, empty or start with ‘$’
- random names start have ‘$’ prepended (‘$’ not being one of the 64
characters)
- special marker “$_” for tempPath until “/tmp” supervisor is introduced
- TestActorRef uses globally unique “$$” prefix, as it creates actors
beneath any supervisor as instructed by the user
Calling ActorRef.stop() schedules a Terminate() system message. I
changed the effect of this message by splitting the
systemInvoke.terminate() method into two parts:
- in the old place only cancel receiveTimeout and .stop() all children
plus set 'stopping' flag
- in handleChildTerminated if children are empty while stopping==true
call doTerminate(), which detaches from dispatcher and does all the
usual cleanup
- if no children were there, this happens directly from terminate()
- while 'stopping', process only ChildTerminated() and Terminate(),
ignore Terminated() and dump all the rest to app.deadLetterMailbox
- to make this less convoluted move AutoReceiveMessage handling from
Actor to ActorCell (including become/unbecome), which was all
accessing ActorContext anyway
- teach TestEventListener that DeadLetters with Terminate()/Terminated()
are not that bad
There is no retry of the .stop(), yet, but that can easily be added now
in each Actor which shuts something down: simply watch the target, if no
Terminated() is received retry. It is not 100% reliable, though, if only
the ChildTerminated() was lost, because that will not be regenerated by
the deadLetterMailbox ... need to think about that one.
All tests green on my machine.
- LoggingBus.startDefaultLoggers would not wait for their
initialization, leading to non-reception of Mute messages at the very
start of test, which would in turn fail those test which require a
number of occurrences.
- fix that by having each logger respond to InitializeLogger(bus) as
soon as subscriptions are done (max 3 seconds, else Warning)
- make akka.actor.simpleName not use String.replaceAll (performance
oversight on my part)
- rename MainBusSpec object to EventStreamSpec
- give loggers nicer names: "log<id>-<classname>"
- automatic timeout was previously used for allowing clean shutdown, but
that does not work anymore anyway, must call ActorSystem.stop()
- that will also stop testActor, so no need for special treatment
- the automatic stop caused various eerie problems in different places,
because on Jenkins some sleep periods were longer, leading to such
timeout, which combined with the non-logging of dead letters made it
seem worse than it was
- the same information is transmitted as sender, hence enabling
ChildTerminated to become a singleton
- make lastSender accessible in TestKit (needed now for DeathWatchSpec)
- fix nasty infinite loop when logging at the wrong moment during
shutdown
(since I know now what’s causing these Jenkins failures ;-) )
- include recipient in DeadLetter
- include recipient in calls to enqueue/systemEnqueue
- move DeadLetterMailbox to ActorSystem (saves some space, too)
- hook up DeadLetterMailbox so it sends DeadLetters to app.deadLetters,
which publishes them on the eventStream
- subscribe TestEventListener to DeadLetter and turn it into Warning
The generated warnings about ChildTerminated are very much correct, they
remind us that we still need to fix supervisor.stop() to await all
children’s death before actually committing suicide.
- apply EventFilters so that at least on my machine no expected messages
are printed
- add new test config settings to akka-reference.conf
- set default for loglevel to WARNING
- print out timeout values in case of various timeouts if they occur
- introduce Duration.Undefined and use that to initialize TestKit.end
(also use in places which abused Duration.MinusInf for similar
purposes)
- TestKit.remaining now returns AkkaConfig.SingleExpectDefaultTimeout if
end == Duration.Undefined
This will hopefully catch most of the cases where Jenkins previously
aborted the build after 60min.
BalancingDispatcherModelSpec is currently broken, leaves count==1 in
wavesOfActors test, committed anyway in order to check out where it
broke before this merge
- fix memory visibility issue with occurrences counter
- add non-throwing awaitCond and use that for better error reporting
- move occurrence book-keeping (side-effect) out of PF guard, was
evaluated multiple times (of course!)
- apply in cases where EventFilter.custom was used (one legitimate use
case remains)
- make normal filters available for all four log levels
- allow filtering for
+ exact and complete message
+ start of message
+ regular expression
- keep count of occurrences if requested and verify correct count at end
of filterEvents/filterExceptions block
- remove akka.testkit.Testing (sleepFor replaced by Duration.dilated.sleep)
- remove Duration.timeFactor (needs config -> AkkaApplication)
- TestLatch needs config -> AkkaApplication (was forgotten because used
directly System.getProperty)
- lots of scaladoc for TestEventListener infrastructure
- revise timings to make them more robust (granularity changed in
general from 100ms to 500ms)
- make one test more deterministic by awaiting context.hasMessages,
which has been added for this purpose; is the same kind of “non-racy”
as isShutdown
- add static version of TestKit.awaitCond (checked that it does not
conflict, even when “import TestKit._” is used; seems like imports are
not even searched if the symbol is found locally)
- add scaladoc
- remove (empty) EventHandler.scala
- make BugLogging more of an implementation detail, i.e. use the
Logging() factories to get a Logging implementation.
- introduce common parent for guardian and systemGuardian
- install deathWatch chain to ensure proper shutdown upon guardian’s
death
- re-install stdout logger before detaching default loggers
- await app termination after running AkkaSpec tests (max 5sec, with
warning logged if not stopped)
most tests passing, everything compiling, but docs not updated and nasty
thread-leak preventing me from running the whole test-suite (which is
the reason for this commit: I want to chase down that one first).
- the app.mainbus is classified by Class[_] (currently lookup, will
possibly change to sub-class-aware) and accepts AnyRef messages
- LoggingBus handles akka.event-handlers from config specially:
+ start them as system services, supervised by SystemGuardian
+ keep their subscriptions in sync when logLevel_= is called
+ send them InitializeLogger(bus) message before subscribing them (so
they can register for extras like Mute/UnMute)
- two-phased start-up: first phase with actor-less stdout logging, then
subscription of config loggers, then remove stdout logger (logLevels
configurable separately)
- MainBusReaper watches registered receivers and unsubscribes them upon
death (started in phase 2)
- logger factory on Logging object, needs app/bus and log source;
default instance in app.log