Skip to content

Commit

Permalink
restored step1
Browse files Browse the repository at this point in the history
  • Loading branch information
vheaffinitech committed Mar 28, 2016
1 parent f42c57d commit b6d4480
Show file tree
Hide file tree
Showing 24 changed files with 49 additions and 101 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
project/*
target/*
**/project/*
**/target/*
36 changes: 6 additions & 30 deletions step1/main.scala
Original file line number Diff line number Diff line change
@@ -1,45 +1,21 @@
import akka.actor.Actor
import akka.actor.ActorSystem
import akka.actor.Props
import scala.concurrent.Await
import scala.concurrent.Future
import akka.pattern.ask
import akka.util.Timeout
import scala.concurrent.duration._

// using Ask & Future

case object StopMsg;
case class Msg(text : String)

class HelloActor extends Actor {
def receive = {
case Msg(t) => {
if (t == "hello") sender ! s" $t back to you"
else sender ! s" does '$t' mean hello ?"
}
case StopMsg => context.stop(self)
case _ => sender ! " huh?"
case "hello" => println("hello back at you")
case _ => println("huh?")
}
}

object Main extends App {
val system = ActorSystem("HelloSystem")
// default Actor constructor
val helloActor = system.actorOf(Props[HelloActor], name = "helloactor")
helloActor ! "hello"
helloActor ! "bonjour"

implicit val timeout = Timeout(5 seconds)

val future = helloActor ? Msg("hello")
//val result = Await.result(future, timeout.duration).asInstanceOf[String]
val result = Await.result(future, 1 second).asInstanceOf[String]
println(result)

//another way
val future2: Future[String] = ask(helloActor, Msg("bonjour")).mapTo[String]
val result2 = Await.result(future2, 1 second)
println(result2)

helloActor ! StopMsg
Thread.sleep(5L)
Thread.sleep(1000L)
system.shutdown()
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#hello-test-1#hello-test-1_2.11;1.0 resolved revisions
#Sun Mar 27 22:55:15 CEST 2016
#Mon Mar 28 19:42:35 CEST 2016
+organisation\:\#@\#\:+org.scala-lang\:\#@\#\:+branch\:\#@\#\:+@\#\:NULL\:\#@\:\#@\#\:+module\:\#@\#\:+scala-library\:\#@\#\:+revision\:\#@\#\:+2.11.7\:\#@\#\:=2.11.7 ? 2.11.7 null
+organisation\:\#@\#\:+com.typesafe.akka\:\#@\#\:+branch\:\#@\#\:+@\#\:NULL\:\#@\:\#@\#\:+module\:\#@\#\:+akka-actor_2.11\:\#@\#\:+revision\:\#@\#\:+2.3.9\:\#@\#\:=2.3.9 release 2.3.9 null
+organisation\:\#@\#\:+org.scala-lang\:\#@\#\:+branch\:\#@\#\:+@\#\:NULL\:\#@\:\#@\#\:+module\:\#@\#\:+scala-compiler\:\#@\#\:+revision\:\#@\#\:+2.11.7\:\#@\#\:=2.11.7 release 2.11.7 null
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
module="hello-test-1_2.11"
revision="1.0"
status="integration"
publication="20160327225515"
publication="20160328194234"
>
<description>
Hello Test #1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
revision="1.0"
conf="compile-internal"
confs="compile, runtime, test, provided, optional, compile-internal, runtime-internal, test-internal, plugin, sources, docs, pom, scala-tool"
date="20160327225515"/>
date="20160328194234"/>
<dependencies>
<module organisation="com.typesafe.akka" name="akka-actor_2.11">
<revision name="2.3.9" status="release" pubdate="20150120011810" resolver="sbt-chain" artresolver="sbt-chain" homepage="http://akka.io/" downloaded="false" searched="false" default="false" conf="default, compile, runtime, default(compile), master" position="1">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
revision="1.0"
conf="compile"
confs="compile, runtime, test, provided, optional, compile-internal, runtime-internal, test-internal, plugin, sources, docs, pom, scala-tool"
date="20160327225515"/>
date="20160328194234"/>
<dependencies>
<module organisation="com.typesafe.akka" name="akka-actor_2.11">
<revision name="2.3.9" status="release" pubdate="20150120011810" resolver="sbt-chain" artresolver="sbt-chain" homepage="http://akka.io/" downloaded="false" searched="false" default="false" conf="default, compile, runtime, default(compile), master" position="1">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
revision="1.0"
conf="docs"
confs="compile, runtime, test, provided, optional, compile-internal, runtime-internal, test-internal, plugin, sources, docs, pom, scala-tool"
date="20160327225515"/>
date="20160328194234"/>
<dependencies>
</dependencies>
</ivy-report>
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
revision="1.0"
conf="optional"
confs="compile, runtime, test, provided, optional, compile-internal, runtime-internal, test-internal, plugin, sources, docs, pom, scala-tool"
date="20160327225515"/>
date="20160328194234"/>
<dependencies>
</dependencies>
</ivy-report>
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
revision="1.0"
conf="plugin"
confs="compile, runtime, test, provided, optional, compile-internal, runtime-internal, test-internal, plugin, sources, docs, pom, scala-tool"
date="20160327225515"/>
date="20160328194234"/>
<dependencies>
</dependencies>
</ivy-report>
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
revision="1.0"
conf="pom"
confs="compile, runtime, test, provided, optional, compile-internal, runtime-internal, test-internal, plugin, sources, docs, pom, scala-tool"
date="20160327225515"/>
date="20160328194234"/>
<dependencies>
</dependencies>
</ivy-report>
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
revision="1.0"
conf="provided"
confs="compile, runtime, test, provided, optional, compile-internal, runtime-internal, test-internal, plugin, sources, docs, pom, scala-tool"
date="20160327225515"/>
date="20160328194234"/>
<dependencies>
</dependencies>
</ivy-report>
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
revision="1.0"
conf="runtime-internal"
confs="compile, runtime, test, provided, optional, compile-internal, runtime-internal, test-internal, plugin, sources, docs, pom, scala-tool"
date="20160327225515"/>
date="20160328194234"/>
<dependencies>
<module organisation="com.typesafe.akka" name="akka-actor_2.11">
<revision name="2.3.9" status="release" pubdate="20150120011810" resolver="sbt-chain" artresolver="sbt-chain" homepage="http://akka.io/" downloaded="false" searched="false" default="false" conf="default, compile, runtime, default(compile), master" position="1">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
revision="1.0"
conf="runtime"
confs="compile, runtime, test, provided, optional, compile-internal, runtime-internal, test-internal, plugin, sources, docs, pom, scala-tool"
date="20160327225515"/>
date="20160328194234"/>
<dependencies>
<module organisation="com.typesafe.akka" name="akka-actor_2.11">
<revision name="2.3.9" status="release" pubdate="20150120011810" resolver="sbt-chain" artresolver="sbt-chain" homepage="http://akka.io/" downloaded="false" searched="false" default="false" conf="default, compile, runtime, default(compile), master" position="1">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
revision="1.0"
conf="scala-tool"
confs="compile, runtime, test, provided, optional, compile-internal, runtime-internal, test-internal, plugin, sources, docs, pom, scala-tool"
date="20160327225515"/>
date="20160328194234"/>
<dependencies>
<module organisation="org.scala-lang" name="scala-compiler">
<revision name="2.11.7" status="release" pubdate="20150622221819" resolver="sbt-chain" artresolver="sbt-chain" homepage="http://www.scala-lang.org/" downloaded="false" searched="false" default="false" conf="default, compile, runtime, optional, optional(default), master" position="0">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
revision="1.0"
conf="sources"
confs="compile, runtime, test, provided, optional, compile-internal, runtime-internal, test-internal, plugin, sources, docs, pom, scala-tool"
date="20160327225515"/>
date="20160328194234"/>
<dependencies>
</dependencies>
</ivy-report>
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
revision="1.0"
conf="test-internal"
confs="compile, runtime, test, provided, optional, compile-internal, runtime-internal, test-internal, plugin, sources, docs, pom, scala-tool"
date="20160327225515"/>
date="20160328194234"/>
<dependencies>
<module organisation="com.typesafe.akka" name="akka-actor_2.11">
<revision name="2.3.9" status="release" pubdate="20150120011810" resolver="sbt-chain" artresolver="sbt-chain" homepage="http://akka.io/" downloaded="false" searched="false" default="false" conf="default, compile, runtime, default(compile), master" position="1">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
revision="1.0"
conf="test"
confs="compile, runtime, test, provided, optional, compile-internal, runtime-internal, test-internal, plugin, sources, docs, pom, scala-tool"
date="20160327225515"/>
date="20160328194234"/>
<dependencies>
<module organisation="com.typesafe.akka" name="akka-actor_2.11">
<revision name="2.3.9" status="release" pubdate="20150120011810" resolver="sbt-chain" artresolver="sbt-chain" homepage="http://akka.io/" downloaded="false" searched="false" default="false" conf="default, compile, runtime, default(compile), master" position="1">
Expand Down
Binary file not shown.
Binary file modified step1/target/scala-2.11/classes/Main$.class
Binary file not shown.
6 changes: 3 additions & 3 deletions step1/target/streams/$global/update/$global/streams/out
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
[debug] == resolving dependencies for hello-test-1#hello-test-1_2.11;1.0 [compile]
[debug] == resolving dependencies hello-test-1#hello-test-1_2.11;1.0->org.scala-lang#scala-library;2.11.7 [compile->default(compile)]
[info] Resolving org.scala-lang#scala-library;2.11.7 ...
[debug] sbt-chain: Checking cache for: sbt.ivyint.MergedDescriptors@5c249576
[debug] sbt-chain: Checking cache for: sbt.ivyint.MergedDescriptors@3a3ad3ae
[debug] sbt-chain: module revision found in cache: org.scala-lang#scala-library;2.11.7
[debug]  found org.scala-lang#scala-library;2.11.7 in sbt-chain
[debug]  [2.11.7] org.scala-lang#scala-library;2.11.7
Expand Down Expand Up @@ -260,7 +260,7 @@
[debug]  [NOT REQUIRED] org.scala-lang.modules#scala-xml_2.11;1.0.4!scala-xml_2.11.jar(bundle)
[debug]  [NOT REQUIRED] org.scala-lang.modules#scala-parser-combinators_2.11;1.0.4!scala-parser-combinators_2.11.jar(bundle)
[debug]  [NOT REQUIRED] jline#jline;2.12.1!jline.jar
[debug] :: resolution report :: resolve 478ms :: artifacts dl 19ms
[debug] :: resolution report :: resolve 550ms :: artifacts dl 24ms
[debug]  report for hello-test-1#hello-test-1_2.11;1.0 compile produced in /Users/vheuschling/WORK/akka-playground/step1/target/resolution-cache/reports/hello-test-1-hello-test-1_2.11-compile.xml
[debug]  report for hello-test-1#hello-test-1_2.11;1.0 runtime produced in /Users/vheuschling/WORK/akka-playground/step1/target/resolution-cache/reports/hello-test-1-hello-test-1_2.11-runtime.xml
[debug]  report for hello-test-1#hello-test-1_2.11;1.0 test produced in /Users/vheuschling/WORK/akka-playground/step1/target/resolution-cache/reports/hello-test-1-hello-test-1_2.11-test.xml
Expand All @@ -274,5 +274,5 @@
[debug]  report for hello-test-1#hello-test-1_2.11;1.0 docs produced in /Users/vheuschling/WORK/akka-playground/step1/target/resolution-cache/reports/hello-test-1-hello-test-1_2.11-docs.xml
[debug]  report for hello-test-1#hello-test-1_2.11;1.0 pom produced in /Users/vheuschling/WORK/akka-playground/step1/target/resolution-cache/reports/hello-test-1-hello-test-1_2.11-pom.xml
[debug]  report for hello-test-1#hello-test-1_2.11;1.0 scala-tool produced in /Users/vheuschling/WORK/akka-playground/step1/target/resolution-cache/reports/hello-test-1-hello-test-1_2.11-scala-tool.xml
[debug]  resolve done (478ms resolve - 19ms download)
[debug]  resolve done (550ms resolve - 24ms download)
[info] Done updating.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[debug] 
[debug] Initial source changes: 
[debug]  removed:Set()
[debug]  added: Set(/Users/vheuschling/WORK/akka-playground/step1/main.scala)
[debug]  modified: Set()
[debug]  added: Set()
[debug]  modified: Set(/Users/vheuschling/WORK/akka-playground/step1/main.scala)
[debug] Removed products: Set()
[debug] External API changes: API Changes: Set()
[debug] Modified binary dependencies: Set()
Expand All @@ -17,20 +17,13 @@
[info] Compiling 1 Scala source to /Users/vheuschling/WORK/akka-playground/step1/target/scala-2.11/classes...
[debug] Getting compiler-interface from component compiler for Scala 2.11.7
[debug] Getting compiler-interface from component compiler for Scala 2.11.7
[debug] Running cached compiler 7b1b95d7, interfacing (CompilerInterface) with Scala compiler version 2.11.7
[debug] Running cached compiler 1d3525d, interfacing (CompilerInterface) with Scala compiler version 2.11.7
[debug] Calling Scala compiler with arguments (CompilerInterface):
[debug]  -bootclasspath
[debug]  /Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/jre/lib/sunrsasign.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/jre/classes:/Users/vheuschling/.ivy2/cache/org.scala-lang/scala-library/jars/scala-library-2.11.7.jar
[debug]  -classpath
[debug]  /Users/vheuschling/WORK/akka-playground/step1/target/scala-2.11/classes:/Users/vheuschling/.ivy2/cache/com.typesafe.akka/akka-actor_2.11/jars/akka-actor_2.11-2.3.9.jar:/Users/vheuschling/.ivy2/cache/com.typesafe/config/bundles/config-1.2.1.jar
[debug] Scala compilation took 5.499609588 s
[debug] Invalidating /Users/vheuschling/WORK/akka-playground/step1/main.scala...
[debug] Invalidating (transitively) by inheritance from /Users/vheuschling/WORK/akka-playground/step1/main.scala...
[debug] Initial set of included nodes: Set(/Users/vheuschling/WORK/akka-playground/step1/main.scala)
[debug] Invalidated by transitive inheritance dependency: Set(/Users/vheuschling/WORK/akka-playground/step1/main.scala)
[debug] The /Users/vheuschling/WORK/akka-playground/step1/main.scala source file has the following implicit definitions changed:
[debug]  self, context.
[debug] All member reference dependencies will be considered within this context.
[debug] Scala compilation took 4.582446472 s
[debug] New invalidations:
[debug]  Set()
[debug] Initial set of included nodes: Set()
Expand Down
Loading

0 comments on commit b6d4480

Please sign in to comment.