There is one job which is running in a single threaded environment. This means I have main method and the main thread is responsible for completing the job.
I am using Spring and Hibernate.
On the high level I'm doing the following steps:
fetching data from a MySQL database using JDBC ( looping resultset and doing point 2. and 3. )
populating a Model using the data received from point 1.
validation, calling service layer, dao layer and storing entity in oracle db.
This flow is using a for loop. So 1 by 1 data insertion is there.
Now I want to do it in using multi threading.
Approach :
one thread will fetch the data and populate model object and put it in the queue.
multiple threads will dequeue object from queue and start point 3.
Can you help me in implementing this model. How to code this type of multithreading framework.