Merge branch 'master' into wip-1141-config-patriknw

This commit is contained in:
Patrik Nordwall 2011-11-18 11:29:56 +01:00
commit c6b157dd3a
4 changed files with 13 additions and 16 deletions

View file

@ -242,7 +242,7 @@ class ActorSystemImpl(val name: String, config: Config) extends ActorSystem {
case Left(e) throw e
case Right(b) b
}
val arguments = List(
val arguments = Seq(
classOf[Settings] -> settings,
classOf[ActorPath] -> rootPath,
classOf[EventStream] -> eventStream,
@ -263,9 +263,6 @@ class ActorSystemImpl(val name: String, config: Config) extends ActorSystem {
def deathWatch: DeathWatch = provider.deathWatch
def nodename: String = provider.nodename
terminationFuture.onComplete(_ scheduler.stop())
terminationFuture.onComplete(_ dispatcher.shutdown())
@volatile
private var _serialization: Serialization = _
def serialization = _serialization
@ -275,8 +272,7 @@ class ActorSystemImpl(val name: String, config: Config) extends ActorSystem {
def /(actorName: String): ActorPath = guardian.path / actorName
def start(): this.type = {
if (_serialization != null) throw new IllegalStateException("cannot initialize ActorSystemImpl twice!")
private lazy val _start: this.type = {
_serialization = new Serialization(this)
_typedActor = new TypedActor(settings, _serialization)
provider.init(this)
@ -286,12 +282,16 @@ class ActorSystemImpl(val name: String, config: Config) extends ActorSystem {
this
}
def start() = _start
def registerOnTermination(code: Unit) { terminationFuture onComplete (_ code) }
def registerOnTermination(code: Runnable) { terminationFuture onComplete (_ code.run) }
// TODO shutdown all that other stuff, whatever that may be
def stop() {
guardian.stop()
terminationFuture onComplete (_ scheduler.stop())
terminationFuture onComplete (_ dispatcher.shutdown())
}
}

View file

@ -31,8 +31,7 @@ class Remote(val system: ActorSystemImpl, val nodename: String) {
val log = Logging(system, this)
import system._
val AC = settings
import AC._
import settings._
// TODO move to settings?
val shouldCompressData = config.getBoolean("akka.remote.use-compression")

View file

@ -13,15 +13,14 @@ import akka.dispatch._
import akka.util.duration._
import akka.config.ConfigurationException
import akka.event.{ DeathWatch, Logging }
import akka.serialization.{ Serialization, Serializer, Compression }
import akka.serialization.Compression.LZF
import akka.remote.RemoteProtocol._
import akka.remote.RemoteProtocol.RemoteSystemDaemonMessageType._
import java.net.InetSocketAddress
import java.util.concurrent.ConcurrentHashMap
import com.google.protobuf.ByteString
import java.util.concurrent.atomic.AtomicBoolean
import akka.event.EventStream
import java.util.concurrent.ConcurrentHashMap
import akka.dispatch.Promise
/**
* Remote ActorRefProvider. Starts up actor on remote node and creates a RemoteActorRef representing it.
@ -36,11 +35,8 @@ class RemoteActorRefProvider(
val scheduler: Scheduler) extends ActorRefProvider {
val log = Logging(eventStream, this)
import java.util.concurrent.ConcurrentHashMap
import akka.dispatch.Promise
val local = new LocalActorRefProvider(settings, rootPath, eventStream, dispatcher, scheduler)
def deathWatch = local.deathWatch
def guardian = local.guardian
def systemGuardian = local.systemGuardian
@ -59,6 +55,7 @@ class RemoteActorRefProvider(
local.init(system)
remote = new Remote(system, nodename)
remoteDaemonConnectionManager = new RemoteConnectionManager(system, remote)
terminationFuture.onComplete(_ remote.server.shutdown())
}
private[akka] def theOneWhoWalksTheBubblesOfSpaceTime: ActorRef = local.theOneWhoWalksTheBubblesOfSpaceTime

View file

@ -351,6 +351,7 @@ class ActiveRemoteClientHandler(
* Provides the implementation of the Netty remote support
*/
class NettyRemoteSupport(_system: ActorSystem) extends RemoteSupport(_system) with RemoteMarshallingOps {
val log = Logging(system, this)
val serverSettings = new RemoteServerSettings(system.settings.config, system.settings.DefaultTimeUnit)
val clientSettings = new RemoteClientSettings(system.settings.config, system.settings.DefaultTimeUnit)
@ -474,8 +475,8 @@ class NettyRemoteSupport(_system: ActorSystem) extends RemoteSupport(_system) wi
remoteClients.clear()
} finally {
clientsLock.writeLock().unlock()
currentServer.getAndSet(None) foreach { _.shutdown() }
}
currentServer.getAndSet(None) foreach { _.shutdown() }
}
}