=all #3448 Newer Scalariform running on more files
This commit is contained in:
parent
b9f91b176b
commit
28b5f1039d
22 changed files with 63 additions and 48 deletions
|
|
@ -131,7 +131,7 @@ class ActorLifeCycleSpec extends AkkaSpec("akka.actor.serialize-messages=off") w
|
||||||
case class Become(recv: ActorContext ⇒ Receive)
|
case class Become(recv: ActorContext ⇒ Receive)
|
||||||
val a = system.actorOf(Props(new Actor {
|
val a = system.actorOf(Props(new Actor {
|
||||||
def receive = {
|
def receive = {
|
||||||
case Become(beh) ⇒ context.become(beh(context), discardOld = false); sender ! "ok"
|
case Become(beh) ⇒ { context.become(beh(context), discardOld = false); sender ! "ok" }
|
||||||
case x ⇒ sender ! 42
|
case x ⇒ sender ! 42
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
|
|
|
||||||
|
|
@ -201,8 +201,13 @@ object FSMTimingSpec {
|
||||||
case Initial -> TestSingleTimerResubmit ⇒ setTimer("blah", Tick, 500.millis.dilated, false)
|
case Initial -> TestSingleTimerResubmit ⇒ setTimer("blah", Tick, 500.millis.dilated, false)
|
||||||
}
|
}
|
||||||
when(TestSingleTimerResubmit) {
|
when(TestSingleTimerResubmit) {
|
||||||
case Event(Tick, _) ⇒ tester ! Tick; setTimer("blah", Tock, 500.millis.dilated, false); stay()
|
case Event(Tick, _) ⇒
|
||||||
case Event(Tock, _) ⇒ tester ! Tock; goto(Initial)
|
tester ! Tick
|
||||||
|
setTimer("blah", Tock, 500.millis.dilated, false)
|
||||||
|
stay()
|
||||||
|
case Event(Tock, _) ⇒
|
||||||
|
tester ! Tock
|
||||||
|
goto(Initial)
|
||||||
}
|
}
|
||||||
when(TestCancelTimer) {
|
when(TestCancelTimer) {
|
||||||
case Event(Tick, _) ⇒
|
case Event(Tick, _) ⇒
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ class DispatcherActorSpec extends AkkaSpec(DispatcherActorSpec.config) with Defa
|
||||||
val slowOne = system.actorOf(
|
val slowOne = system.actorOf(
|
||||||
Props(new Actor {
|
Props(new Actor {
|
||||||
def receive = {
|
def receive = {
|
||||||
case "hogexecutor" ⇒ sender ! "OK"; start.await
|
case "hogexecutor" ⇒ { sender ! "OK"; start.await }
|
||||||
case "ping" ⇒ if (works.get) latch.countDown()
|
case "ping" ⇒ if (works.get) latch.countDown()
|
||||||
}
|
}
|
||||||
}).withDispatcher(throughputDispatcher))
|
}).withDispatcher(throughputDispatcher))
|
||||||
|
|
@ -120,8 +120,8 @@ class DispatcherActorSpec extends AkkaSpec(DispatcherActorSpec.config) with Defa
|
||||||
val slowOne = system.actorOf(
|
val slowOne = system.actorOf(
|
||||||
Props(new Actor {
|
Props(new Actor {
|
||||||
def receive = {
|
def receive = {
|
||||||
case "hogexecutor" ⇒ ready.countDown(); start.await
|
case "hogexecutor" ⇒ { ready.countDown(); start.await }
|
||||||
case "ping" ⇒ works.set(false); context.stop(self)
|
case "ping" ⇒ { works.set(false); context.stop(self) }
|
||||||
}
|
}
|
||||||
}).withDispatcher(throughputDispatcher))
|
}).withDispatcher(throughputDispatcher))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ object EventStreamSpec {
|
||||||
bus.subscribe(context.self, classOf[SetTarget])
|
bus.subscribe(context.self, classOf[SetTarget])
|
||||||
bus.subscribe(context.self, classOf[UnhandledMessage])
|
bus.subscribe(context.self, classOf[UnhandledMessage])
|
||||||
sender ! Logging.LoggerInitialized
|
sender ! Logging.LoggerInitialized
|
||||||
case SetTarget(ref) ⇒ dst = ref; dst ! "OK"
|
case SetTarget(ref) ⇒ { dst = ref; dst ! "OK" }
|
||||||
case e: Logging.LogEvent ⇒ dst ! e
|
case e: Logging.LogEvent ⇒ dst ! e
|
||||||
case u: UnhandledMessage ⇒ dst ! u
|
case u: UnhandledMessage ⇒ dst ! u
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -170,8 +170,8 @@ private[akka] trait FaultHandling { this: ActorCell ⇒
|
||||||
suspendNonRecursive()
|
suspendNonRecursive()
|
||||||
// suspend children
|
// suspend children
|
||||||
val skip: Set[ActorRef] = currentMessage match {
|
val skip: Set[ActorRef] = currentMessage match {
|
||||||
case Envelope(Failed(_, _, _), child) ⇒ setFailed(child); Set(child)
|
case Envelope(Failed(_, _, _), child) ⇒ { setFailed(child); Set(child) }
|
||||||
case _ ⇒ setFailed(self); Set.empty
|
case _ ⇒ { setFailed(self); Set.empty }
|
||||||
}
|
}
|
||||||
suspendChildren(exceptFor = skip ++ childrenNotToSuspend)
|
suspendChildren(exceptFor = skip ++ childrenNotToSuspend)
|
||||||
t match {
|
t match {
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,7 @@ class SslTlsSupport(engine: SSLEngine) extends PipelineStage[HasLogging, Command
|
||||||
// to shutdown the connection when getting CLOSED in encrypt
|
// to shutdown the connection when getting CLOSED in encrypt
|
||||||
closeEngine()
|
closeEngine()
|
||||||
|
|
||||||
case x: Tcp.WriteCommand =>
|
case x: Tcp.WriteCommand ⇒
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"SslTlsSupport doesn't support Tcp.WriteCommands of type " + x.getClass.getSimpleName)
|
"SslTlsSupport doesn't support Tcp.WriteCommands of type " + x.getClass.getSimpleName)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -370,8 +370,8 @@ object Tcp extends ExtensionId[TcpExt] with ExtensionIdProvider {
|
||||||
def next(): SimpleWriteCommand =
|
def next(): SimpleWriteCommand =
|
||||||
current match {
|
current match {
|
||||||
case null ⇒ Iterator.empty.next()
|
case null ⇒ Iterator.empty.next()
|
||||||
case CompoundWrite(h, t) ⇒ current = t; h
|
case CompoundWrite(h, t) ⇒ { current = t; h }
|
||||||
case x: SimpleWriteCommand ⇒ current = null; x
|
case x: SimpleWriteCommand ⇒ { current = null; x }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -50,11 +50,11 @@ private[io] class TcpManager(tcp: TcpExt)
|
||||||
def receive = workerForCommandHandler {
|
def receive = workerForCommandHandler {
|
||||||
case c: Connect ⇒
|
case c: Connect ⇒
|
||||||
val commander = sender // cache because we create a function that will run asyncly
|
val commander = sender // cache because we create a function that will run asyncly
|
||||||
registry ⇒ Props(classOf[TcpOutgoingConnection], tcp, registry, commander, c)
|
(registry ⇒ Props(classOf[TcpOutgoingConnection], tcp, registry, commander, c))
|
||||||
|
|
||||||
case b: Bind ⇒
|
case b: Bind ⇒
|
||||||
val commander = sender // cache because we create a function that will run asyncly
|
val commander = sender // cache because we create a function that will run asyncly
|
||||||
registry ⇒ Props(classOf[TcpListener], selectorPool, tcp, registry, commander, b)
|
(registry ⇒ Props(classOf[TcpListener], selectorPool, tcp, registry, commander, b))
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -48,11 +48,11 @@ private[io] class UdpManager(udp: UdpExt) extends SelectionHandler.SelectorBased
|
||||||
def receive = workerForCommandHandler {
|
def receive = workerForCommandHandler {
|
||||||
case b: Bind ⇒
|
case b: Bind ⇒
|
||||||
val commander = sender // cache because we create a function that will run asyncly
|
val commander = sender // cache because we create a function that will run asyncly
|
||||||
registry ⇒ Props(classOf[UdpListener], udp, registry, commander, b)
|
(registry ⇒ Props(classOf[UdpListener], udp, registry, commander, b))
|
||||||
|
|
||||||
case SimpleSender(options) ⇒
|
case SimpleSender(options) ⇒
|
||||||
val commander = sender // cache because we create a function that will run asyncly
|
val commander = sender // cache because we create a function that will run asyncly
|
||||||
registry ⇒ Props(classOf[UdpSender], udp, registry, commander, options)
|
(registry ⇒ Props(classOf[UdpSender], udp, registry, commander, options))
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,11 @@ object DataflowSpec {
|
||||||
|
|
||||||
class TestDelayActor(await: TestLatch) extends Actor {
|
class TestDelayActor(await: TestLatch) extends Actor {
|
||||||
def receive = {
|
def receive = {
|
||||||
case "Hello" ⇒ Await.ready(await, TestLatch.DefaultTimeout); sender ! "World"
|
case "Hello" ⇒
|
||||||
case "NoReply" ⇒ Await.ready(await, TestLatch.DefaultTimeout)
|
Await.ready(await, TestLatch.DefaultTimeout)
|
||||||
|
sender ! "World"
|
||||||
|
case "NoReply" ⇒
|
||||||
|
Await.ready(await, TestLatch.DefaultTimeout)
|
||||||
case "Failure" ⇒
|
case "Failure" ⇒
|
||||||
Await.ready(await, TestLatch.DefaultTimeout)
|
Await.ready(await, TestLatch.DefaultTimeout)
|
||||||
sender ! Status.Failure(new RuntimeException("Expected exception; to test fault-tolerance"))
|
sender ! Status.Failure(new RuntimeException("Expected exception; to test fault-tolerance"))
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,7 @@ class Channel private (_channelId: Option[String]) extends Actor with Stash {
|
||||||
}
|
}
|
||||||
|
|
||||||
private val buffering: Actor.Receive = {
|
private val buffering: Actor.Receive = {
|
||||||
case DeliveredResolved | DeliveredUnresolved ⇒ context.unbecome(); unstashAll() // TODO: optimize
|
case DeliveredResolved | DeliveredUnresolved ⇒ { context.unbecome(); unstashAll() } // TODO: optimize
|
||||||
case _: Deliver ⇒ stash()
|
case _: Deliver ⇒ stash()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -232,9 +232,9 @@ private trait ResolvedDelivery extends Actor {
|
||||||
|
|
||||||
def receive = {
|
def receive = {
|
||||||
case DeliverResolved ⇒ context.actorSelection(path) ! Identify(1)
|
case DeliverResolved ⇒ context.actorSelection(path) ! Identify(1)
|
||||||
case ActorIdentity(1, Some(ref)) ⇒ onResolveSuccess(ref); shutdown(DeliveredResolved)
|
case ActorIdentity(1, Some(ref)) ⇒ { onResolveSuccess(ref); shutdown(DeliveredResolved) }
|
||||||
case ActorIdentity(1, None) ⇒ onResolveFailure(); shutdown(DeliveredUnresolved)
|
case ActorIdentity(1, None) ⇒ { onResolveFailure(); shutdown(DeliveredUnresolved) }
|
||||||
case ReceiveTimeout ⇒ onResolveFailure(); shutdown(DeliveredUnresolved)
|
case ReceiveTimeout ⇒ { onResolveFailure(); shutdown(DeliveredUnresolved) }
|
||||||
}
|
}
|
||||||
|
|
||||||
def shutdown(message: Any) {
|
def shutdown(message: Any) {
|
||||||
|
|
|
||||||
|
|
@ -50,10 +50,18 @@ private[persistence] class InmemStore extends Actor {
|
||||||
var messages = Map.empty[String, Vector[PersistentImpl]]
|
var messages = Map.empty[String, Vector[PersistentImpl]]
|
||||||
|
|
||||||
def receive = {
|
def receive = {
|
||||||
case Write(p) ⇒ add(p); success()
|
case Write(p) ⇒
|
||||||
case WriteBatch(pb) ⇒ pb.foreach(add); success()
|
add(p)
|
||||||
case Delete(p) ⇒ update(p.processorId, p.sequenceNr)(_.copy(deleted = true)); success()
|
success()
|
||||||
case Confirm(pid, snr, cid) ⇒ update(pid, snr)(p ⇒ p.copy(confirms = cid +: p.confirms)); success()
|
case WriteBatch(pb) ⇒
|
||||||
|
pb.foreach(add)
|
||||||
|
success()
|
||||||
|
case Delete(p) ⇒
|
||||||
|
update(p.processorId, p.sequenceNr)(_.copy(deleted = true))
|
||||||
|
success()
|
||||||
|
case Confirm(pid, snr, cid) ⇒
|
||||||
|
update(pid, snr)(p ⇒ p.copy(confirms = cid +: p.confirms))
|
||||||
|
success()
|
||||||
case Replay(pid, fromSnr, toSnr, callback) ⇒ {
|
case Replay(pid, fromSnr, toSnr, callback) ⇒ {
|
||||||
for {
|
for {
|
||||||
ms ← messages.get(pid)
|
ms ← messages.get(pid)
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,9 @@ object ProcessorStashSpec {
|
||||||
var state: List[String] = Nil
|
var state: List[String] = Nil
|
||||||
|
|
||||||
val behaviorA: Actor.Receive = {
|
val behaviorA: Actor.Receive = {
|
||||||
case Persistent("a", snr) ⇒ update("a", snr); context.become(behaviorB)
|
case Persistent("a", snr) ⇒ { update("a", snr); context.become(behaviorB) }
|
||||||
case Persistent("b", snr) ⇒ update("b", snr)
|
case Persistent("b", snr) ⇒ update("b", snr)
|
||||||
case Persistent("c", snr) ⇒ update("c", snr); unstashAll()
|
case Persistent("c", snr) ⇒ { update("c", snr); unstashAll() }
|
||||||
case "x" ⇒ update("x")
|
case "x" ⇒ update("x")
|
||||||
case "boom" ⇒ throw new TestException("boom")
|
case "boom" ⇒ throw new TestException("boom")
|
||||||
case Persistent("boom", _) ⇒ throw new TestException("boom")
|
case Persistent("boom", _) ⇒ throw new TestException("boom")
|
||||||
|
|
@ -24,7 +24,7 @@ object ProcessorStashSpec {
|
||||||
}
|
}
|
||||||
|
|
||||||
val behaviorB: Actor.Receive = {
|
val behaviorB: Actor.Receive = {
|
||||||
case Persistent("b", _) ⇒ stash(); context.become(behaviorA)
|
case Persistent("b", _) ⇒ { stash(); context.become(behaviorA) }
|
||||||
case "x" ⇒ stash()
|
case "x" ⇒ stash()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ object RemoteNodeShutdownAndComesBackSpec extends MultiNodeConfig {
|
||||||
|
|
||||||
class Subject extends Actor {
|
class Subject extends Actor {
|
||||||
def receive = {
|
def receive = {
|
||||||
case "shutdown" => context.system.shutdown()
|
case "shutdown" ⇒ context.system.shutdown()
|
||||||
case msg ⇒ sender ! msg
|
case msg ⇒ sender ! msg
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -137,7 +137,6 @@ abstract class RemoteNodeShutdownAndComesBackSpec
|
||||||
""").withFallback(system.settings.config))
|
""").withFallback(system.settings.config))
|
||||||
freshSystem.actorOf(Props[Subject], "subject")
|
freshSystem.actorOf(Props[Subject], "subject")
|
||||||
|
|
||||||
|
|
||||||
freshSystem.awaitTermination(30.seconds)
|
freshSystem.awaitTermination(30.seconds)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ abstract class StatsSampleSingleMasterSpec extends MultiNodeSpec(StatsSampleSing
|
||||||
|
|
||||||
Cluster(system) join firstAddress
|
Cluster(system) join firstAddress
|
||||||
|
|
||||||
receiveN(3).collect { case MemberUp(m) => m.address }.toSet must be (
|
receiveN(3).collect { case MemberUp(m) ⇒ m.address }.toSet must be(
|
||||||
Set(firstAddress, secondAddress, thirdAddress))
|
Set(firstAddress, secondAddress, thirdAddress))
|
||||||
|
|
||||||
Cluster(system).unsubscribe(testActor)
|
Cluster(system).unsubscribe(testActor)
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,7 @@ abstract class StatsSampleSpec extends MultiNodeSpec(StatsSampleSpecConfig)
|
||||||
system.actorOf(Props[StatsWorker], "statsWorker")
|
system.actorOf(Props[StatsWorker], "statsWorker")
|
||||||
system.actorOf(Props[StatsService], "statsService")
|
system.actorOf(Props[StatsService], "statsService")
|
||||||
|
|
||||||
receiveN(3).collect { case MemberUp(m) => m.address }.toSet must be (
|
receiveN(3).collect { case MemberUp(m) ⇒ m.address }.toSet must be(
|
||||||
Set(firstAddress, secondAddress, thirdAddress))
|
Set(firstAddress, secondAddress, thirdAddress))
|
||||||
|
|
||||||
Cluster(system).unsubscribe(testActor)
|
Cluster(system).unsubscribe(testActor)
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ abstract class StatsSampleJapiSpec extends MultiNodeSpec(StatsSampleJapiSpecConf
|
||||||
system.actorOf(Props[StatsWorker], "statsWorker")
|
system.actorOf(Props[StatsWorker], "statsWorker")
|
||||||
system.actorOf(Props[StatsService], "statsService")
|
system.actorOf(Props[StatsService], "statsService")
|
||||||
|
|
||||||
receiveN(3).collect { case MemberUp(m) => m.address }.toSet must be (
|
receiveN(3).collect { case MemberUp(m) ⇒ m.address }.toSet must be(
|
||||||
Set(firstAddress, secondAddress, thirdAddress))
|
Set(firstAddress, secondAddress, thirdAddress))
|
||||||
|
|
||||||
Cluster(system).unsubscribe(testActor)
|
Cluster(system).unsubscribe(testActor)
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ abstract class StatsSampleSingleMasterJapiSpec extends MultiNodeSpec(StatsSample
|
||||||
|
|
||||||
Cluster(system) join firstAddress
|
Cluster(system) join firstAddress
|
||||||
|
|
||||||
receiveN(3).collect { case MemberUp(m) => m.address }.toSet must be (
|
receiveN(3).collect { case MemberUp(m) ⇒ m.address }.toSet must be(
|
||||||
Set(firstAddress, secondAddress, thirdAddress))
|
Set(firstAddress, secondAddress, thirdAddress))
|
||||||
|
|
||||||
Cluster(system).unsubscribe(testActor)
|
Cluster(system).unsubscribe(testActor)
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ class MultiNodeSample extends MultiNodeSpec(MultiNodeSampleConfig)
|
||||||
runOn(node2) {
|
runOn(node2) {
|
||||||
system.actorOf(Props(new Actor {
|
system.actorOf(Props(new Actor {
|
||||||
def receive = {
|
def receive = {
|
||||||
case "ping" => sender ! "pong"
|
case "ping" ⇒ sender ! "pong"
|
||||||
}
|
}
|
||||||
}), "ponger")
|
}), "ponger")
|
||||||
enterBarrier("deployed")
|
enterBarrier("deployed")
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ object SnapshotExample extends App {
|
||||||
case Persistent(s, snr) ⇒ state = state.update(s"${s}-${snr}")
|
case Persistent(s, snr) ⇒ state = state.update(s"${s}-${snr}")
|
||||||
case SaveSnapshotSuccess(metadata) ⇒ // ...
|
case SaveSnapshotSuccess(metadata) ⇒ // ...
|
||||||
case SaveSnapshotFailure(metadata, reason) ⇒ // ...
|
case SaveSnapshotFailure(metadata, reason) ⇒ // ...
|
||||||
case SnapshotOffer(_, s: ExampleState) ⇒ println("offered state = " + s); state = s
|
case SnapshotOffer(_, s: ExampleState) ⇒ { println("offered state = " + s); state = s }
|
||||||
case "print" ⇒ println("current state = " + state)
|
case "print" ⇒ println("current state = " + state)
|
||||||
case "snap" ⇒ saveSnapshot(state)
|
case "snap" ⇒ saveSnapshot(state)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ private[zeromq] class ConcurrentSocketActor(params: immutable.Seq[SocketOption])
|
||||||
}
|
}
|
||||||
|
|
||||||
private def handleConnectOption(msg: SocketConnectOption): Unit = msg match {
|
private def handleConnectOption(msg: SocketConnectOption): Unit = msg match {
|
||||||
case Connect(endpoint) ⇒ socket.connect(endpoint); notifyListener(Connecting)
|
case Connect(endpoint) ⇒ { socket.connect(endpoint); notifyListener(Connecting) }
|
||||||
case Bind(endpoint) ⇒ socket.bind(endpoint)
|
case Bind(endpoint) ⇒ socket.bind(endpoint)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue