Ho scritto una Groovy MainApp con main (args).Come eseguire vert.x embedded?
All'avvio, la JVM esce direttamente ("Fine esecuzione JVM!").
import org.vertx.groovy.core.Vertx
class MainApp {
public static void main(String[] args) {
Vertx vertx = VertxFactory.newVertx();
vertx.createHttpServer().requestHandler{ request ->
println "A request has arrived on the server!"
}.listen(8080)
println "End of JVM execution !"
}
}
Come per funzionare correttamente un server HTTP integrato con vert.x?
Di fronte a questo, sembra che il vertx non abbia il tempo di avviarsi in modalità non cluster e jvm si ferma prima. L'ho risolto con 'TimeUnit.SECONDS.sleep (1);' alla fine: https://gist.github.com/yetanothercoder/21a2b47b686d902c5fee – yetanothercoder
@yetanothercoder qualsiasi motivo per non usare '.wait' /' .notify' ? – user7610