}, "Couchbase View Thread for node " + addr);
ioThread.start();
}
public boolean writeOp(HttpOperation op) {
AsyncConnectionRequest connRequest = connMgr.requestConnection();
try {
connRequest.waitFor();
} catch (InterruptedException e) {
getLogger().warn(
"Interrupted while trying to get a connection.");
connRequest.cancel();
return false;
}
NHttpClientConnection conn = connRequest.getConnection();
if (conn == null) {
getLogger().debug("Failed to obtain connection on node " + this.addr);
connRequest.cancel();
return false;
} else {
if (!user.equals("default")) {
try {
op.addAuthHeader(HttpUtil.buildAuthHeader(user, pass));
} catch (UnsupportedEncodingException ex) {
getLogger().error("Could not create auth header for request, "
+ "could not encode credentials into base64. Canceling op."
+ op, ex);
op.cancel();
connRequest.cancel();
}
}
HttpContext context = conn.getContext();
RequestHandle handle = new RequestHandle(connMgr, conn);
context.setAttribute("request-handle", handle);