Added parens to stop

This commit is contained in:
Patrik Nordwall 2011-04-12 10:53:56 +02:00
parent 087191f19f
commit 3c8e375f30
40 changed files with 151 additions and 151 deletions

View file

@ -41,7 +41,7 @@ object ActorRefSpec {
case "work" => {
work
self.reply("workDone")
self.stop
self.stop()
}
case replyTo: Channel[Any] => {
work
@ -122,8 +122,8 @@ class ActorRefSpec extends WordSpec with MustMatchers {
latch.await
clientRef.stop
serverRef.stop
clientRef.stop()
serverRef.stop()
}
"stop when sent a poison pill" in {

View file

@ -88,7 +88,7 @@ object Chameneos {
sumMeetings += i
if (numFaded == numChameneos) {
Chameneos.end = System.currentTimeMillis
self.stop
self.stop()
}
case msg @ Meet(a, c) =>

View file

@ -31,7 +31,7 @@ class ReceiveTimeoutSpec extends WordSpec with MustMatchers {
}).start()
timeoutLatch.await
timeoutActor.stop
timeoutActor.stop()
}
"get timeout when swapped" in {
@ -54,7 +54,7 @@ class ReceiveTimeoutSpec extends WordSpec with MustMatchers {
})
swappedLatch.await
timeoutActor.stop
timeoutActor.stop()
}
"reschedule timeout after regular receive" in {
@ -73,7 +73,7 @@ class ReceiveTimeoutSpec extends WordSpec with MustMatchers {
timeoutActor ! Tick
timeoutLatch.await
timeoutActor.stop
timeoutActor.stop()
}
"be able to turn off timeout if desired" in {
@ -97,7 +97,7 @@ class ReceiveTimeoutSpec extends WordSpec with MustMatchers {
timeoutLatch.await
count.get must be (1)
timeoutActor.stop
timeoutActor.stop()
}
"not receive timeout message when not specified" in {
@ -110,7 +110,7 @@ class ReceiveTimeoutSpec extends WordSpec with MustMatchers {
}).start()
timeoutLatch.awaitTimeout(1 second) // timeout expected
timeoutActor.stop
timeoutActor.stop()
}
"have ReceiveTimeout eq to Actors ReceiveTimeout" in {

View file

@ -60,7 +60,7 @@ object ActorModelSpec {
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 CountDownNStop(l)=> ack; l.countDown; self.stop(); busy.switchOff()
case Restart => ack; busy.switchOff(); throw new Exception("Restart requested")
}
}
@ -204,7 +204,7 @@ abstract class ActorModelSpec extends JUnitSuite {
assertDispatcher(dispatcher)(starts = 0, stops = 0)
a.start()
assertDispatcher(dispatcher)(starts = 1, stops = 0)
a.stop
a.stop()
await(dispatcher.stops.get == 1)(withinMs = dispatcher.timeoutMs * 5)
assertDispatcher(dispatcher)(starts = 1, stops = 1)
assertRef(a,dispatcher)(
@ -234,7 +234,7 @@ abstract class ActorModelSpec extends JUnitSuite {
assertCountDown(oneAtATime, Testing.testTime(1500) ,"Processed message when allowed")
assertRefDefaultZero(a)(registers = 1, msgsReceived = 3, msgsProcessed = 3)
a.stop
a.stop()
assertRefDefaultZero(a)(registers = 1, unregisters = 1, msgsReceived = 3, msgsProcessed = 3)
}
@ -249,7 +249,7 @@ abstract class ActorModelSpec extends JUnitSuite {
assertCountDown(counter, Testing.testTime(3000), "Should process 200 messages")
assertRefDefaultZero(a)(registers = 1, msgsReceived = 200, msgsProcessed = 200)
a.stop
a.stop()
}
def spawn(f : => Unit) = {
@ -270,8 +270,8 @@ abstract class ActorModelSpec extends JUnitSuite {
assertCountDown(bParallel, Testing.testTime(3000), "Should process other actors in parallel")
aStop.countDown()
a.stop
b.stop
a.stop()
b.stop()
assertRefDefaultZero(a)(registers = 1, unregisters = 1, msgsReceived = 1, msgsProcessed = 1)
assertRefDefaultZero(b)(registers = 1, unregisters = 1, msgsReceived = 1, msgsProcessed = 1)
}
@ -283,7 +283,7 @@ abstract class ActorModelSpec extends JUnitSuite {
a ! Restart
a ! CountDown(done)
assertCountDown(done, Testing.testTime(3000), "Should be suspended+resumed and done with next message within 3 seconds")
a.stop
a.stop()
assertRefDefaultZero(a)(registers = 1,unregisters = 1, msgsReceived = 2,
msgsProcessed = 2, suspensions = 1, resumes = 1)
}
@ -302,7 +302,7 @@ abstract class ActorModelSpec extends JUnitSuite {
assertRefDefaultZero(a)(registers = 1, msgsReceived = 1, msgsProcessed = 1,
suspensions = 1, resumes = 1)
a.stop
a.stop()
assertRefDefaultZero(a)(registers = 1,unregisters = 1, msgsReceived = 1, msgsProcessed = 1,
suspensions = 1, resumes = 1)
}

View file

@ -38,21 +38,21 @@ class ExecutorBasedEventDrivenDispatcherActorSpec extends JUnitSuite {
val actor = actorOf[OneWayTestActor].start()
val result = actor ! "OneWay"
assert(OneWayTestActor.oneWay.await(1, TimeUnit.SECONDS))
actor.stop
actor.stop()
}
@Test def shouldSendReplySync = {
val actor = actorOf[TestActor].start()
val result = (actor !! ("Hello", 10000)).as[String]
assert("World" === result.get)
actor.stop
actor.stop()
}
@Test def shouldSendReplyAsync = {
val actor = actorOf[TestActor].start()
val result = actor !! "Hello"
assert("World" === result.get.asInstanceOf[String])
actor.stop
actor.stop()
}
@Test def shouldSendReceiveException = {
@ -64,7 +64,7 @@ class ExecutorBasedEventDrivenDispatcherActorSpec extends JUnitSuite {
case e =>
assert("Expected exception; to test fault-tolerance" === e.getMessage())
}
actor.stop
actor.stop()
}
@Test def shouldRespectThroughput {
@ -96,8 +96,8 @@ class ExecutorBasedEventDrivenDispatcherActorSpec extends JUnitSuite {
fastOne ! "sabotage"
start.countDown
val result = latch.await(3,TimeUnit.SECONDS)
fastOne.stop
slowOne.stop
fastOne.stop()
slowOne.stop()
assert(result === true)
}
@ -115,7 +115,7 @@ class ExecutorBasedEventDrivenDispatcherActorSpec extends JUnitSuite {
val fastOne = actorOf(
new Actor {
self.dispatcher = throughputDispatcher
def receive = { case "ping" => if(works.get) latch.countDown; self.stop }
def receive = { case "ping" => if(works.get) latch.countDown; self.stop() }
}).start()
val slowOne = actorOf(
@ -123,7 +123,7 @@ class ExecutorBasedEventDrivenDispatcherActorSpec extends JUnitSuite {
self.dispatcher = throughputDispatcher
def receive = {
case "hogexecutor" => ready.countDown; start.await
case "ping" => works.set(false); self.stop
case "ping" => works.set(false); self.stop()
}
}).start()

View file

@ -55,7 +55,7 @@ class ExecutorBasedEventDrivenDispatcherActorsSpec extends JUnitSuite with MustM
assert(sFinished.getCount > 0)
sFinished.await
assert(sFinished.getCount === 0)
f.stop
s.stop
f.stop()
s.stop()
}
}

View file

@ -90,8 +90,8 @@ class ExecutorBasedEventDrivenWorkStealingDispatcherSpec extends JUnitSuite with
fast.actor.asInstanceOf[DelayableActor].invocationCount must be > sentToFast
fast.actor.asInstanceOf[DelayableActor].invocationCount must be >
(slow.actor.asInstanceOf[DelayableActor].invocationCount)
slow.stop
fast.stop
slow.stop()
fast.stop()
}
@Test def canNotUseActorsOfDifferentTypesInSameDispatcher(): Unit = {

View file

@ -43,7 +43,7 @@ class FutureSpec extends JUnitSuite {
future.await
assert(future.result.isDefined)
assert("World" === future.result.get)
actor.stop
actor.stop()
}
@Test def shouldActorReplyExceptionThroughExplicitFuture {
@ -53,7 +53,7 @@ class FutureSpec extends JUnitSuite {
future.await
assert(future.exception.isDefined)
assert("Expected exception; to test fault-tolerance" === future.exception.get.getMessage)
actor.stop
actor.stop()
}
@Test def shouldFutureCompose {
@ -65,8 +65,8 @@ class FutureSpec extends JUnitSuite {
assert(Some(Right("WORLD")) === future1.await.value)
assert(Some(Right("WORLD")) === future2.await.value)
intercept[ClassCastException] { future3.await.resultOrException }
actor1.stop
actor2.stop
actor1.stop()
actor2.stop()
}
@Test def shouldFutureComposePatternMatch {
@ -76,8 +76,8 @@ class FutureSpec extends JUnitSuite {
val future2 = actor1 !!! "Hello" collect { case (n: Int) => n } flatMap (actor2 !!! _)
assert(Some(Right("WORLD")) === future1.await.value)
intercept[MatchError] { future2.await.resultOrException }
actor1.stop
actor2.stop
actor1.stop()
actor2.stop()
}
@Test def shouldFutureForComprehension {
@ -104,7 +104,7 @@ class FutureSpec extends JUnitSuite {
assert(Some(Right("10-14")) === future1.await.value)
intercept[ClassCastException] { future2.await.resultOrException }
actor.stop
actor.stop()
}
@Test def shouldFutureForComprehensionPatternMatch {
@ -131,7 +131,7 @@ class FutureSpec extends JUnitSuite {
assert(Some(Right("10-14")) === future1.await.value)
intercept[MatchError] { future2.await.resultOrException }
actor.stop
actor.stop()
}
@Test def shouldFutureAwaitEitherLeft = {
@ -142,8 +142,8 @@ class FutureSpec extends JUnitSuite {
val result = Futures.awaitEither(future1, future2)
assert(result.isDefined)
assert("World" === result.get)
actor1.stop
actor2.stop
actor1.stop()
actor2.stop()
}
@Test def shouldFutureAwaitEitherRight = {
@ -154,8 +154,8 @@ class FutureSpec extends JUnitSuite {
val result = Futures.awaitEither(future1, future2)
assert(result.isDefined)
assert("World" === result.get)
actor1.stop
actor2.stop
actor1.stop()
actor2.stop()
}
@Test def shouldFutureAwaitOneLeft = {
@ -166,8 +166,8 @@ class FutureSpec extends JUnitSuite {
val result = Futures.awaitOne(List(future1, future2))
assert(result.result.isDefined)
assert("World" === result.result.get)
actor1.stop
actor2.stop
actor1.stop()
actor2.stop()
}
@Test def shouldFutureAwaitOneRight = {
@ -178,8 +178,8 @@ class FutureSpec extends JUnitSuite {
val result = Futures.awaitOne(List(future1, future2))
assert(result.result.isDefined)
assert("World" === result.result.get)
actor1.stop
actor2.stop
actor1.stop()
actor2.stop()
}
@Test def shouldFutureAwaitAll = {
@ -192,8 +192,8 @@ class FutureSpec extends JUnitSuite {
assert("World" === future1.result.get)
assert(future2.result.isDefined)
assert("World" === future2.result.get)
actor1.stop
actor2.stop
actor1.stop()
actor2.stop()
}
@Test def shouldFuturesAwaitMapHandleEmptySequence {
@ -302,7 +302,7 @@ class FutureSpec extends JUnitSuite {
val actor = actorOf[TestActor].start()
actor !!! "Hello" receive { case "World" => latch.open }
assert(latch.tryAwait(5, TimeUnit.SECONDS))
actor.stop
actor.stop()
}
@Test def shouldTraverseFutures {
@ -317,7 +317,7 @@ class FutureSpec extends JUnitSuite {
val oddFutures: List[Future[Int]] = List.fill(100)(oddActor !!! 'GetNext)
assert(Futures.sequence(oddFutures).get.sum === 10000)
oddActor.stop
oddActor.stop()
val list = (1 to 100).toList
assert(Futures.traverse(list)(x => Future(x * 2 - 1)).get.sum === 10000)

View file

@ -36,21 +36,21 @@ class ThreadBasedActorSpec extends JUnitSuite {
}).start()
val result = actor ! "OneWay"
assert(oneWay.await(1, TimeUnit.SECONDS))
actor.stop
actor.stop()
}
@Test def shouldSendReplySync = {
val actor = actorOf[TestActor].start()
val result = (actor !! ("Hello", 10000)).as[String]
assert("World" === result.get)
actor.stop
actor.stop()
}
@Test def shouldSendReplyAsync = {
val actor = actorOf[TestActor].start()
val result = actor !! "Hello"
assert("World" === result.get.asInstanceOf[String])
actor.stop
actor.stop()
}
@Test def shouldSendReceiveException = {
@ -62,6 +62,6 @@ class ThreadBasedActorSpec extends JUnitSuite {
case e =>
assert("Expected exception; to test fault-tolerance" === e.getMessage())
}
actor.stop
actor.stop()
}
}

View file

@ -40,7 +40,7 @@ class ActorRegistrySpec extends JUnitSuite {
assert(actors.size === 1)
assert(actors.head.actor.isInstanceOf[TestActor])
assert(actors.head.id === "MyID")
actor.stop
actor.stop()
}
@Test def shouldGetActorByUUIDFromActorRegistry {
@ -51,7 +51,7 @@ class ActorRegistrySpec extends JUnitSuite {
val actorOrNone = Actor.registry.actorFor(uuid)
assert(actorOrNone.isDefined)
assert(actorOrNone.get.uuid === uuid)
actor.stop
actor.stop()
}
@Test def shouldGetActorByClassFromActorRegistry {
@ -62,7 +62,7 @@ class ActorRegistrySpec extends JUnitSuite {
assert(actors.size === 1)
assert(actors.head.actor.isInstanceOf[TestActor])
assert(actors.head.id === "MyID")
actor.stop
actor.stop()
}
@Test def shouldGetActorByManifestFromActorRegistry {
@ -73,7 +73,7 @@ class ActorRegistrySpec extends JUnitSuite {
assert(actors.size === 1)
assert(actors.head.actor.isInstanceOf[TestActor])
assert(actors.head.id === "MyID")
actor.stop
actor.stop()
}
@Test def shouldFindThingsFromActorRegistry {
@ -84,7 +84,7 @@ class ActorRegistrySpec extends JUnitSuite {
assert(found.isDefined)
assert(found.get.actor.isInstanceOf[TestActor])
assert(found.get.id === "MyID")
actor.stop
actor.stop()
}
@Test def shouldGetActorsByIdFromActorRegistry {
@ -99,8 +99,8 @@ class ActorRegistrySpec extends JUnitSuite {
assert(actors.head.id === "MyID")
assert(actors.last.actor.isInstanceOf[TestActor])
assert(actors.last.id === "MyID")
actor1.stop
actor2.stop
actor1.stop()
actor2.stop()
}
@Test def shouldGetActorsByClassFromActorRegistry {
@ -115,8 +115,8 @@ class ActorRegistrySpec extends JUnitSuite {
assert(actors.head.id === "MyID")
assert(actors.last.actor.isInstanceOf[TestActor])
assert(actors.last.id === "MyID")
actor1.stop
actor2.stop
actor1.stop()
actor2.stop()
}
@Test def shouldGetActorsByManifestFromActorRegistry {
@ -131,8 +131,8 @@ class ActorRegistrySpec extends JUnitSuite {
assert(actors.head.id === "MyID")
assert(actors.last.actor.isInstanceOf[TestActor])
assert(actors.last.id === "MyID")
actor1.stop
actor2.stop
actor1.stop()
actor2.stop()
}
@Test def shouldGetActorsByMessageFromActorRegistry {
@ -159,8 +159,8 @@ class ActorRegistrySpec extends JUnitSuite {
val actorsForMessagePing = Actor.registry.actorsFor[Actor]("ping")
assert(actorsForMessagePing.size === 2)
actor1.stop
actor2.stop
actor1.stop()
actor2.stop()
}
@Test def shouldGetAllActorsFromActorRegistry {
@ -175,8 +175,8 @@ class ActorRegistrySpec extends JUnitSuite {
assert(actors.head.id === "MyID")
assert(actors.last.actor.isInstanceOf[TestActor])
assert(actors.last.id === "MyID")
actor1.stop
actor2.stop
actor1.stop()
actor2.stop()
}
@Test def shouldGetResponseByAllActorsInActorRegistryWhenInvokingForeach {
@ -188,8 +188,8 @@ class ActorRegistrySpec extends JUnitSuite {
record = ""
Actor.registry.foreach(actor => actor !! "ping")
assert(record === "pongpong")
actor1.stop
actor2.stop
actor1.stop()
actor2.stop()
}
@Test def shouldShutdownAllActorsInActorRegistry {

View file

@ -47,7 +47,7 @@ class RoutingSpec extends junit.framework.TestCase with Suite with MustMatchers
result.isDefined must be (true)
result.get must be(21)
for(a <- List(t1,t2,d)) a.stop
for(a <- List(t1,t2,d)) a.stop()
}
@Test def testLogger = {
@ -62,8 +62,8 @@ class RoutingSpec extends junit.framework.TestCase with Suite with MustMatchers
val done = latch.await(5,TimeUnit.SECONDS)
done must be (true)
msgs must ( have size (2) and contain (foo) and contain (bar) )
t1.stop
l.stop
t1.stop()
l.stop()
}
@Test def testSmallestMailboxFirstDispatcher = {
@ -90,7 +90,7 @@ class RoutingSpec extends junit.framework.TestCase with Suite with MustMatchers
val done = latch.await(10,TimeUnit.SECONDS)
done must be (true)
t1ProcessedCount.get must be < (t2ProcessedCount.get) // because t1 is much slower and thus has a bigger mailbox all the time
for(a <- List(t1,t2,d)) a.stop
for(a <- List(t1,t2,d)) a.stop()
}
@Test def testListener = {
@ -129,7 +129,7 @@ class RoutingSpec extends junit.framework.TestCase with Suite with MustMatchers
num.get must be (2)
val withListeners = foreachListener.await(5,TimeUnit.SECONDS)
withListeners must be (true)
for(a <- List(i,a1,a2,a3)) a.stop
for(a <- List(i,a1,a2,a3)) a.stop()
}
@Test def testIsDefinedAt = {
@ -177,7 +177,7 @@ class RoutingSpec extends junit.framework.TestCase with Suite with MustMatchers
d2.isDefinedAt(testMsg1) must be (true)
d2.isDefinedAt(testMsg3) must be (false)
for(a <- List(t1,t2,d1,d2)) a.stop
for(a <- List(t1,t2,d1,d2)) a.stop()
}
// Actor Pool Capacity Tests
@ -260,7 +260,7 @@ class RoutingSpec extends junit.framework.TestCase with Suite with MustMatchers
_.await.resultOrException.get must be ("Response")
}
} finally {
actorPool.stop
actorPool.stop()
}
}

View file

@ -18,7 +18,7 @@ class CallingThreadDispatcherModelSpec extends ActorModelSpec {
(1 to num) foreach {
_ => newTestActor.start() ! cachedMessage
}
keeper.stop
keeper.stop()
assertCountDown(cachedMessage.latch,10000, "Should process " + num + " countdowns")
}
for(run <- 1 to 3) {

View file

@ -134,7 +134,7 @@ object Actor extends ListenerManagement {
* val actor = actorOf[MyActor]
* actor.start()
* actor ! message
* actor.stop
* actor.stop()
* </pre>
* You can create and start the actor in one statement like this:
* <pre>
@ -150,7 +150,7 @@ object Actor extends ListenerManagement {
* val actor = actorOf(classOf[MyActor])
* actor.start()
* actor ! message
* actor.stop
* actor.stop()
* </pre>
* You can create and start the actor in one statement like this:
* <pre>
@ -178,7 +178,7 @@ object Actor extends ListenerManagement {
* val actor = actorOf(new MyActor)
* actor.start()
* actor ! message
* actor.stop
* actor.stop()
* </pre>
* You can create and start the actor in one statement like this:
* <pre>
@ -217,7 +217,7 @@ object Actor extends ListenerManagement {
actorOf(new Actor() {
self.dispatcher = dispatcher
def receive = {
case Spawn => try { body } finally { self.stop }
case Spawn => try { body } finally { self.stop() }
}
}).start() ! Spawn
}
@ -373,7 +373,7 @@ trait Actor {
/**
* User overridable callback.
* <p/>
* Is called when 'actor.stop' is invoked.
* Is called when 'actor.stop()' is invoked.
*/
def postStop {}
@ -458,12 +458,12 @@ trait Actor {
case Exit(dead, reason) => self.handleTrapExit(dead, reason)
case Link(child) => self.link(child)
case Unlink(child) => self.unlink(child)
case UnlinkAndStop(child) => self.unlink(child); child.stop
case UnlinkAndStop(child) => self.unlink(child); child.stop()
case Restart(reason) => throw reason
case Kill => throw new ActorKilledException("Kill")
case PoisonPill =>
val f = self.senderFuture
self.stop
self.stop()
if (f.isDefined) f.get.completeWithException(new ActorKilledException("PoisonPill"))
}

View file

@ -62,7 +62,7 @@ abstract class Channel[T] {
* val actor = actorOf[MyActor]
* actor.start()
* actor ! message
* actor.stop
* actor.stop()
* </pre>
*
* You can also create and start actors like this:
@ -77,7 +77,7 @@ abstract class Channel[T] {
* val actor = actorOf(new MyActor(...))
* actor.start()
* actor ! message
* actor.stop
* actor.stop()
* </pre>
*
* @author <a href="http://jonasboner.com">Jonas Bon&#233;r</a>
@ -891,7 +891,7 @@ class LocalActorRef private[akka] (
case _ =>
if (_supervisor.isDefined) notifySupervisorWithMessage(Exit(this, reason))
else dead.stop
else dead.stop()
}
}
@ -1029,7 +1029,7 @@ class LocalActorRef private[akka] (
}
private def shutDownTemporaryActor(temporaryActor: ActorRef) {
temporaryActor.stop
temporaryActor.stop()
_linkedActors.remove(temporaryActor.uuid) // remove the temporary actor
// if last temporary actor is gone, then unlink me from supervisor
if (_linkedActors.isEmpty) notifySupervisorWithMessage(UnlinkAndStop(this))
@ -1061,7 +1061,7 @@ class LocalActorRef private[akka] (
{
val i = _linkedActors.values.iterator
while (i.hasNext) {
i.next.stop
i.next.stop()
i.remove
}
}

View file

@ -261,9 +261,9 @@ private[actor] final class ActorRegistry private[actor] () extends ListenerManag
val actorRef = elements.nextElement
val proxy = typedActorFor(actorRef)
if (proxy.isDefined) TypedActorModule.typedActorObjectInstance.get.stop(proxy.get)
else actorRef.stop
else actorRef.stop()
}
} else foreach(_.stop)
} else foreach(_.stop())
if (Remote.isEnabled) {
Actor.remote.clear //TODO: REVISIT: Should this be here?
}

View file

@ -433,7 +433,7 @@ trait FSM[S, D] {
private def terminate(reason: Reason) = {
terminateEvent.apply(StopEvent(reason, currentState.stateName, currentState.stateData))
self.stop
self.stop()
}
case class Event[D](event: Any, stateData: D)

View file

@ -114,7 +114,7 @@ sealed class Supervisor(handler: FaultHandlingStrategy) {
this
}
def shutdown(): Unit = supervisor.stop
def shutdown(): Unit = supervisor.stop()
def link(child: ActorRef) = supervisor.link(child)
@ -163,7 +163,7 @@ final class SupervisorActor private[akka] (handler: FaultHandlingStrategy) exten
val i = self.linkedActors.values.iterator
while(i.hasNext) {
val ref = i.next
ref.stop
ref.stop()
self.unlink(ref)
}
}

View file

@ -93,7 +93,7 @@ abstract class UntypedActor extends Actor {
/**
* User overridable callback.
* <p/>
* Is called when 'actor.stop' is invoked.
* Is called when 'actor.stop()' is invoked.
*/
override def postStop {}

View file

@ -52,7 +52,7 @@ object DataFlow {
private class ReactiveEventBasedThread[A <: AnyRef, T <: AnyRef](body: A => T)
extends Actor {
def receive = {
case Exit => self.stop
case Exit => self.stop()
case message => self.reply(body(message.asInstanceOf[A]))
}
}
@ -84,7 +84,7 @@ object DataFlow {
dataFlow.blockedReaders.poll ! s
} else throw new DataFlowVariableException(
"Attempt to change data flow variable (from [" + dataFlow.value.get + "] to [" + v + "])")
case Exit => self.stop
case Exit => self.stop()
}
}
@ -97,7 +97,7 @@ object DataFlow {
case None => readerFuture = self.senderFuture
}
case Set(v:T) => readerFuture.map(_ completeWithResult v)
case Exit => self.stop
case Exit => self.stop()
}
}

View file

@ -143,7 +143,7 @@ trait MessageDispatcher {
while (i.hasNext()) {
val uuid = i.next()
Actor.registry.actorFor(uuid) match {
case Some(actor) => actor.stop
case Some(actor) => actor.stop()
case None => {}
}
}

View file

@ -144,7 +144,7 @@ abstract class RemoteSupport extends ListenerManagement with RemoteServerModule
}
def shutdown {
eventHandler.stop
eventHandler.stop()
removeListener(eventHandler)
this.shutdownClientModule
this.shutdownServerModule
@ -159,7 +159,7 @@ abstract class RemoteSupport extends ListenerManagement with RemoteServerModule
* val actor = actorOf(classOf[MyActor],"www.akka.io", 2552)
* actor.start()
* actor ! message
* actor.stop
* actor.stop()
* </pre>
* You can create and start the actor in one statement like this:
* <pre>
@ -178,7 +178,7 @@ abstract class RemoteSupport extends ListenerManagement with RemoteServerModule
* val actor = actorOf(classOf[MyActor],"www.akka.io",2552)
* actor.start()
* actor ! message
* actor.stop
* actor.stop()
* </pre>
* You can create and start the actor in one statement like this:
* <pre>
@ -206,7 +206,7 @@ abstract class RemoteSupport extends ListenerManagement with RemoteServerModule
* val actor = actorOf[MyActor]("www.akka.io",2552)
* actor.start()
* actor ! message
* actor.stop
* actor.stop()
* </pre>
* You can create and start the actor in one statement like this:
* <pre>

View file

@ -37,7 +37,7 @@ trait ListenerManagement {
*/
def removeListener(listener: ActorRef) {
listeners remove listener
if (manageLifeCycleOfListeners) listener.stop
if (manageLifeCycleOfListeners) listener.stop()
}
/*

View file

@ -290,7 +290,7 @@ But we are not done yet. We are missing the message handler for the ``Master`` a
- ``Calculate`` -- which should start the calculation
- ``Result`` -- which should aggregate the different results
The ``Calculate`` handler is sending out work to all the ``Worker`` actors and after doing that it also sends a ``Broadcast(PoisonPill)`` message to the router, which will send out the ``PoisonPill`` message to all the actors it is representing (in our case all the ``Worker`` actors). The ``PoisonPill`` is a special kind of message that tells the receiver to shut himself down using the normal shutdown; ``self.stop``. Then we also send a ``PoisonPill`` to the router itself (since it's also an actor that we want to shut down).
The ``Calculate`` handler is sending out work to all the ``Worker`` actors and after doing that it also sends a ``Broadcast(PoisonPill)`` message to the router, which will send out the ``PoisonPill`` message to all the actors it is representing (in our case all the ``Worker`` actors). The ``PoisonPill`` is a special kind of message that tells the receiver to shut himself down using the normal shutdown; ``self.stop()``. Then we also send a ``PoisonPill`` to the router itself (since it's also an actor that we want to shut down).
The ``Result`` handler is simpler, here we just get the value from the ``Result`` message and aggregate it to our ``pi`` member variable. We also keep track of how many results we have received back and if it matches the number of tasks sent out the ``Master`` actor considers itself done and shuts himself down.

View file

@ -393,7 +393,7 @@ Actors are stopped by invoking the ``stop`` method.
.. code-block:: scala
actor.stop
actor.stop()
When stop is called then a call to the ``def postStop`` callback method will take place. The ``Actor`` can use this callback to implement shutdown behavior.

View file

@ -362,7 +362,7 @@ Here is an example of using ``retry`` to block until an account has enough money
atomic { account2.get }
// -> 600.0
transferer.stop
transferer.stop()
Alternative blocking transactions
---------------------------------
@ -414,7 +414,7 @@ You can also have two alternative blocking transactions, one of which can succee
// INFO Brancher: not enough on left - retrying
// INFO Brancher: going right
brancher.stop
brancher.stop()
----

View file

@ -27,10 +27,10 @@ class TestKitUsageSpec extends WordSpec with BeforeAndAfterAll with ShouldMatche
override protected def afterAll(): scala.Unit = {
stopTestActor
echoRef.stop
forwardRef.stop
filterRef.stop
seqRef.stop
echoRef.stop()
forwardRef.stop()
filterRef.stop()
seqRef.stop()
}
"An EchoActor" should {

View file

@ -67,8 +67,8 @@ Here is an example of coordinating two simple counter Actors so that they both i
counter1 !! GetCount // Some(1)
counter1.stop
counter2.stop
counter1.stop()
counter2.stop()
To start a new coordinated transaction set that you will also participate in, just create a ``Coordinated`` object:

View file

@ -192,7 +192,7 @@ There are two ways you can define an Actor to be a supervisor; declaratively and
The last thing we have to do to supervise Actors (in our example the storage Actor) is to 'link' the Actor. Invoking 'link(actor)' will create a link between the Actor passed as argument into 'link' and ourselves. This means that we will now get a notification if the linked Actor is crashing and if the cause of the crash, the exception, matches one of the exceptions in our 'trapExit' list then the crashed Actor is restarted according the the fault handling strategy defined in our 'faultHandler'. We also have the 'unlink(actor)' function which disconnects the linked Actor from the supervisor.
In our example we are using a method called 'spawnLink(actor)' which creates, starts and links the Actor in an atomic operation. The linking and unlinking is done in 'preStart' and 'postStop' callback methods which are invoked by the runtime when the Actor is started and shut down (shutting down is done by invoking 'actor.stop'). In these methods we initialize our Actor, by starting and linking the storage Actor and clean up after ourselves by shutting down all the user session Actors and the storage Actor.
In our example we are using a method called 'spawnLink(actor)' which creates, starts and links the Actor in an atomic operation. The linking and unlinking is done in 'preStart' and 'postStop' callback methods which are invoked by the runtime when the Actor is started and shut down (shutting down is done by invoking 'actor.stop()'). In these methods we initialize our Actor, by starting and linking the storage Actor and clean up after ourselves by shutting down all the user session Actors and the storage Actor.
That is it. Now we have implemented the supervising part of the fault-tolerance for the storage Actor. But before we dive into the 'ChatServer' code there are some more things worth mentioning about its implementation.
@ -225,7 +225,7 @@ I'll try to show you how we can make use Scala's mixins to decouple the Actor im
EventHandler.info(this, "Chat server is shutting down...")
shutdownSessions
self.unlink(storage)
storage.stop
storage.stop()
}
}
@ -266,12 +266,12 @@ The 'shutdownSessions' function simply shuts all the sessions Actors down. That
case Logout(username) =>
EventHandler.info(this, "User [%s] has logged out".format(username))
val session = sessions(username)
session.stop
session.stop()
sessions -= username
}
protected def shutdownSessions =
sessions.foreach { case (_, session) => session.stop }
sessions.foreach { case (_, session) => session.stop() }
}
Chat message management

View file

@ -405,7 +405,7 @@ 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 {
notifyListeners(RemoteClientShutdown(module, remoteAddress))
timer.stop
timer.stop()
timer = null
openChannels.close.awaitUninterruptibly
openChannels = null
@ -973,7 +973,7 @@ class RemoteServerHandler(
message match { // first match on system messages
case RemoteActorSystemMessage.Stop =>
if (UNTRUSTED_MODE) throw new SecurityException("Remote server is operating is untrusted mode, can not stop the actor")
else actorRef.stop
else actorRef.stop()
case _: LifeCycleMessage if (UNTRUSTED_MODE) =>
throw new SecurityException("Remote server is operating is untrusted mode, can not pass on a LifeCycleMessage to the remote actor")

View file

@ -80,7 +80,7 @@ class ClientInitiatedRemoteActorSpec extends AkkaRemoteTest {
clientManaged.getClass must be (classOf[LocalActorRef])
clientManaged ! "OneWay"
RemoteActorSpecActorUnidirectional.latch.await(1, TimeUnit.SECONDS) must be (true)
clientManaged.stop
clientManaged.stop()
}
"shouldSendOneWayAndReceiveReply" in {
@ -97,7 +97,7 @@ class ClientInitiatedRemoteActorSpec extends AkkaRemoteTest {
val actor = remote.actorOf[RemoteActorSpecActorBidirectional](host,port).start()
val result = actor !! ("Hello", 10000)
"World" must equal (result.get.asInstanceOf[String])
actor.stop
actor.stop()
}
"shouldSendBangBangMessageAndReceiveReplyConcurrently" in {
@ -105,7 +105,7 @@ class ClientInitiatedRemoteActorSpec extends AkkaRemoteTest {
actors.map(_ !!! ("Hello", 10000)) foreach { future =>
"World" must equal (future.await.result.asInstanceOf[Option[String]].get)
}
actors.foreach(_.stop)
actors.foreach(_.stop())
}
"shouldRegisterActorByUuid" in {
@ -122,8 +122,8 @@ class ClientInitiatedRemoteActorSpec extends AkkaRemoteTest {
(actor2 !! "test").get must equal ("default-test")
actor1.stop
actor2.stop
actor1.stop()
actor2.stop()
}
"shouldSendAndReceiveRemoteException" in {
@ -136,7 +136,7 @@ class ClientInitiatedRemoteActorSpec extends AkkaRemoteTest {
} catch {
case e: ExpectedRemoteProblem =>
}
actor.stop
actor.stop()
}
}
}

View file

@ -115,8 +115,8 @@ class SerializableTypeClassActorSpec extends
(actor2 !! "hello").getOrElse("_") should equal("world 3")
actor2.receiveTimeout should equal (Some(1000))
actor1.stop
actor2.stop
actor1.stop()
actor2.stop()
}
it("should be able to serialize and deserialize a MyStatelessActorWithMessagesInMailbox") {

View file

@ -131,12 +131,12 @@
case Logout(username) =>
EventHandler.info(this, "User [%s] has logged out".format(username))
val session = sessions(username)
session.stop
session.stop()
sessions -= username
}
protected def shutdownSessions =
sessions.foreach { case (_, session) => session.stop }
sessions.foreach { case (_, session) => session.stop() }
}
/**
@ -190,7 +190,7 @@
EventHandler.info(this, "Chat server is shutting down...")
shutdownSessions
self.unlink(storage)
storage.stop
storage.stop()
}
}

View file

@ -182,7 +182,7 @@ class Agent[T](initialValue: T) {
* Closes the agents and makes it eligable for garbage collection.
* A closed agent cannot accept any `send` actions.
*/
def close() = updater.stop
def close() = updater.stop()
// ---------------------------------------------
// Support for Java API Functions and Procedures
@ -250,8 +250,8 @@ class ThreadBasedAgentUpdater[T](agent: Agent[T]) extends Actor {
case update: Update[T] => {
atomic(txFactory) { agent.ref alter update.function }
agent.resume
self.stop
self.stop()
}
case _ => self.stop
case _ => self.stop()
}
}

View file

@ -66,8 +66,8 @@ class CoordinatedIncrementSpec extends WordSpec with MustMatchers {
for (counter <- counters) {
(counter !! GetCount).get must be === 1
}
counters foreach (_.stop)
failer.stop
counters foreach (_.stop())
failer.stop()
}
"increment no counters with a failing transaction" in {
@ -78,8 +78,8 @@ class CoordinatedIncrementSpec extends WordSpec with MustMatchers {
for (counter <- counters) {
(counter !! GetCount).get must be === 0
}
counters foreach (_.stop)
failer.stop
counters foreach (_.stop())
failer.stop()
}
}
}

View file

@ -113,8 +113,8 @@ class FickleFriendsSpec extends WordSpec with MustMatchers {
for (counter <- counters) {
(counter !! GetCount).get must be === 1
}
counters foreach (_.stop)
coordinator.stop
counters foreach (_.stop())
coordinator.stop()
}
}
}

View file

@ -94,8 +94,8 @@ class TransactorSpec extends WordSpec with MustMatchers {
for (counter <- counters) {
(counter !! GetCount).get must be === 1
}
counters foreach (_.stop)
failer.stop
counters foreach (_.stop())
failer.stop()
}
"increment no counters with a failing transaction" in {
@ -106,8 +106,8 @@ class TransactorSpec extends WordSpec with MustMatchers {
for (counter <- counters) {
(counter !! GetCount).get must be === 0
}
counters foreach (_.stop)
failer.stop
counters foreach (_.stop())
failer.stop()
}
}
@ -120,7 +120,7 @@ class TransactorSpec extends WordSpec with MustMatchers {
latch.await(timeout.length, timeout.unit)
val value = atomic { ref.get }
value must be === 5
transactor.stop
transactor.stop()
}
}
}

View file

@ -98,7 +98,7 @@ trait TestKit {
* Stop test actor. Should be done at the end of the test unless relying on
* test actor timeout.
*/
def stopTestActor { testActor.stop }
def stopTestActor { testActor.stop() }
/**
* Set test actor timeout. By default, the test actor shuts itself down

View file

@ -103,7 +103,7 @@ object Pi extends App {
// send the pi result back to the guy who started the calculation
recipient ! pi
// shut ourselves down, we're done
self.stop
self.stop()
}
}

View file

@ -165,7 +165,7 @@ abstract class TypedActor extends Actor with Proxyable {
/**
* User overridable callback.
* <p/>
* Is called when 'actor.stop' is invoked.
* Is called when 'actor.stop()' is invoked.
*/
override def postStop {}
@ -1050,7 +1050,7 @@ private[akka] object AspectInitRegistry extends ListenerManagement {
val init = if (proxy ne null) initializations.remove(proxy) else null
if (init ne null) {
notifyListeners(AspectInitUnregistered(proxy, init))
init.actorRef.stop
init.actorRef.stop()
}
init
}

View file

@ -135,7 +135,7 @@ class TypedActorSpec extends
val typedActors2 = Actor.registry.typedActorsFor("my-custom-id")
assert(typedActors2.length === 1)
assert(typedActors2.contains(pojo))
actorRef.stop
actorRef.stop()
}
it("should support to filter typed actors") {