This improves the remote watching mechanism as follows: Watch requests
are intercepted by the RemoteWatcher and not sent on the wire,
excepted watches from the remoteWatcher itself.
RemoteWatcher is then in charge of forwarding DeathWatchNotification
messages to the watchers.
This reduces the number of watch message to one per watchee, even if
there are several watcher on the same watchee (instead of n+1 before).
Reversed watch messages, and watch on ref with undefinedUid are excluded from
interception by the RemoteWatcher and so are handled as before this commit.
In addition, the following changes are made:
- Keep watchers in a map watchee -> watchers for more efficient retrieval
(in a scala Multimap)
- Keep watchees in a map address -> watchee for more efficient retrieval
(in a scala Multimap)
- Use of InternalActorRef more thoroughly to avoid casts
- Rewatch use a standard watch message, as the distinction is longer needed
(cherry picked from commit 89af8bdb90)
* remove final identifier in serializers
i* revert/deprecate ProtobufSerializer.ARRAY_OF_BYTE_ARRAY
* adding back compatible empty constructor in serializers
* make FSM.State compatible
* add back ActorPath.ElementRegex
* revert SocketOption changes and add SocketOptionV2
see a6d3704ef6
* problem filter for ActorSystem and ActorPath
* problem filter for ByteString
* problem filter for deprecated Timeout methods
* BalancingPool companion
* ask
* problem filter for ActorDSL
* event bus
* exclude hasSubscriptions
* exclude some problems in testkit
* boundAddress and addressFromSocketAddress
* Pool nrOfInstances
* PromiseActorRef
* check with 2.3.9
* migration guide note
* explicit exclude of final class problems
* sysmsg.Terminate, sysmsg.DeathWatchNotification, io.Tcp.Closed
were needed to silence normal usage of http client/server
* other things based on jenkins logs, but not a complete audit
(cherry picked from commit 270e3b2f49af3c34fd5ea4c3bcfd8257402b5cbe)
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
This is an API breaking change if someone implemented their own Routers.
The change is required because the router must know if the local routees
should be started or not so it has to check the roles of the cluster
member (the local one). We could delay this decision of starting local
routees, but that would allow messages to be dead-letter-ed (bad).
This can be used to traverse NATs with the following configuration:
akka.remote.netty.tcp {
...
hostname = my-external-address.lt
bind-hostname = 192.168.1.100
}
Use Akka BoundAddressesExtension to get bound addresses
+ Props creation with nulls does not fail any longer
+ null values are now serialised properly and can be used in remote
deployments too
+ added tests for Reflect.findConstructor
> does not change wire protocol, so that's open for discussion (if we
> want it to be more like SerialisedMessage or not)
Resolves#13946
* occurs on failed RemoteActorRef initialization
* fixed shutting down Netty when startup fails
* fixed registering ActorSystem's termination hook before ActorRefProvider
initialization
* added new test case (checking if no threads left after a failed actor
system initialization)
* Replace stash with internal bufferi, j.u.LinkedList
* Replace FSM with become
* Adaptive backoff, important to backoff, but not for too long,
depends on environment and use case
* Prioritize heartbeat messages from remote watcher and cluster
failure detector
* Use payload messages as heartbeats for transport failure detector,
change transport failure detector to be based on absolute timeout,
see ticket #13989 and #13742
* Log remote disassociate from transport failure detector,
see ticket #13985
* Add benchmark sample in akka-sample-remote-scala
* unsubscribe in eventStream is too slow when using many actors
that are watching remote actors, and becomes a problem for example
when shutting down such a system
* Previous eventStream solution:
Stopping 20000 actors took 50355 ms
* This solution:
Stopping 20000 actors took 764 ms
* actor name [endpointWriter] is not unique
* The problem was that the test used 100ms until ungate and
that made it possible for the endpointWriter to not be
completely terminated (and removed) before Ungate and
new Send in idle state, which created new endpointWriter
* I could reproduce it with a sleep in EndpointWriter.postStop
* The solution is to start the scheduled Ungate after Terminated
has been received