Remove procedure syntax (#25362)
This commit is contained in:
parent
50979d599c
commit
5b3b191bac
180 changed files with 403 additions and 403 deletions
|
|
@ -123,13 +123,13 @@ class ActorWithMessagesWrapper {
|
|||
class Hook extends Actor {
|
||||
var child: ActorRef = _
|
||||
//#preStart
|
||||
override def preStart() {
|
||||
override def preStart(): Unit = {
|
||||
child = context.actorOf(Props[MyActor], "child")
|
||||
}
|
||||
//#preStart
|
||||
def receive = Actor.emptyBehavior
|
||||
//#postStop
|
||||
override def postStop() {
|
||||
override def postStop(): Unit = {
|
||||
//#clean-up-some-resources
|
||||
()
|
||||
//#clean-up-some-resources
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ class FSMDocSpec extends MyFavoriteTestFrameWorkPlusAkkaTestKit {
|
|||
//#alt-transition-syntax
|
||||
onTransition(handler _)
|
||||
|
||||
def handler(from: StateType, to: StateType) {
|
||||
def handler(from: StateType, to: StateType): Unit = {
|
||||
// handle it here ...
|
||||
}
|
||||
//#alt-transition-syntax
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ class CounterService extends Actor {
|
|||
|
||||
import context.dispatcher // Use this Actors' Dispatcher as ExecutionContext
|
||||
|
||||
override def preStart() {
|
||||
override def preStart(): Unit = {
|
||||
initStorage()
|
||||
}
|
||||
|
||||
|
|
@ -159,7 +159,7 @@ class CounterService extends Actor {
|
|||
* failing. When it has been stopped we will schedule a Reconnect after a delay.
|
||||
* Watch the child so we receive Terminated message when it has been terminated.
|
||||
*/
|
||||
def initStorage() {
|
||||
def initStorage(): Unit = {
|
||||
storage = Some(context.watch(context.actorOf(Props[Storage], name = "storage")))
|
||||
// Tell the counter, if any, to use the new storage
|
||||
counter foreach { _ ! UseStorage(storage) }
|
||||
|
|
@ -197,7 +197,7 @@ class CounterService extends Actor {
|
|||
initStorage()
|
||||
}
|
||||
|
||||
def forwardOrPlaceInBacklog(msg: Any) {
|
||||
def forwardOrPlaceInBacklog(msg: Any): Unit = {
|
||||
// We need the initial value from storage before we can start delegate to
|
||||
// the counter. Before that we place the messages in a backlog, to be sent
|
||||
// to the counter when it is initialized.
|
||||
|
|
@ -246,7 +246,7 @@ class Counter(key: String, initialValue: Long) extends Actor {
|
|||
|
||||
}
|
||||
|
||||
def storeCount() {
|
||||
def storeCount(): Unit = {
|
||||
// Delegate dangerous work, to protect our valuable state.
|
||||
// We can continue without storage.
|
||||
storage foreach { _ ! Store(Entry(key, count)) }
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ object FaultHandlingDocSpec {
|
|||
case p: Props ⇒ sender() ! context.actorOf(p)
|
||||
}
|
||||
// override default to kill all children during restart
|
||||
override def preRestart(cause: Throwable, msg: Option[Any]) {}
|
||||
override def preRestart(cause: Throwable, msg: Option[Any]): Unit = {}
|
||||
}
|
||||
//#supervisor2
|
||||
|
||||
|
|
@ -113,7 +113,7 @@ class FaultHandlingDocSpec(_system: ActorSystem) extends TestKit(_system)
|
|||
}
|
||||
""")))
|
||||
|
||||
override def afterAll {
|
||||
override def afterAll: Unit = {
|
||||
TestKit.shutdownActorSystem(system)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,11 +22,11 @@ class UnnestedReceives extends Actor {
|
|||
//This message processes a message/event
|
||||
def process(msg: Any): Unit = println("processing: " + msg)
|
||||
//This method subscribes the actor to the event bus
|
||||
def subscribe() {} //Your external stuff
|
||||
def subscribe(): Unit = {} //Your external stuff
|
||||
//This method retrieves all prior messages/events
|
||||
def allOldMessages() = List()
|
||||
|
||||
override def preStart {
|
||||
override def preStart: Unit = {
|
||||
//We override preStart to be sure that the first message the actor gets is
|
||||
//'Replay, that message will start to be processed _after_ the actor is started
|
||||
self ! 'Replay
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ object CustomRoute {
|
|||
|
||||
class CustomRouteBuilder(system: ActorSystem, responder: ActorRef)
|
||||
extends RouteBuilder {
|
||||
def configure {
|
||||
def configure: Unit = {
|
||||
from("jetty:http://localhost:8877/camel/custom").to(responder)
|
||||
}
|
||||
}
|
||||
|
|
@ -52,7 +52,7 @@ object CustomRoute {
|
|||
override def onRouteDefinition = (rd) ⇒ rd.onException(classOf[Exception]).
|
||||
handled(true).transform(Builder.exceptionMessage).end
|
||||
|
||||
final override def preRestart(reason: Throwable, message: Option[Any]) {
|
||||
final override def preRestart(reason: Throwable, message: Option[Any]): Unit = {
|
||||
sender() ! Failure(reason)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ object Producers {
|
|||
class Forwarder(uri: String, target: ActorRef) extends Actor with Producer {
|
||||
def endpointUri = uri
|
||||
|
||||
override def routeResponse(msg: Any) { target forward msg }
|
||||
override def routeResponse(msg: Any): Unit = { target forward msg }
|
||||
}
|
||||
val system = ActorSystem("some-system")
|
||||
val receiver = system.actorOf(Props[ResponseReceiver])
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ object MyUnboundedMailbox {
|
|||
def dequeue(): Envelope = queue.poll()
|
||||
def numberOfMessages: Int = queue.size
|
||||
def hasMessages: Boolean = !queue.isEmpty
|
||||
def cleanUp(owner: ActorRef, deadLetters: MessageQueue) {
|
||||
def cleanUp(owner: ActorRef, deadLetters: MessageQueue): Unit = {
|
||||
while (hasMessages) {
|
||||
deadLetters.enqueue(owner, dequeue())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ object LoggingDocSpec {
|
|||
override def preStart() = {
|
||||
log.debug("Starting")
|
||||
}
|
||||
override def preRestart(reason: Throwable, message: Option[Any]) {
|
||||
override def preRestart(reason: Throwable, message: Option[Any]): Unit = {
|
||||
log.error(reason, "Restarting due to [{}] when processing [{}]",
|
||||
reason.getMessage, message.getOrElse(""))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ final case class Inet6ProtocolFamily() extends DatagramChannelCreator {
|
|||
|
||||
//#multicast-group
|
||||
final case class MulticastGroup(address: String, interface: String) extends SocketOptionV2 {
|
||||
override def afterBind(s: DatagramSocket) {
|
||||
override def afterBind(s: DatagramSocket): Unit = {
|
||||
val group = InetAddress.getByName(address)
|
||||
val networkInterface = NetworkInterface.getByName(interface)
|
||||
s.getChannel.join(group, networkInterface)
|
||||
|
|
|
|||
|
|
@ -234,12 +234,12 @@ object PersistenceTCKDoc {
|
|||
new File(system.settings.config.getString("akka.persistence.journal.leveldb.dir")),
|
||||
new File(config.getString("akka.persistence.snapshot-store.local.dir")))
|
||||
|
||||
override def beforeAll() {
|
||||
override def beforeAll(): Unit = {
|
||||
super.beforeAll()
|
||||
storageLocations foreach FileUtils.deleteRecursively
|
||||
}
|
||||
|
||||
override def afterAll() {
|
||||
override def afterAll(): Unit = {
|
||||
storageLocations foreach FileUtils.deleteRecursively
|
||||
super.afterAll()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ class RemoteDeploymentDocSpec extends AkkaSpec("""
|
|||
val other = ActorSystem("remote", system.settings.config)
|
||||
val address = other.asInstanceOf[ExtendedActorSystem].provider.getExternalAddressFor(Address("akka.tcp", "s", "host", 1)).get
|
||||
|
||||
override def afterTermination() { shutdown(other) }
|
||||
override def afterTermination(): Unit = { shutdown(other) }
|
||||
|
||||
"demonstrate programmatic deployment" in {
|
||||
//#deploy
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ class MySpec() extends TestKit(ActorSystem("MySpec")) with ImplicitSender
|
|||
with WordSpecLike with Matchers with BeforeAndAfterAll {
|
||||
//#implicit-sender
|
||||
|
||||
override def afterAll {
|
||||
override def afterAll: Unit = {
|
||||
TestKit.shutdownActorSystem(system)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ class TestKitUsageSpec
|
|||
val seqRef =
|
||||
system.actorOf(Props(classOf[SequencingActor], testActor, headList, tailList))
|
||||
|
||||
override def afterAll {
|
||||
override def afterAll: Unit = {
|
||||
shutdown()
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue