On Thursday 13 January 2011 4:55:29 pm Benson Margulies wrote:
> I've got this web service that, to some extent, just wraps a mysql
> database. I have a number of reasons to prefer to control the
> communications rather than allow all the consumers to talk to mysql
> directly.
> 
> I'm not too pleased with the result of this when I am scanning many
> records. I'm thinking that the time has come to process record (a)
> while waiting for record (b) to arrive. Is this a job for the JAX-WS
> async stuff? Have we got a good CXF example, particularly java-first?

The NORMAL method of doing this, I think, is to have the service return a 
List<Something>.   The List would then be a hand written (not ArrayList or so) 
object that would wrapper the ResultSet or so and iterate on demand.   I 
believe JAXB calls the Iterator on the list, so you can pull them on demand.

The TRICKY part is closing the database connection and cleaning up when you do 
that.    If it's just the single list, you could possibly clean things up when 
the last record is hit.   Otherwise, and interceptor or similar on the out 
chain would work to clean things up.




-- 
Daniel Kulp
[email protected]
http://dankulp.com/blog

Reply via email to