split systemDispatch(Create()) into systemEnqueue(Create()) directly
after createMailbox and registerForExecution from within
Dispatcher.attach() (resp. CallingThreadDispatcher.register() does its
own thing)
- change from messageQueue.numberOfMessages to maintaining an AtomicLong
for performance reasons
- add comments/scaladoc where missing
- remove some assert()s
- fix ResiserSpec to employ buddy-wakeup-threshold
- add new config item "buddy-wakeup-threshold" which defaults to 5
- if BWT>=0, then check mailbox.numberOfMessages in case the target
actor was not scheduled during dispatch and schedule a buddie if that
is found >=BWT (BWT is a getfield)
- if during unregister() there are messages in the queue, schedule a
buddie
This way people can tune which behavior they want, knowing full well
that numberOfMessages is O(n).
Normally the ActorCell would register the actor with the dispatcher
(yeah, I moved it into the logical order, because the other one was
specifically done for BD but does not work out) and then dispatch the
Create() message. This does not work for BD, because then the actor
could potentiall process a message before Create() is enqueued, so
override systemDispatch() to drop Create() and insert that during
register() (which is called from attach()), making sure to achieve the
following order:
- enqueue Create()
- register with dispatcher
- add to buddies
- schedule mailbox
System.identityHashCode is not guaranteed to be consistent with equals()
(cannot be, just imagine more than 2^32 objects); fix it by checking
equals in case 0 would be returned and fall back to a real Comparator in
case that’s needed.
* ActorTimeout (akka.actor.timeout) was used to all sorts of things.
* TestKit default-timeout
* TypedActor timeout for non void methods
* Transactor coordinated-timeout
* ZeroMQ new-socket-timeout
* And in various tests
- assert locking balance when using Unsafe.instance.monitorExit
- add RouterConfig.routerDispatcher
- re-enable “busy” resizer test after switching to BalancingDispatcher
- document resizer asynchronicity and how to configure dispatchers
- initial resize should be done directly
- must not require children unconditionally in Router constructor
- ResizerSpec changed timing due to asynchronous resizing, one test
disabled
- removed pointless volatile write in RouterActorRef
* Wrote a comprehensive example for pub-sub
* Clarified how publish to topic is done
* Several minor, but important, api adjustments for the java api, and some also profit for scala
* Added documentation for Java and updated documentation for Scala
- first, fix quite some data races in RoutedActorRef wrt. the contained
ActorCell’s childrenRef field (which is not even @volatile)
- then notice that there still are double-deregistrations happening in
the dispatcher
- coming finally to the conclusion that the Mailbox should not really
process all system messages in processAllSystemMessages(): we should
really really stop after having closed the mailbox ;-)
- added simple test case which stops self twice to keep this fixed
- PropertyMaster is the only place in Akka which calls
ClassLoader.getClass (apart from kernel, which might be special)
- all PropertyMaster methods (there are only three) take a ClassManifest
of what is to be constructed, and they verify that the obtained object
is actually compatible with the required type
Other stuff:
- noticed that I had forgotten to change to ExtendedActorSystem when
constructing Extensions by ExtensionKey (damn you, reflection!)
- moved Serializer.currentSystem into JavaSerializer, because that’s the
only one needing it (it’s only used in readResolve() methods)
- Serializers are constructed now with one-arg constructor taking
ExtendedActorSystem (if that exists, otherwise no-arg as before), to
allow JavaSerializer to do its magic; possibly necessary for others as
well
- Removed all Option[ClassLoader] signatures
- made it so that the ActorSystem will try context class loader, then
the class loader which loaded the class actually calling into
ActorSystem.apply, then the loader which loaded ActorSystemImpl
- for the second of the above I added a (reflectively accessed hopefully
safe) facility for getting caller Class[_] objects by using
sun.reflect.Reflection; this is optional an defaults to None, e.g. on
Android, which means that getting the caller’s classloader is done on
a best effort basis (there’s nothing we can do because a StackTrace
does not contain actual Class[_] objects).
- refactored DurableMailbox to contain the owner val and use that
instead of declaring that in all subclasses