I am running jobs as background process using java swingworker
protected static class BackgroundTask extends SwingWorker<Void, Void> {
@Override
protected Void doInBackground() {
//while (!isCancelled()) {
Build_JobParams.runJob();
//}
return null;
}
Now, I need to call multiple times (asynchronously) the background process using different parameters. As it is background process, 2nd call is overriding the first call parameters. One way I tried is using multiple threads like Thread t1 = new Thread(){ ... but it is throwing exceptions intermittently.
Any better suggestions. Note, I can't wait in the done() { .. method to invoke the 2nd call as I have making many calls and not sure of the number of calls initially. Please suggest if there is some good way.