Added parens to override of preStart and postStop
This commit is contained in:
parent
d0447c76cb
commit
bce7d176f4
18 changed files with 36 additions and 36 deletions
|
|
@ -78,7 +78,7 @@ object Chameneos {
|
|||
var sumMeetings = 0
|
||||
var numFaded = 0
|
||||
|
||||
override def preStart = {
|
||||
override def preStart() = {
|
||||
for (i <- 0 until numChameneos) actorOf(new Chameneo(self, colours(i % 3), i))
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ class RestartStrategySpec extends JUnitSuite {
|
|||
secondRestartLatch.open
|
||||
}
|
||||
|
||||
override def postStop = {
|
||||
override def postStop() = {
|
||||
stopLatch.open
|
||||
}
|
||||
})
|
||||
|
|
@ -131,7 +131,7 @@ class RestartStrategySpec extends JUnitSuite {
|
|||
thirdRestartLatch.open
|
||||
}
|
||||
|
||||
override def postStop = {
|
||||
override def postStop() = {
|
||||
if (restartLatch.isOpen) {
|
||||
secondRestartLatch.open
|
||||
}
|
||||
|
|
@ -189,7 +189,7 @@ class RestartStrategySpec extends JUnitSuite {
|
|||
secondRestartLatch.open
|
||||
}
|
||||
|
||||
override def postStop = {
|
||||
override def postStop() = {
|
||||
stopLatch.open
|
||||
}
|
||||
})
|
||||
|
|
@ -243,7 +243,7 @@ class RestartStrategySpec extends JUnitSuite {
|
|||
restartLatch.open
|
||||
}
|
||||
|
||||
override def postStop = {
|
||||
override def postStop() = {
|
||||
stopLatch.open
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ object Ticket669Spec {
|
|||
self.reply_?("failure1")
|
||||
}
|
||||
|
||||
override def postStop {
|
||||
override def postStop() {
|
||||
self.reply_?("failure2")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -88,14 +88,14 @@ abstract class UntypedActor extends Actor {
|
|||
* <p/>
|
||||
* Is called when an Actor is started by invoking 'actor.start()'.
|
||||
*/
|
||||
override def preStart {}
|
||||
override def preStart() {}
|
||||
|
||||
/**
|
||||
* User overridable callback.
|
||||
* <p/>
|
||||
* Is called when 'actor.stop()' is invoked.
|
||||
*/
|
||||
override def postStop {}
|
||||
override def postStop() {}
|
||||
|
||||
/**
|
||||
* User overridable callback.
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ trait DefaultActorPool extends ActorPool { this: Actor =>
|
|||
private var _lastCapacityChange = 0
|
||||
private var _lastSelectorCount = 0
|
||||
|
||||
override def postStop = _delegates foreach {
|
||||
override def postStop() = _delegates foreach {
|
||||
delegate => try {
|
||||
delegate ! PoisonPill
|
||||
} catch { case e: Exception => } //Ignore any exceptions here
|
||||
|
|
|
|||
|
|
@ -91,11 +91,11 @@ object Pi extends App {
|
|||
}
|
||||
//#master-receive
|
||||
|
||||
override def preStart {
|
||||
override def preStart() {
|
||||
start = now
|
||||
}
|
||||
|
||||
override def postStop {
|
||||
override def postStop() {
|
||||
// tell the world that the calculation is complete
|
||||
println(
|
||||
"\n\tPi estimate: \t\t%s\n\tCalculation time: \t%s millis"
|
||||
|
|
|
|||
|
|
@ -307,11 +307,11 @@ Here is the master actor::
|
|||
|
||||
def receive = { ... }
|
||||
|
||||
override def preStart {
|
||||
override def preStart() {
|
||||
start = System.currentTimeMillis
|
||||
}
|
||||
|
||||
override def postStop {
|
||||
override def postStop() {
|
||||
// tell the world that the calculation is complete
|
||||
println(
|
||||
"\n\tPi estimate: \t\t%s\n\tCalculation time: \t%s millis"
|
||||
|
|
|
|||
|
|
@ -291,11 +291,11 @@ Here is the master actor::
|
|||
|
||||
def receive = { ... }
|
||||
|
||||
override def preStart {
|
||||
override def preStart() {
|
||||
start = System.currentTimeMillis
|
||||
}
|
||||
|
||||
override def postStop {
|
||||
override def postStop() {
|
||||
// tell the world that the calculation is complete
|
||||
println(
|
||||
"\n\tPi estimate: \t\t%s\n\tCalculation time: \t%s millis"
|
||||
|
|
@ -451,11 +451,11 @@ But before we package it up and run it, let's take a look at the full code now,
|
|||
if (nrOfResults == nrOfMessages) self.stop()
|
||||
}
|
||||
|
||||
override def preStart {
|
||||
override def preStart() {
|
||||
start = System.currentTimeMillis
|
||||
}
|
||||
|
||||
override def postStop {
|
||||
override def postStop() {
|
||||
// tell the world that the calculation is complete
|
||||
println(
|
||||
"\n\tPi estimate: \t\t%s\n\tCalculation time: \t%s millis"
|
||||
|
|
|
|||
|
|
@ -316,7 +316,7 @@ Supervised actors have the option to reply to the initial sender within preResta
|
|||
self.reply_?(reason.getMessage)
|
||||
}
|
||||
|
||||
override def postStop {
|
||||
override def postStop() {
|
||||
self.reply_?("stopped by supervisor")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -269,7 +269,7 @@ Finally, bind the *handleHttpRequest* function of the *Endpoint* trait to the ac
|
|||
//
|
||||
// this is where you want attach your endpoint hooks
|
||||
//
|
||||
override def preStart = {
|
||||
override def preStart() = {
|
||||
//
|
||||
// we expect there to be one root and that it's already been started up
|
||||
// obviously there are plenty of other ways to obtaining this actor
|
||||
|
|
@ -397,7 +397,7 @@ As noted above, hook functions are non-exclusive. This means multiple actors can
|
|||
//
|
||||
// this is where you want attach your endpoint hooks
|
||||
//
|
||||
override def preStart = {
|
||||
override def preStart() = {
|
||||
//
|
||||
// we expect there to be one root and that it's already been started up
|
||||
// obviously there are plenty of other ways to obtaining this actor
|
||||
|
|
|
|||
|
|
@ -221,7 +221,7 @@ I'll try to show you how we can make use Scala's mixins to decouple the Actor im
|
|||
protected def sessionManagement: Receive
|
||||
protected def shutdownSessions(): Unit
|
||||
|
||||
override def postStop = {
|
||||
override def postStop() = {
|
||||
EventHandler.info(this, "Chat server is shutting down...")
|
||||
shutdownSessions
|
||||
self.unlink(storage)
|
||||
|
|
@ -422,7 +422,7 @@ We have now created the full functionality for the chat server, all nicely decou
|
|||
SessionManagement with
|
||||
ChatManagement with
|
||||
MemoryChatStorageFactory {
|
||||
override def preStart = {
|
||||
override def preStart() = {
|
||||
remote.start("localhost", 2552);
|
||||
remote.register("chat:service", self) //Register the actor with the specified service id
|
||||
}
|
||||
|
|
|
|||
|
|
@ -385,7 +385,7 @@ When you start the ``Actor`` then it will automatically call the ``def preStart`
|
|||
|
||||
.. code-block:: scala
|
||||
|
||||
override def preStart = {
|
||||
override def preStart() = {
|
||||
... // initialization code
|
||||
}
|
||||
|
||||
|
|
@ -402,7 +402,7 @@ When stop is called then a call to the ``def postStop`` callback method will tak
|
|||
|
||||
.. code-block:: scala
|
||||
|
||||
override def postStop = {
|
||||
override def postStop() = {
|
||||
... // clean up resources
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -269,7 +269,7 @@ class RootEndpoint extends Actor with Endpoint {
|
|||
// adopt the configured id
|
||||
if (RootActorBuiltin) self.id = RootActorID
|
||||
|
||||
override def preStart =
|
||||
override def preStart() =
|
||||
_attachments = Tuple2((uri: String) => {uri eq Root}, (uri: String) => this.actor) :: _attachments
|
||||
|
||||
def recv: Receive = {
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@ object ServerInitiatedRemoteSessionActorSpec {
|
|||
|
||||
class RemoteStatefullSessionActorSpec extends Actor {
|
||||
|
||||
override def preStart = instantiatedSessionActors.add(self)
|
||||
override def postStop = instantiatedSessionActors.remove(self)
|
||||
override def preStart() = instantiatedSessionActors.add(self)
|
||||
override def postStop() = instantiatedSessionActors.remove(self)
|
||||
var user: String = "anonymous"
|
||||
|
||||
def receive = {
|
||||
|
|
|
|||
|
|
@ -186,7 +186,7 @@
|
|||
protected def sessionManagement: Receive
|
||||
protected def shutdownSessions(): Unit
|
||||
|
||||
override def postStop = {
|
||||
override def postStop() = {
|
||||
EventHandler.info(this, "Chat server is shutting down...")
|
||||
shutdownSessions
|
||||
self.unlink(storage)
|
||||
|
|
@ -206,7 +206,7 @@
|
|||
SessionManagement with
|
||||
ChatManagement with
|
||||
MemoryChatStorageFactory {
|
||||
override def preStart = {
|
||||
override def preStart() = {
|
||||
remote.start("localhost", 2552);
|
||||
remote.register("chat:service", self) //Register the actor with the specified service id
|
||||
}
|
||||
|
|
|
|||
|
|
@ -104,11 +104,11 @@ object Pi extends App {
|
|||
if (nrOfResults == nrOfMessages) self.stop()
|
||||
}
|
||||
|
||||
override def preStart {
|
||||
override def preStart() {
|
||||
start = System.currentTimeMillis
|
||||
}
|
||||
|
||||
override def postStop {
|
||||
override def postStop() {
|
||||
// tell the world that the calculation is complete
|
||||
println(
|
||||
"\n\tPi estimate: \t\t%s\n\tCalculation time: \t%s millis"
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ object Pi extends App {
|
|||
def receive = scatter
|
||||
|
||||
// when we are stopped, stop our team of workers and our router
|
||||
override def postStop {
|
||||
override def postStop() {
|
||||
// send a PoisonPill to all workers telling them to shut down themselves
|
||||
router ! Broadcast(PoisonPill)
|
||||
// send a PoisonPill to the router, telling him to shut himself down
|
||||
|
|
|
|||
|
|
@ -83,11 +83,11 @@ import scala.reflect.BeanProperty
|
|||
*
|
||||
* def square(x: Int): Future[Integer] = future(x * x)
|
||||
*
|
||||
* override def preStart = {
|
||||
* override def preStart() = {
|
||||
* ... // optional initialization on start
|
||||
* }
|
||||
*
|
||||
* override def postStop = {
|
||||
* override def postStop() = {
|
||||
* ... // optional cleanup on stop
|
||||
* }
|
||||
*
|
||||
|
|
@ -160,14 +160,14 @@ abstract class TypedActor extends Actor with Proxyable {
|
|||
* <p/>
|
||||
* Is called when an Actor is started by invoking 'actor.start()'.
|
||||
*/
|
||||
override def preStart {}
|
||||
override def preStart() {}
|
||||
|
||||
/**
|
||||
* User overridable callback.
|
||||
* <p/>
|
||||
* Is called when 'actor.stop()' is invoked.
|
||||
*/
|
||||
override def postStop {}
|
||||
override def postStop() {}
|
||||
|
||||
/**
|
||||
* User overridable callback.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue