Reputation: 2101
I use javascript to make ajax calls to a java application that uses jcouchdb to write to a couchdb database. I use the following block to verify the connection and if for some reason there is no connection move on quick.
try {
db.getStatus();
} catch(Exception e) {
logger.error("error connecting to counchdb");
return false;
}
The problem is when the db is not responding (i tested using a wrong ip) the .getStatus() method takes a long time to return. My question is: How do I enforce a quick timeout on the server side?
p.s. I don't think jcouchdb has such a functionality.
Upvotes: 1
Views: 876
Reputation: 18845
couchdb is REST based, so you should be able to set a connection-timeout for the commons-httpclient. there is a closed issue for this on the tracker, so i guess it should be available in the api: http://code.google.com/p/jcouchdb/issues/detail?id=67#c0
Upvotes: 2