diff --git a/akka-actor-tests/src/main/scala/akka/testing/Serializers.scala b/akka-actor-tests/src/main/scala/akka/testing/Serializers.scala index 6412619963..de7d0924ea 100644 --- a/akka-actor-tests/src/main/scala/akka/testing/Serializers.scala +++ b/akka-actor-tests/src/main/scala/akka/testing/Serializers.scala @@ -14,7 +14,7 @@ import sjson.json._ class ProtobufSerializer extends Serializer { val ARRAY_OF_BYTE_ARRAY = Array[Class[_]](classOf[Array[Byte]]) - def identifier = 2:Byte + def identifier = 2: Byte def toBinary(obj: AnyRef): Array[Byte] = { if (!obj.isInstanceOf[Message]) throw new IllegalArgumentException( @@ -33,7 +33,7 @@ object ProtobufSerializer extends ProtobufSerializer class JavaJSONSerializer extends Serializer { private val mapper = new ObjectMapper - def identifier = 3:Byte + def identifier = 3: Byte def toBinary(obj: AnyRef): Array[Byte] = { val bos = new ByteArrayOutputStream @@ -58,7 +58,7 @@ object JavaJSONSerializer extends JavaJSONSerializer class SJSONSerializer extends Serializer { - def identifier = 4:Byte + def identifier = 4: Byte def toBinary(obj: AnyRef): Array[Byte] = sjson.json.Serializer.SJSON.out(obj) diff --git a/akka-actor-tests/src/test/scala/akka/AkkaExceptionSpec.scala b/akka-actor-tests/src/test/scala/akka/AkkaExceptionSpec.scala index ac0b2b75cf..5e51e2366a 100644 --- a/akka-actor-tests/src/test/scala/akka/AkkaExceptionSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/AkkaExceptionSpec.scala @@ -22,7 +22,7 @@ class AkkaExceptionSpec extends WordSpec with MustMatchers { } } - def verify(clazz:java.lang.Class[_]):Unit = { + def verify(clazz: java.lang.Class[_]): Unit = { clazz.getConstructor(Array(classOf[String]): _*) } } diff --git a/akka-actor-tests/src/test/scala/akka/actor/actor/Bench.scala b/akka-actor-tests/src/test/scala/akka/actor/actor/Bench.scala index 315798cc19..9ac58d284a 100644 --- a/akka-actor-tests/src/test/scala/akka/actor/actor/Bench.scala +++ b/akka-actor-tests/src/test/scala/akka/actor/actor/Bench.scala @@ -91,7 +91,7 @@ object Chameneos { self.stop() } - case msg@Meet(a, c) ⇒ + case msg @ Meet(a, c) ⇒ if (n > 0) { waitingChameneo match { case Some(chameneo) ⇒ diff --git a/akka-actor-tests/src/test/scala/akka/actor/supervisor/Ticket669Spec.scala b/akka-actor-tests/src/test/scala/akka/actor/supervisor/Ticket669Spec.scala index 5863305ff4..2074bff0d1 100644 --- a/akka-actor-tests/src/test/scala/akka/actor/supervisor/Ticket669Spec.scala +++ b/akka-actor-tests/src/test/scala/akka/actor/supervisor/Ticket669Spec.scala @@ -14,7 +14,7 @@ import org.scalatest.matchers.MustMatchers class Ticket669Spec extends WordSpec with MustMatchers with BeforeAndAfterAll { import Ticket669Spec._ - override def beforeAll = Thread.interrupted() //remove interrupted status. + override def beforeAll = Thread.interrupted() //remove interrupted status. override def afterAll = Actor.registry.local.shutdownAll diff --git a/akka-actor-tests/src/test/scala/akka/dispatch/ActorModelSpec.scala b/akka-actor-tests/src/test/scala/akka/dispatch/ActorModelSpec.scala index 327d6dda10..3fa4d16f2e 100644 --- a/akka-actor-tests/src/test/scala/akka/dispatch/ActorModelSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/dispatch/ActorModelSpec.scala @@ -9,12 +9,12 @@ import akka.testkit.Testing import akka.dispatch._ import akka.actor.Actor._ import java.util.concurrent.atomic.AtomicLong -import java.util.concurrent.{ConcurrentHashMap, CountDownLatch, TimeUnit} +import java.util.concurrent.{ ConcurrentHashMap, CountDownLatch, TimeUnit } import akka.actor.dispatch.ActorModelSpec.MessageDispatcherInterceptor import akka.util.Switch -import akka.actor.{ActorKilledException, PoisonPill, ActorRef, Actor} +import akka.actor.{ ActorKilledException, PoisonPill, ActorRef, Actor } import java.rmi.RemoteException -import org.junit.{After, Test} +import org.junit.{ After, Test } object ActorModelSpec { @@ -46,7 +46,6 @@ object ActorModelSpec { case class ThrowException(e: Throwable) extends ActorModelMessage - val Ping = "Ping" val Pong = "Pong" @@ -68,19 +67,19 @@ object ActorModelSpec { } def receive = { - case Await(latch) ⇒ ack; latch.await(); busy.switchOff() - case Meet(sign, wait) ⇒ ack; sign.countDown(); wait.await(); busy.switchOff() - case Wait(time) ⇒ ack; Thread.sleep(time); busy.switchOff() - case WaitAck(time, l) ⇒ ack; Thread.sleep(time); l.countDown(); busy.switchOff() - case Reply(msg) ⇒ ack; self.reply(msg); busy.switchOff() - case TryReply(msg) ⇒ ack; self.tryReply(msg); busy.switchOff() - case Forward(to, msg) ⇒ ack; to.forward(msg); busy.switchOff() - case CountDown(latch) ⇒ ack; latch.countDown(); busy.switchOff() - case Increment(count) ⇒ ack; count.incrementAndGet(); busy.switchOff() - case CountDownNStop(l) ⇒ ack; l.countDown(); self.stop(); busy.switchOff() - case Restart ⇒ ack; busy.switchOff(); throw new Exception("Restart requested") - case Interrupt => ack; busy.switchOff(); throw new InterruptedException("Ping!") - case ThrowException(e: Throwable) => ack; busy.switchOff(); throw e + case Await(latch) ⇒ ack; latch.await(); busy.switchOff() + case Meet(sign, wait) ⇒ ack; sign.countDown(); wait.await(); busy.switchOff() + case Wait(time) ⇒ ack; Thread.sleep(time); busy.switchOff() + case WaitAck(time, l) ⇒ ack; Thread.sleep(time); l.countDown(); busy.switchOff() + case Reply(msg) ⇒ ack; self.reply(msg); busy.switchOff() + case TryReply(msg) ⇒ ack; self.tryReply(msg); busy.switchOff() + case Forward(to, msg) ⇒ ack; to.forward(msg); busy.switchOff() + case CountDown(latch) ⇒ ack; latch.countDown(); busy.switchOff() + case Increment(count) ⇒ ack; count.incrementAndGet(); busy.switchOff() + case CountDownNStop(l) ⇒ ack; l.countDown(); self.stop(); busy.switchOff() + case Restart ⇒ ack; busy.switchOff(); throw new Exception("Restart requested") + case Interrupt ⇒ ack; busy.switchOff(); throw new InterruptedException("Ping!") + case ThrowException(e: Throwable) ⇒ ack; busy.switchOff(); throw e } } @@ -368,9 +367,8 @@ abstract class ActorModelSpec extends JUnitSuite { def flood(num: Int) { val cachedMessage = CountDownNStop(new CountDownLatch(num)) - (1 to num) foreach { - _ ⇒ - newTestActor.start() ! cachedMessage + (1 to num) foreach { _ ⇒ + newTestActor.start() ! cachedMessage } assertCountDown(cachedMessage.latch, Testing.testTime(10000), "Should process " + num + " countdowns") } @@ -454,4 +452,3 @@ class BalancingDispatcherModelTest extends ActorModelSpec { new BalancingDispatcher("foo") with MessageDispatcherInterceptor } - diff --git a/akka-actor-tests/src/test/scala/akka/misc/SchedulerSpec.scala b/akka-actor-tests/src/test/scala/akka/misc/SchedulerSpec.scala index 3c08d0983a..6d2b4093ed 100644 --- a/akka-actor-tests/src/test/scala/akka/misc/SchedulerSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/misc/SchedulerSpec.scala @@ -5,12 +5,12 @@ import Actor._ import akka.config.Supervision._ import org.multiverse.api.latches.StandardLatch import org.junit.Test -import java.util.concurrent.{ScheduledFuture, ConcurrentLinkedQueue, CountDownLatch, TimeUnit} +import java.util.concurrent.{ ScheduledFuture, ConcurrentLinkedQueue, CountDownLatch, TimeUnit } class SchedulerSpec extends JUnitSuite { private val futures = new ConcurrentLinkedQueue[ScheduledFuture[AnyRef]]() - def collectFuture(f: => ScheduledFuture[AnyRef]): ScheduledFuture[AnyRef] = { + def collectFuture(f: ⇒ ScheduledFuture[AnyRef]): ScheduledFuture[AnyRef] = { val future = f futures.add(future) future @@ -18,7 +18,7 @@ class SchedulerSpec extends JUnitSuite { def withCleanEndState(action: ⇒ Unit) { action - while(futures.peek() ne null) { Option(futures.poll()).foreach(_.cancel(true)) } + while (futures.peek() ne null) { Option(futures.poll()).foreach(_.cancel(true)) } Actor.registry.local.shutdownAll } diff --git a/akka-actor-tests/src/test/scala/akka/performance/trading/common/OrderReceiver.scala b/akka-actor-tests/src/test/scala/akka/performance/trading/common/OrderReceiver.scala index 869c186524..ae8e879421 100755 --- a/akka-actor-tests/src/test/scala/akka/performance/trading/common/OrderReceiver.scala +++ b/akka-actor-tests/src/test/scala/akka/performance/trading/common/OrderReceiver.scala @@ -34,7 +34,7 @@ class AkkaOrderReceiver(disp: Option[MessageDispatcher]) } def receive = { - case routing@MatchingEngineRouting(mapping) ⇒ + case routing @ MatchingEngineRouting(mapping) ⇒ refreshMatchingEnginePartitions(routing.asInstanceOf[MatchingEngineRouting[ActorRef]]) case order: Order ⇒ placeOrder(order) case unknown ⇒ EventHandler.warning(this, "Received unknown message: " + unknown) diff --git a/akka-actor-tests/src/test/scala/akka/performance/workbench/BenchResultRepository.scala b/akka-actor-tests/src/test/scala/akka/performance/workbench/BenchResultRepository.scala index 0c8e5f0cb2..048606d322 100644 --- a/akka-actor-tests/src/test/scala/akka/performance/workbench/BenchResultRepository.scala +++ b/akka-actor-tests/src/test/scala/akka/performance/workbench/BenchResultRepository.scala @@ -12,7 +12,7 @@ import java.io.PrintWriter import java.text.SimpleDateFormat import java.util.Date -import scala.collection.mutable.{Map => MutableMap} +import scala.collection.mutable.{ Map ⇒ MutableMap } import akka.event.EventHandler diff --git a/akka-actor-tests/src/test/scala/akka/routing/RoutingSpec.scala b/akka-actor-tests/src/test/scala/akka/routing/RoutingSpec.scala index f4bd4f1204..6b03c75e1a 100644 --- a/akka-actor-tests/src/test/scala/akka/routing/RoutingSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/routing/RoutingSpec.scala @@ -109,7 +109,7 @@ class RoutingSpec extends WordSpec with MustMatchers { t1.dispatcher.suspend(t1) - for (i <- 1 to 2501) t1 ! i + for (i ← 1 to 2501) t1 ! i val t2 = actorOf(new Actor { def receive = { @@ -121,7 +121,7 @@ class RoutingSpec extends WordSpec with MustMatchers { val d = loadBalancerActor(new SmallestMailboxFirstIterator(t1 :: t2 :: Nil)) //Will pick the last with the smallest mailbox, so make sure t1 is last - for (i ← 1 to 2499 ) d ! i + for (i ← 1 to 2499) d ! i latch2.await(20 seconds) @@ -529,12 +529,12 @@ class RoutingSpec extends WordSpec with MustMatchers { def pressureThreshold = 1 def factory = actorOf(new Actor { if (deathCount.get > 5) deathCount.set(0) - if (deathCount.get > 0) {deathCount.incrementAndGet;throw new IllegalStateException("keep dying")} + if (deathCount.get > 0) { deathCount.incrementAndGet; throw new IllegalStateException("keep dying") } def receive = { - case akka.Die ⇒ + case akka.Die ⇒ if (keepDying) deathCount.incrementAndGet throw new RuntimeException - case _ => pingCount.incrementAndGet + case _ ⇒ pingCount.incrementAndGet } }).start() }).start() @@ -554,12 +554,12 @@ class RoutingSpec extends WordSpec with MustMatchers { def factory = actorOf(new Actor { self.lifeCycle = Permanent if (deathCount.get > 5) deathCount.set(0) - if (deathCount.get > 0) {deathCount.incrementAndGet;throw new IllegalStateException("keep dying")} + if (deathCount.get > 0) { deathCount.incrementAndGet; throw new IllegalStateException("keep dying") } def receive = { - case akka.Die ⇒ + case akka.Die ⇒ if (keepDying) deathCount.incrementAndGet throw new RuntimeException - case _ => pingCount.incrementAndGet + case _ ⇒ pingCount.incrementAndGet } }).start() }).start() @@ -579,12 +579,12 @@ class RoutingSpec extends WordSpec with MustMatchers { def factory = actorOf(new Actor { self.lifeCycle = Temporary if (deathCount.get > 5) deathCount.set(0) - if (deathCount.get > 0) {deathCount.incrementAndGet;throw new IllegalStateException("keep dying")} + if (deathCount.get > 0) { deathCount.incrementAndGet; throw new IllegalStateException("keep dying") } def receive = { - case akka.Die ⇒ + case akka.Die ⇒ if (keepDying) deathCount.incrementAndGet throw new RuntimeException - case _ => pingCount.incrementAndGet + case _ ⇒ pingCount.incrementAndGet } }).start() }).start() @@ -598,12 +598,12 @@ class RoutingSpec extends WordSpec with MustMatchers { pool1 ! akka.Die sleepFor(2 seconds) (pool1 ? ActorPool.Stat).as[ActorPool.Stats].get.size must be(2) - pingCount.get must be (1) + pingCount.get must be(1) // default lifecycle // actor dies completely pingCount.set(0) - keepDying = true + keepDying = true pool1 ! "ping" (pool1 ? ActorPool.Stat).as[ActorPool.Stats].get.size must be(2) pool1 ! akka.Die @@ -611,35 +611,35 @@ class RoutingSpec extends WordSpec with MustMatchers { (pool1 ? ActorPool.Stat).as[ActorPool.Stats].get.size must be(1) pool1 ! "ping" (pool1 ? ActorPool.Stat).as[ActorPool.Stats].get.size must be(2) - pingCount.get must be (2) + pingCount.get must be(2) // permanent lifecycle // actor comes back right away pingCount.set(0) - keepDying = false + keepDying = false pool2 ! "ping" (pool2 ? ActorPool.Stat).as[ActorPool.Stats].get.size must be(2) pool2 ! akka.Die sleepFor(2 seconds) (pool2 ? ActorPool.Stat).as[ActorPool.Stats].get.size must be(2) - pingCount.get must be (1) + pingCount.get must be(1) // permanent lifecycle // actor dies completely pingCount.set(0) - keepDying = true + keepDying = true pool2 ! "ping" (pool2 ? ActorPool.Stat).as[ActorPool.Stats].get.size must be(2) pool2 ! akka.Die sleepFor(2 seconds) (pool2 ? ActorPool.Stat).as[ActorPool.Stats].get.size must be(1) pool2 ! "ping" - (pool2 ? ActorPool.Stat).as[ActorPool.Stats].get.size must be(2) - pingCount.get must be (2) + (pool2 ? ActorPool.Stat).as[ActorPool.Stats].get.size must be(2) + pingCount.get must be(2) // temporary lifecycle pingCount.set(0) - keepDying = false + keepDying = false pool3 ! "ping" (pool3 ? ActorPool.Stat).as[ActorPool.Stats].get.size must be(2) pool3 ! akka.Die @@ -649,7 +649,7 @@ class RoutingSpec extends WordSpec with MustMatchers { pool3 ! "ping" pool3 ! "ping" (pool3 ? ActorPool.Stat).as[ActorPool.Stats].get.size must be(2) - pingCount.get must be (4) + pingCount.get must be(4) } "support customizable supervision config of pooled actors" in { @@ -678,19 +678,18 @@ class RoutingSpec extends WordSpec with MustMatchers { def pressureThreshold = 1 def factory = actorOf(new Actor { if (deathCount.get > 5) deathCount.set(0) - if (deathCount.get > 0) {deathCount.incrementAndGet;throw new IllegalStateException("keep dying")} + if (deathCount.get > 0) { deathCount.incrementAndGet; throw new IllegalStateException("keep dying") } def receive = { - case BadState ⇒ + case BadState ⇒ if (keepDying) deathCount.incrementAndGet throw new IllegalStateException - case akka.Die => + case akka.Die ⇒ throw new RuntimeException - case _ => pingCount.incrementAndGet + case _ ⇒ pingCount.incrementAndGet } }).start() }).start() - // actor comes back right away pingCount.set(0) keepDying = false @@ -699,11 +698,11 @@ class RoutingSpec extends WordSpec with MustMatchers { pool1 ! BadState sleepFor(2 seconds) (pool1 ? ActorPool.Stat).as[ActorPool.Stats].get.size must be(2) - pingCount.get must be (1) + pingCount.get must be(1) // actor dies completely pingCount.set(0) - keepDying = true + keepDying = true pool1 ! "ping" (pool1 ? ActorPool.Stat).as[ActorPool.Stats].get.size must be(2) pool1 ! BadState @@ -711,7 +710,7 @@ class RoutingSpec extends WordSpec with MustMatchers { (pool1 ? ActorPool.Stat).as[ActorPool.Stats].get.size must be(1) pool1 ! "ping" (pool1 ? ActorPool.Stat).as[ActorPool.Stats].get.size must be(2) - pingCount.get must be (2) + pingCount.get must be(2) // kill it intercept[RuntimeException](pool1.?(akka.Die).get) diff --git a/akka-actor-tests/src/test/scala/akka/testkit/CallingThreadDispatcherModelSpec.scala b/akka-actor-tests/src/test/scala/akka/testkit/CallingThreadDispatcherModelSpec.scala index 9fbc5fd7ac..78d74cfdc5 100644 --- a/akka-actor-tests/src/test/scala/akka/testkit/CallingThreadDispatcherModelSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/testkit/CallingThreadDispatcherModelSpec.scala @@ -5,7 +5,7 @@ package akka.testkit import akka.actor.dispatch.ActorModelSpec import java.util.concurrent.CountDownLatch -import org.junit.{After, Test} +import org.junit.{ After, Test } class CallingThreadDispatcherModelSpec extends ActorModelSpec { import ActorModelSpec._ @@ -43,7 +43,6 @@ class CallingThreadDispatcherModelSpec extends ActorModelSpec { //Can't handle this... } - @After def after { //remove the interrupted status since we are messing with interrupted exceptions. diff --git a/akka-actor/src/main/scala/akka/AkkaException.scala b/akka-actor/src/main/scala/akka/AkkaException.scala index 24831ff589..f623c3734f 100644 --- a/akka-actor/src/main/scala/akka/AkkaException.scala +++ b/akka-actor/src/main/scala/akka/AkkaException.scala @@ -6,7 +6,7 @@ package akka import akka.actor.newUuid import java.net.{ InetAddress, UnknownHostException } - + /** * Akka base Exception. Each Exception gets: *