Asynchronous Jobs
If you don't want the current thread to block or you need to run several jobs in parallel, Data Pipeline gives you several options.
You can always create a new thread and call job.run()
in the thread's run method, but here are a few nicer ways.
RunAsync
The easiest option is just to call runAsync()
instead of run()
.
Thread
The second option is to use your own thread. Since Job implements Runnable
, it can be passed to a Thread's constructor to be executed concurrently.
ExecutorService
The third option is to use an ExecutorService
. This approach gives you the most control over how (and how many) jobs are executed in parallel.