RequestHandler handler = handlerFactory.getRequestHandler(protocol);
logger.info("Client " + socket.getRemoteSocketAddress()
+ " connected successfully with protocol " + protocol.getCode());
while(!isInterrupted() && !socket.isClosed() && !isClosed) {
StreamRequestHandler srh = handler.handleRequest(inputStream, outputStream);
if(srh != null) {
if(logger.isTraceEnabled())
logger.trace("Request is streaming");
StreamRequestHandlerState srhs = null;
try {
do {
if(logger.isTraceEnabled())
logger.trace("About to enter streaming request handler");
srhs = srh.handleRequest(inputStream, outputStream);
if(logger.isTraceEnabled())
logger.trace("Finished invocation of streaming request handler, result is "
+ srhs);
} while(srhs != StreamRequestHandlerState.COMPLETE);
} catch(VoldemortException e) {
srh.handleError(outputStream, e);
outputStream.flush();
break;
} finally {
srh.close(outputStream);
}
}
outputStream.flush();
}