项目作者: tengai650

项目描述 :
Event dispatcher or thread governor to manage worker threads posting events to the FX Application thread.
高级语言: Java
项目地址: git://github.com/tengai650/FxDispatcher.git
创建时间: 2017-08-18T17:40:33Z
项目社区:https://github.com/tengai650/FxDispatcher

开源协议:MIT License

下载


FxDispatcher

An event dispatcher or thread governor to manage worker threads posting events to the FX Application thread.
The FxDispatcher prevents worker threads from overwhelming the FX Application thread by governing
when events can be added to the FX Application thread.

An event cache is provided by a java.util.concurrent.BlockingQueue allowing threads to post events to the queue
and continue on. However, if the queue is full the posting thread (and any subsequent posting thread) is paused until a
queue slot becomes available. Once a slot becomes available the next pending worker thread puts its event to the
blocking queue allowing the thread to continue. The size of the blocking queue is user configurable.

Method waitTillPurged is designed to wait until finished, similar to SwingUtilities.invokeAndWait().

Benifits:

  • All locking is done by the JDK. Low cost maintenance.
  • No additional Runnable objects created to support this interface.
  • Support concurrent event posting.
  • waitTillPurged method returns number of millseconds the FX Application took to purge the event queue.
  • Can easily be updated to support Swing.