Tip #3: Never Write ‘new Thread()’ Again

As you probably know JRebirth has a powerful thread engine that kick away all coding complexity that could lead to User Interface corruptions, lags or the worst one a totally frozen interface.

It’s really difficult to create dynamically a lot of threads without adding some bugs to the application. JRebirth provides a powerful way to simplify your developments.

With the advent of Java 8 (with Method References) and JRebirth 8,  it’s now possible to chain and combine Tasks running into specific Thread in a very convenient way.

RefCommand

Call a single method into the wished thread
Let’s see an example:

It’s as simple as create a Ref object and calling the RefCommand from any Component.

Same thing but using a wave (allow to attach some WaveData and process them with a WaveListener)

GroupCommand

Obviously JRebirth Thread Engine allow to combine several tasks running in different threads.
Tasks can be run in parallel or sequentially.

In this example the MultiCommand will be run into JTP and its two children too.

By building an object tree with GroupRef, SingleRef and RealRef objects it’s possible to run complex task by controlling their executions order, their priority and thread used.

Please note that the RealRef allow to call an existing command.

I hope you will enjoy this new feature !

2 thoughts on “Tip #3: Never Write ‘new Thread()’ Again

Leave a Reply