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

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

Сообщение Anonymous »


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
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

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