I have a main Thread which is a Rest Endpoint. I spawn a new Runnable in that end point and pass to the Executor service. I make the main Thread wait on my Runnable by calling join() method. Then in the run() method of my Runnable, i run a Quartz job using the Quartz Scheduler. Now this Quartz job runs in a separate thread.
However my problem is that even after the Job has finished executed and is also deleted by the Scheduler, the Main Thread is still waiting on the Runnable and the main execution starts after some 40 to 50 seconds after the Job has finished execution.
I want to terminate the Runnable Thread immediately after the Job has finished execution. How can i acheive this ?
Also immediately after the Job has been scheduled, the last line of run() method of Runnable is executed.