Reputation: 93
I am spawning a Thread to query the DB. The intention is to have this done asynchronously. Now every Query returns me a lot of rows. What i want is that my thread keeps making a batch of say 5 and return back the set of values to the UI Thread which would keep displaying it. Is there some way to be able to achieve this? I am using Java with Spring for my platform
Upvotes: 1
Views: 40
Reputation: 13535
Let the thread which queries DB read 5 items, pack them in an object whose class implements Runnable, and pass that object to UI by SwingUtilities.invokeLater
.
Upvotes: 1