Created
May 26, 2015 12:51
-
-
Save tmclnk/324727f1d1cb85d738e9 to your computer and use it in GitHub Desktop.
GPARS Dynamic Dispatch DSL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import groovyx.gpars.actor.* | |
import org.codehaus.groovy.runtime.NullObject | |
import groovy.time.TimeCategory | |
DynamicDispatchActor actor = Actors.messageHandler { | |
when { String name -> | |
println "Nice to meet you $name" | |
} | |
when { Integer age -> | |
println "You look younger than $age" | |
} | |
} | |
actor << "Mario" | |
actor << 37 | |
actor.join() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment