Merged wip-2.0 branch with latest master

This commit is contained in:
Jonas Bonér 2011-05-16 12:32:00 +02:00
commit 2655d44ee9
207 changed files with 6049 additions and 4773 deletions

View file

@ -41,7 +41,7 @@ import java.util.concurrent.atomic.{AtomicReference, AtomicBoolean}
import java.util.concurrent._
import akka.AkkaException
class RemoteClientMessageBufferException(message: String) extends AkkaException(message)
class RemoteClientMessageBufferException(message: String, cause: Throwable = null) extends AkkaException(message, cause)
object RemoteEncoder {
def encode(rmp: RemoteMessageProtocol): AkkaRemoteProtocol = {
@ -107,7 +107,7 @@ trait NettyRemoteClientModule extends RemoteClientModule { self: ListenerManagem
def shutdownClientConnection(address: InetSocketAddress): Boolean = lock withWriteGuard {
remoteClients.remove(Address(address)) match {
case s: Some[RemoteClient] => s.get.shutdown
case s: Some[RemoteClient] => s.get.shutdown()
case None => false
}
}
@ -122,15 +122,15 @@ trait NettyRemoteClientModule extends RemoteClientModule { self: ListenerManagem
/**
* Clean-up all open connections.
*/
def shutdownClientModule = {
shutdownRemoteClients
def shutdownClientModule() {
shutdownRemoteClients()
//TODO: Should we empty our remoteActors too?
//remoteActors.clear
}
def shutdownRemoteClients = lock withWriteGuard {
remoteClients.foreach({ case (addr, client) => client.shutdown })
remoteClients.clear
def shutdownRemoteClients() = lock withWriteGuard {
remoteClients.foreach({ case (addr, client) => client.shutdown() })
remoteClients.clear()
}
}
@ -167,7 +167,7 @@ abstract class RemoteClient private[akka] (
def connect(reconnectIfAlreadyConnected: Boolean = false): Boolean
def shutdown: Boolean
def shutdown(): Boolean
/**
* Returns an array with the current pending messages not yet delivered.
@ -372,16 +372,16 @@ class ActiveRemoteClient private[akka] (
}
//Please note that this method does _not_ remove the ARC from the NettyRemoteClientModule's map of clients
def shutdown = runSwitch switchOff {
def shutdown() = runSwitch switchOff {
notifyListeners(RemoteClientShutdown(module, remoteAddress))
timer.stop()
timer = null
openChannels.close.awaitUninterruptibly
openChannels = null
bootstrap.releaseExternalResources
bootstrap.releaseExternalResources()
bootstrap = null
connection = null
pendingRequests.clear
pendingRequests.clear()
}
private[akka] def isWithinReconnectionTimeWindow: Boolean = {
@ -571,7 +571,7 @@ class NettyRemoteServer(serverModule: NettyRemoteServerModule, val host: String,
openChannels.add(bootstrap.bind(address))
serverModule.notifyListeners(RemoteServerStarted(serverModule))
def shutdown {
def shutdown() {
try {
val shutdownSignal = {
val b = RemoteControlProtocol.newBuilder
@ -583,7 +583,7 @@ class NettyRemoteServer(serverModule: NettyRemoteServerModule, val host: String,
openChannels.write(RemoteEncoder.encode(shutdownSignal)).awaitUninterruptibly
openChannels.disconnect
openChannels.close.awaitUninterruptibly
bootstrap.releaseExternalResources
bootstrap.releaseExternalResources()
serverModule.notifyListeners(RemoteServerShutdown(serverModule))
} catch {
case e: Exception =>
@ -626,11 +626,11 @@ trait NettyRemoteServerModule extends RemoteServerModule { self: RemoteModule =>
this
}
def shutdownServerModule = guard withGuard {
def shutdownServerModule() = guard withGuard {
_isRunning switchOff {
currentServer.getAndSet(None) foreach {
instance =>
instance.shutdown
instance.shutdown()
}
}
}