2016-03-31 4 views
0

私はjavaFXアプリケーションスレッド上で動作するサービスを持っています。私は30秒後にサービスを再起動する新しいスレッドを持っていますが、別のスレッドからjavaFXアプリケーションスレッドにアクセスすることは可能ですか?またはこの問題を回避する方法についての提案をお持ちですか?他のスレッドからjavaFXアプリケーションスレッドにアクセスする

+1

KeepSessionAliveService service = new KeepSessionAliveService() ; service.setPeriod(Duration.seconds(30));//repeat every n seconds service.setDelay(Duration.seconds(30));//Set this only if you want to wait before the service starts service.setOnSucceeded(event -> { //What needs to happen on the ui? }); service.start(); 
([Platform.runLaterを使用せずに付き/ UIコンポーネントの状態を変更するJava FX]を見てhttp://stackoverflow.com/questions/26012421/java-fx-modifying-ui-component-state-プラットフォームなしのrunlaterを使用して) – ItachiUchiha

答えて

0

サービスを使用している場合は、サービスを自動的に開始および再開するための遅延を設定できます。

+0

'Platform.runLater'を使用してそれをsloved – Jdavis649

関連する問題