lightcouch / LightCouch

CouchDB Java API
www.lightcouch.org
Apache License 2.0
67 stars 70 forks source link

Added checking the "stop" flag between subsequent "readLine" calls. #59

Closed bwilk closed 6 years ago

bwilk commented 8 years ago

The problem I am trying to address, is waiting forever for the "readNextRow" method to return. when there is no change in the database.

I have added checking the "stop" flag between subsequent "readLine" calls. I have also added checking "Thread.interrupted" in order to allow for graceful termination when the thread is interrupted.

As the "readLine" method is blocking and takes quite long time to return, it may be also valuable to close underlying stream in "stop" method, which enables another thread to call it, in order to make it returning immediately.