Permalink
Browse files

Added a println line to get the current Thread

  • Loading branch information...
1 parent 4fda13a commit 26d3ef167b44aeb154a4715c3d4847ae7dc71924 @felipeg48 committed Sep 11, 2011
Showing with 8 additions and 6 deletions.
  1. +8 −6 src/async/AsyncExample.groovy
@@ -8,20 +8,22 @@ class Sample{
@Async
def expensiveMethod(){
+ println "[${Thread.currentThread()}] Started expensiveMethod"
sleep 15000
- println "[New Thread] Finished expensiveMethod..."
+ println "[${Thread.currentThread()}] Finished expensiveMethod..."
}
@Async
- def other(){
+ def otherMethod(){
+ println "[${Thread.currentThread()}] Started otherMethod"
sleep 5000
- println "[Another Thread] Hello"
+ println "[${Thread.currentThread()}] Finished otherMethod"
}
}
-println "[Main] Start"
+println "[${Thread.currentThread()}] Start"
def sample = new Sample(name:"Felipe",phone:"1800-GROOVY")
sample.expensiveMethod()
-sample.other()
-println "[Main] Finished"
+sample.otherMethod()
+println "[${Thread.currentThread()}] Finished"

0 comments on commit 26d3ef1

Please sign in to comment.