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.
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.