Modularize configuration. See #1361

* 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
This commit is contained in:
Patrik Nordwall 2011-11-22 13:04:10 +01:00
parent c56341b3a6
commit 179399296e
85 changed files with 1233 additions and 643 deletions

View file

@ -10,15 +10,13 @@ import akka.event.Logging
import akka.util.duration._
import akka.remote.RemoteProtocol._
import akka.remote.RemoteProtocol.RemoteSystemDaemonMessageType._
import java.util.concurrent.atomic.AtomicReference
import java.security.SecureRandom
import System.{ currentTimeMillis newTimestamp }
import scala.collection.immutable.Map
import scala.annotation.tailrec
import com.google.protobuf.ByteString
import akka.serialization.SerializationExtension
/**
* Interface for node membership change listener.
@ -102,12 +100,14 @@ class Gossiper(remote: Remote) {
nodeMembershipChangeListeners: Set[NodeMembershipChangeListener] = Set.empty[NodeMembershipChangeListener])
private val system = remote.system
private val remoteExtension = RemoteExtension(system)
private val serializationExtension = SerializationExtension(system)
private val log = Logging(system, "Gossiper")
private val failureDetector = remote.failureDetector
private val connectionManager = new RemoteConnectionManager(system, remote, Map.empty[RemoteAddress, ActorRef])
private val seeds = Set(address) // FIXME read in list of seeds from config
private val address = system.rootPath.remoteAddress
private val address = system.asInstanceOf[ActorSystemImpl].provider.rootPath.remoteAddress
private val nodeFingerprint = address.##
private val random = SecureRandom.getInstance("SHA1PRNG")
@ -237,7 +237,7 @@ class Gossiper(remote: Remote) {
throw new IllegalStateException("Connection for [" + peer + "] is not set up"))
try {
(connection ? (toRemoteMessage(newGossip), remote.remoteSystemDaemonAckTimeout)).as[Status] match {
(connection ? (toRemoteMessage(newGossip), remoteExtension.settings.RemoteSystemDaemonAckTimeout)).as[Status] match {
case Some(Success(receiver))
log.debug("Gossip sent to [{}] was successfully received", receiver)
@ -299,7 +299,7 @@ class Gossiper(remote: Remote) {
}
private def toRemoteMessage(gossip: Gossip): RemoteProtocol.RemoteSystemDaemonMessageProtocol = {
val gossipAsBytes = system.serialization.serialize(gossip) match {
val gossipAsBytes = serializationExtension.serialization.serialize(gossip) match {
case Left(error) throw error
case Right(bytes) bytes
}