Привязки JavaFx обновляются последовательно в одном потоке, как принудительно использовать многопоточностьJAVA

Программисты JAVA общаются здесь
Гость
Привязки JavaFx обновляются последовательно в одном потоке, как принудительно использовать многопоточность

Сообщение Гость »


I have 4 JavaFx Text objects on UI. These 4 objects are bound to 4 different DoubleBinding

I have a doubleProperty called price.

All the 4 DoubleBindings bind to this price property. In essence when price changes, 4 different calculations are performed using the price and 4 different fields are updated.

volatilityProperty = new DoubleBinding() { { super.bind(priceProperty); } @Override protected double computeValue() { } } All this works well.

However I noticed that when the price changes, each of the DoubleBindings are invoked sequentially in a single thread and its computeValue method is invoked. Is there an option so that each of the DoubleBindings start in a new thread as soon as price changes?

I tried using Task inside the overridden computeValue of the double bindings to force multithreading- but for some reason it is taking longer to complete all the 4 calculations if task is used in each of the DoubleBindings.


Источник: https://stackoverflow.com/questions/781 ... multithrea

Вернуться в «JAVA»