Using vertx with desktop UI frameworks (swing/javaFX)

538 views
Skip to first unread message

Bogdan Mart

unread,
Jun 19, 2016, 6:43:42 AM6/19/16
to vert.x
Hello, I would like to make fat client desktop application, for REST api implemented in vertx, and I want to reuse as much code as I can, so I would like to use Vertx on client side.

My question is, how I can make Vertx event loop to work together with Swing/JavaFX event loop, as UI interractions are made from speciall GUI thread, and I'd like my vertx callback to be called from that same thread.

Otherwise, after receiving data from server I'd have to call Platform.runLater in JavaFX and  SwingUtilities.invokeLater in SWING app.

Actually I'm more concerned with JavaFX, but SWING would be a plus, anyway it's "Main thread" concept is pretty the same.

Bogdan Mart

unread,
Jun 19, 2016, 6:51:43 AM6/19/16
to vert.x
Or it would be bother to not mix thing up, and use UI thread separately?

воскресенье, 19 июня 2016 г., 13:43:42 UTC+3 пользователь Bogdan Mart написал:

Paulo Lopes

unread,
Jun 20, 2016, 4:39:16 AM6/20/16
to vert.x
I'd say do not mix the 2, have 1 eventloop for UI swing thread and another vertx eventloop for the IO. This way they both are independent and will not overlap/block each other. Also swing eventloop is UI specific it does not rely on Netty and does not listen to IO events so you can't really mix them.
Reply all
Reply to author
Forward
0 new messages