I try to use the couchdb (continuous) API with Java and find that after the list of current changes has been exhausted, the thread seems to be closed, and not stay open forever, as intended.
The code I'm using is below. I would expect to never exit the while loop, but do it as soon as the current changes are completed by the thread. I am relatively new to couchdb and Java, so something obvious might not be there. Can someone show me how to write this correctly?
URL url = new URL("[path to database here]/_changes?feed=continuous";); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setDoOutput(true); conn.setUseCaches(false); conn.setRequestProperty("Connection", "Keep-Alive"); conn.setRequestMethod("GET"); BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream())); String line; while((line = reader.readLine()) != null){
couchdb
Stephen
source share