Created
October 12, 2016 12:18
-
-
Save jorgeuriarte/badab813996c241e521d35c1ea3f9f6a to your computer and use it in GitHub Desktop.
Ejemplo de contexto de closures arrastrado en Groovy
This file contains hidden or 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
@Grab("io.vertx:vertx-core:3.3.3") | |
import io.vertx.core.Vertx | |
def schedulerId | |
def vertx = Vertx.vertx() | |
(1..10).each { it -> | |
vertx.setTimer(2000, { | |
println """ | |
Hola, este es ${schedulerId} | |
""" | |
}) | |
sleep(500) | |
schedulerId = it | |
println "schedulerId <= ${it}" | |
} |
Author
jorgeuriarte
commented
Oct 12, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment