format with new Scalariform version

* and fix mima issue
This commit is contained in:
Patrik Nordwall 2016-06-03 11:59:00 +02:00
parent 839ec5f167
commit 3465a221f0
24 changed files with 114 additions and 91 deletions

View file

@ -139,8 +139,8 @@ class Serialization(val system: ExtendedActorSystem) extends Extension {
else { else {
val cache = manifestCache.get val cache = manifestCache.get
cache.get(manifest) match { cache.get(manifest) match {
case Some(cachedClassManifest) => s1.fromBinary(bytes, cachedClassManifest) case Some(cachedClassManifest) s1.fromBinary(bytes, cachedClassManifest)
case None => case None
system.dynamicAccess.getClassFor[AnyRef](manifest) match { system.dynamicAccess.getClassFor[AnyRef](manifest) match {
case Success(classManifest) case Success(classManifest)
val classManifestOption: Option[Class[_]] = Some(classManifest) val classManifestOption: Option[Class[_]] = Some(classManifest)
@ -167,7 +167,7 @@ class Serialization(val system: ExtendedActorSystem) extends Extension {
"akka.actor.serializers is not in synch between the two systems.") "akka.actor.serializers is not in synch between the two systems.")
} }
serializer match { serializer match {
case ser: ByteBufferSerializer => case ser: ByteBufferSerializer
ser.fromBinary(buf, manifest) ser.fromBinary(buf, manifest)
case _ case _
val bytes = Array.ofDim[Byte](buf.remaining()) val bytes = Array.ofDim[Byte](buf.remaining())

View file

@ -46,7 +46,8 @@ class CodecBenchmark {
remote.artery.hostname = localhost remote.artery.hostname = localhost
remote.artery.port = 0 remote.artery.port = 0
} }
""") """
)
implicit val system = ActorSystem("CodecBenchmark", config) implicit val system = ActorSystem("CodecBenchmark", config)
val systemB = ActorSystem("systemB", system.settings.config) val systemB = ActorSystem("systemB", system.settings.config)
@ -56,8 +57,10 @@ class CodecBenchmark {
val headerIn = HeaderBuilder(compression) val headerIn = HeaderBuilder(compression)
val envelopeTemplateBuffer = ByteBuffer.allocate(ArteryTransport.MaximumFrameSize).order(ByteOrder.LITTLE_ENDIAN) val envelopeTemplateBuffer = ByteBuffer.allocate(ArteryTransport.MaximumFrameSize).order(ByteOrder.LITTLE_ENDIAN)
val uniqueLocalAddress = UniqueAddress(system.asInstanceOf[ExtendedActorSystem].provider.getDefaultAddress, val uniqueLocalAddress = UniqueAddress(
AddressUidExtension(system).addressUid) system.asInstanceOf[ExtendedActorSystem].provider.getDefaultAddress,
AddressUidExtension(system).addressUid
)
val payload = Array.ofDim[Byte](1000) val payload = Array.ofDim[Byte](1000)
private var materializer: ActorMaterializer = _ private var materializer: ActorMaterializer = _

View file

@ -65,11 +65,13 @@ abstract class QuickRestartSpec
runOn(second) { runOn(second) {
restartingSystem = restartingSystem =
if (restartingSystem == null) if (restartingSystem == null)
ActorSystem(system.name, ActorSystem(
system.name,
ConfigFactory.parseString(s"akka.cluster.roles = [round-$n]") ConfigFactory.parseString(s"akka.cluster.roles = [round-$n]")
.withFallback(system.settings.config)) .withFallback(system.settings.config))
else else
ActorSystem(system.name, ActorSystem(
system.name,
ConfigFactory.parseString(s""" ConfigFactory.parseString(s"""
akka.cluster.roles = [round-$n] akka.cluster.roles = [round-$n]
akka.remote.netty.tcp.port = ${Cluster(restartingSystem).selfAddress.port.get}""") // same port akka.remote.netty.tcp.port = ${Cluster(restartingSystem).selfAddress.port.get}""") // same port

View file

@ -195,11 +195,11 @@ object MultiNodeSpec {
require(selfIndex >= 0 && selfIndex < maxNodes, "multinode.index is out of bounds: " + selfIndex) require(selfIndex >= 0 && selfIndex < maxNodes, "multinode.index is out of bounds: " + selfIndex)
private[testkit] val nodeConfig = mapToConfig(Map( private[testkit] val nodeConfig = mapToConfig(Map(
"akka.actor.provider" -> "akka.remote.RemoteActorRefProvider", "akka.actor.provider" "akka.remote.RemoteActorRefProvider",
"akka.remote.artery.hostname" -> selfName, "akka.remote.artery.hostname" selfName,
"akka.remote.netty.tcp.hostname" -> selfName, "akka.remote.netty.tcp.hostname" selfName,
"akka.remote.netty.tcp.port" -> selfPort, "akka.remote.netty.tcp.port" selfPort,
"akka.remote.artery.port" -> selfPort)) "akka.remote.artery.port" selfPort))
private[testkit] val baseConfig: Config = ConfigFactory.parseString(""" private[testkit] val baseConfig: Config = ConfigFactory.parseString("""
akka { akka {

View file

@ -34,7 +34,7 @@ object HandshakeRestartReceiverSpec extends MultiNodeConfig {
class Subject extends Actor { class Subject extends Actor {
def receive = { def receive = {
case "shutdown" context.system.terminate() case "shutdown" context.system.terminate()
case "identify" sender() ! (AddressUidExtension(context.system).addressUid -> self) case "identify" sender() ! (AddressUidExtension(context.system).addressUid self)
} }
} }

View file

@ -240,7 +240,8 @@ abstract class MaxThroughputSpec
val senders = for (n 1 to senderReceiverPairs) yield { val senders = for (n 1 to senderReceiverPairs) yield {
val receiver = identifyReceiver(receiverName + n) val receiver = identifyReceiver(receiverName + n)
val plotProbe = TestProbe() val plotProbe = TestProbe()
val snd = system.actorOf(senderProps(receiver, testSettings, plotProbe.ref), val snd = system.actorOf(
senderProps(receiver, testSettings, plotProbe.ref),
testName + "-snd" + n) testName + "-snd" + n)
val terminationProbe = TestProbe() val terminationProbe = TestProbe()
terminationProbe.watch(snd) terminationProbe.watch(snd)

View file

@ -6,7 +6,7 @@ package akka.remote.artery
final case class PlotResult(values: Vector[(String, Number)] = Vector.empty) { final case class PlotResult(values: Vector[(String, Number)] = Vector.empty) {
def add(key: String, value: Number): PlotResult = def add(key: String, value: Number): PlotResult =
copy(values = values :+ (key -> value)) copy(values = values :+ (key value))
def addAll(p: PlotResult): PlotResult = def addAll(p: PlotResult): PlotResult =
copy(values ++ p.values) copy(values ++ p.values)

View file

@ -48,7 +48,7 @@ object RemoteRestartedQuarantinedSpec extends MultiNodeConfig {
class Subject extends Actor { class Subject extends Actor {
def receive = { def receive = {
case "shutdown" context.system.terminate() case "shutdown" context.system.terminate()
case "identify" sender() ! (AddressUidExtension(context.system).addressUid -> self) case "identify" sender() ! (AddressUidExtension(context.system).addressUid self)
} }
} }

View file

@ -6,7 +6,8 @@ package akka.remote.artery
import java.util.concurrent.TimeUnit.SECONDS import java.util.concurrent.TimeUnit.SECONDS
import java.util.concurrent.Executors import java.util.concurrent.Executors
class TestRateReporter(name: String) extends RateReporter(SECONDS.toNanos(1), class TestRateReporter(name: String) extends RateReporter(
SECONDS.toNanos(1),
new RateReporter.Reporter { new RateReporter.Reporter {
override def onReport(messagesPerSec: Double, bytesPerSec: Double, totalMessages: Long, totalBytes: Long): Unit = { override def onReport(messagesPerSec: Double, bytesPerSec: Double, totalMessages: Long, totalBytes: Long): Unit = {
println(name + println(name +

View file

@ -239,7 +239,8 @@ private[remote] class ArteryTransport(_system: ExtendedActorSystem, _provider: R
private val systemMessageResendInterval: FiniteDuration = 1.second private val systemMessageResendInterval: FiniteDuration = 1.second
private val handshakeRetryInterval: FiniteDuration = 1.second private val handshakeRetryInterval: FiniteDuration = 1.second
private val handshakeTimeout: FiniteDuration = private val handshakeTimeout: FiniteDuration =
system.settings.config.getMillisDuration("akka.remote.handshake-timeout").requiring(_ > Duration.Zero, system.settings.config.getMillisDuration("akka.remote.handshake-timeout").requiring(
_ > Duration.Zero,
"handshake-timeout must be > 0") "handshake-timeout must be > 0")
private val injectHandshakeInterval: FiniteDuration = 1.second private val injectHandshakeInterval: FiniteDuration = 1.second
private val giveUpSendAfter: FiniteDuration = 60.seconds private val giveUpSendAfter: FiniteDuration = 60.seconds

View file

@ -103,7 +103,8 @@ private[akka] class Association(
Unsafe.instance.getObjectVolatile(this, AbstractAssociation.sharedStateOffset).asInstanceOf[AssociationState] Unsafe.instance.getObjectVolatile(this, AbstractAssociation.sharedStateOffset).asInstanceOf[AssociationState]
def completeHandshake(peer: UniqueAddress): Unit = { def completeHandshake(peer: UniqueAddress): Unit = {
require(remoteAddress == peer.address, require(
remoteAddress == peer.address,
s"wrong remote address in completeHandshake, got ${peer.address}, expected ${remoteAddress}") s"wrong remote address in completeHandshake, got ${peer.address}, expected ${remoteAddress}")
val current = associationState val current = associationState
current.uniqueRemoteAddressPromise.trySuccess(peer) current.uniqueRemoteAddressPromise.trySuccess(peer)
@ -114,7 +115,8 @@ private[akka] class Association(
if (swapState(current, newState)) { if (swapState(current, newState)) {
current.uniqueRemoteAddressValue() match { current.uniqueRemoteAddressValue() match {
case Some(Success(old)) case Some(Success(old))
log.debug("Incarnation {} of association to [{}] with new UID [{}] (old UID [{}])", log.debug(
"Incarnation {} of association to [{}] with new UID [{}] (old UID [{}])",
newState.incarnation, peer.address, peer.uid, old.uid) newState.incarnation, peer.address, peer.uid, old.uid)
case _ case _
// Failed, nothing to do // Failed, nothing to do
@ -190,7 +192,8 @@ private[akka] class Association(
val newState = current.newQuarantined() val newState = current.newQuarantined()
if (swapState(current, newState)) { if (swapState(current, newState)) {
// quarantine state change was performed // quarantine state change was performed
log.warning("Association to [{}] with UID [{}] is irrecoverably failed. Quarantining address. {}", log.warning(
"Association to [{}] with UID [{}] is irrecoverably failed. Quarantining address. {}",
remoteAddress, u, reason) remoteAddress, u, reason)
// end delivery of system messages to that incarnation after this point // end delivery of system messages to that incarnation after this point
send(ClearSystemMessageDelivery, None, dummyRecipient) send(ClearSystemMessageDelivery, None, dummyRecipient)
@ -200,10 +203,12 @@ private[akka] class Association(
quarantine(reason, uid) // recursive quarantine(reason, uid) // recursive
} }
case Some(Success(peer)) case Some(Success(peer))
log.debug("Quarantine of [{}] ignored due to non-matching UID, quarantine requested for [{}] but current is [{}]. {}", log.debug(
"Quarantine of [{}] ignored due to non-matching UID, quarantine requested for [{}] but current is [{}]. {}",
remoteAddress, u, peer.uid, reason) remoteAddress, u, peer.uid, reason)
case None case None
log.debug("Quarantine of [{}] ignored because handshake not completed, quarantine request was for old incarnation. {}", log.debug(
"Quarantine of [{}] ignored because handshake not completed, quarantine request was for old incarnation. {}",
remoteAddress, reason) remoteAddress, reason)
} }
case None case None

View file

@ -172,7 +172,8 @@ class Decoder(
push(out, decoded) push(out, decoded)
} catch { } catch {
case NonFatal(e) case NonFatal(e)
log.warning("Failed to deserialize message with serializer id [{}] and manifest [{}]. {}", log.warning(
"Failed to deserialize message with serializer id [{}] and manifest [{}]. {}",
headerBuilder.serializer, headerBuilder.manifest, e.getMessage) headerBuilder.serializer, headerBuilder.manifest, e.getMessage)
pull(in) pull(in)
} finally { } finally {

View file

@ -198,12 +198,14 @@ private[akka] class InboundHandshake(inboundContext: InboundContext, inControlSt
push(out, env) push(out, env)
else { else {
// FIXME remove, only debug // FIXME remove, only debug
log.warning(s"Dropping message [{}] from unknown system with UID [{}]. " + log.warning(
s"Dropping message [{}] from unknown system with UID [{}]. " +
"This system with UID [{}] was probably restarted. " + "This system with UID [{}] was probably restarted. " +
"Messages will be accepted when new handshake has been completed.", "Messages will be accepted when new handshake has been completed.",
env.message.getClass.getName, inboundContext.localAddress.uid, env.originUid) env.message.getClass.getName, inboundContext.localAddress.uid, env.originUid)
if (log.isDebugEnabled) if (log.isDebugEnabled)
log.debug(s"Dropping message [{}] from unknown system with UID [{}]. " + log.debug(
s"Dropping message [{}] from unknown system with UID [{}]. " +
"This system with UID [{}] was probably restarted. " + "This system with UID [{}] was probably restarted. " +
"Messages will be accepted when new handshake has been completed.", "Messages will be accepted when new handshake has been completed.",
env.message.getClass.getName, inboundContext.localAddress.uid, env.originUid) env.message.getClass.getName, inboundContext.localAddress.uid, env.originUid)

View file

@ -33,7 +33,8 @@ private[akka] class InboundQuarantineCheck(inboundContext: InboundContext) exten
push(out, env) push(out, env)
case association case association
if (association.associationState.isQuarantined(env.originUid)) { if (association.associationState.isQuarantined(env.originUid)) {
inboundContext.sendControl(association.remoteAddress, inboundContext.sendControl(
association.remoteAddress,
Quarantined(inboundContext.localAddress, UniqueAddress(association.remoteAddress, env.originUid))) Quarantined(inboundContext.localAddress, UniqueAddress(association.remoteAddress, env.originUid)))
pull(in) pull(in)
} else } else

View file

@ -27,7 +27,8 @@ private[akka] class MessageDispatcher(
private val remoteDaemon = provider.remoteDaemon private val remoteDaemon = provider.remoteDaemon
private val log = Logging(system, getClass.getName) private val log = Logging(system, getClass.getName)
def dispatch(recipient: InternalActorRef, def dispatch(
recipient: InternalActorRef,
recipientAddress: Address, recipientAddress: Address,
message: AnyRef, message: AnyRef,
senderOption: Option[ActorRef]): Unit = { senderOption: Option[ActorRef]): Unit = {
@ -54,7 +55,8 @@ private[akka] class MessageDispatcher(
case sel: ActorSelectionMessage case sel: ActorSelectionMessage
if (UntrustedMode && (!TrustedSelectionPaths.contains(sel.elements.mkString("/", "/", "")) || if (UntrustedMode && (!TrustedSelectionPaths.contains(sel.elements.mkString("/", "/", "")) ||
sel.msg.isInstanceOf[PossiblyHarmful] || l != provider.rootGuardian)) sel.msg.isInstanceOf[PossiblyHarmful] || l != provider.rootGuardian))
log.debug("operating in UntrustedMode, dropping inbound actor selection to [{}], " + log.debug(
"operating in UntrustedMode, dropping inbound actor selection to [{}], " +
"allow it by adding the path to 'akka.remote.trusted-selection-paths' configuration", "allow it by adding the path to 'akka.remote.trusted-selection-paths' configuration",
sel.elements.mkString("/", "/", "")) sel.elements.mkString("/", "/", ""))
else else
@ -72,10 +74,12 @@ private[akka] class MessageDispatcher(
// if it was originally addressed to us but is in fact remote from our point of view (i.e. remote-deployed) // if it was originally addressed to us but is in fact remote from our point of view (i.e. remote-deployed)
r.!(message)(sender) r.!(message)(sender)
else else
log.error("dropping message [{}] for non-local recipient [{}] arriving at [{}] inbound addresses are [{}]", log.error(
"dropping message [{}] for non-local recipient [{}] arriving at [{}] inbound addresses are [{}]",
message.getClass, r, recipientAddress, provider.transport.addresses.mkString(", ")) message.getClass, r, recipientAddress, provider.transport.addresses.mkString(", "))
case r log.error("dropping message [{}] for unknown recipient [{}] arriving at [{}] inbound addresses are [{}]", case r log.error(
"dropping message [{}] for unknown recipient [{}] arriving at [{}] inbound addresses are [{}]",
message.getClass, r, recipientAddress, provider.transport.addresses.mkString(", ")) message.getClass, r, recipientAddress, provider.transport.addresses.mkString(", "))
} }

View file

@ -9,19 +9,19 @@ class EnvelopeBufferSpec extends AkkaSpec {
object TestCompressor extends LiteralCompressionTable { object TestCompressor extends LiteralCompressionTable {
val refToIdx = Map( val refToIdx = Map(
"compressable0" -> 0, "compressable0" 0,
"compressable1" -> 1, "compressable1" 1,
"reallylongcompressablestring" -> 2) "reallylongcompressablestring" 2)
val idxToRef = refToIdx.map(_.swap) val idxToRef = refToIdx.map(_.swap)
val serializerToIdx = Map( val serializerToIdx = Map(
"serializer0" -> 0, "serializer0" 0,
"serializer1" -> 1) "serializer1" 1)
val idxToSer = serializerToIdx.map(_.swap) val idxToSer = serializerToIdx.map(_.swap)
val manifestToIdx = Map( val manifestToIdx = Map(
"manifest0" -> 0, "manifest0" 0,
"manifest1" -> 1) "manifest1" 1)
val idxToManifest = manifestToIdx.map(_.swap) val idxToManifest = manifestToIdx.map(_.swap)
override def compressActorRef(ref: String): Int = refToIdx.getOrElse(ref, -1) override def compressActorRef(ref: String): Int = refToIdx.getOrElse(ref, -1)

View file

@ -747,9 +747,6 @@ object MiMa extends AutoPlugin {
ProblemFilters.exclude[ReversedMissingMethodProblem]("akka.http.scaladsl.DefaultSSLContextCreation.validateAndWarnAboutLooseSettings") ProblemFilters.exclude[ReversedMissingMethodProblem]("akka.http.scaladsl.DefaultSSLContextCreation.validateAndWarnAboutLooseSettings")
), ),
"2.4.4" -> Seq( "2.4.4" -> Seq(
// Remove useUntrustedMode which is an internal API and not used anywhere anymore
ProblemFilters.exclude[DirectMissingMethodProblem]("akka.remote.Remoting.useUntrustedMode"),
ProblemFilters.exclude[DirectMissingMethodProblem]("akka.remote.RemoteTransport.useUntrustedMode"),
// #20080, #20081 remove race condition on HTTP client // #20080, #20081 remove race condition on HTTP client
ProblemFilters.exclude[DirectMissingMethodProblem]("akka.http.scaladsl.Http#HostConnectionPool.gatewayFuture"), ProblemFilters.exclude[DirectMissingMethodProblem]("akka.http.scaladsl.Http#HostConnectionPool.gatewayFuture"),
@ -851,6 +848,11 @@ object MiMa extends AutoPlugin {
ProblemFilters.exclude[IncompatibleResultTypeProblem]("akka.cluster.client.ClusterClient.initialContactsSel") ProblemFilters.exclude[IncompatibleResultTypeProblem]("akka.cluster.client.ClusterClient.initialContactsSel")
), ),
"2.4.6" -> Seq( "2.4.6" -> Seq(
// Remove useUntrustedMode which is an internal API and not used anywhere anymore
ProblemFilters.exclude[DirectMissingMethodProblem]("akka.remote.Remoting.useUntrustedMode"),
ProblemFilters.exclude[DirectMissingMethodProblem]("akka.remote.RemoteTransport.useUntrustedMode"),
// internal api // internal api
FilterAnyProblemStartingWith("akka.stream.impl"), FilterAnyProblemStartingWith("akka.stream.impl"),