// In the middle of processing a request/response. Keep the
// socket associated with the processor.
connections.put(socket, processor);
-
socket.setAsync(true);
} else if (state == SocketState.OPEN){
// In keep-alive but between requests. OK to recycle
release(socket, processor, true);
}
return state;
-
} catch(java.net.SocketException e) {
// SocketExceptions are normal
log.debug(sm.getString(
}
@Override
- public SocketState process(SocketWrapper<Socket> socket, SocketStatus status) {
+ public SocketState process(SocketWrapper<Socket> socket,
+ SocketStatus status) {
AjpProcessor processor = connections.remove(socket);
+
+ socket.setAsync(false);
+
try {
if (processor == null) {
processor = recycledProcessors.poll();
state = processor.asyncPostProcess();
}
} while (state == SocketState.ASYNC_END);
- // TODO Better to add a new state to the AsyncStateMachine and
- // remove ASYNC_END entirely
if (state == SocketState.LONG) {
+ // In the middle of processing a request/response. Keep the
+ // socket associated with the processor.
connections.put(socket, processor);
+ socket.setAsync(true);
} else if (state == SocketState.OPEN){
+ // In keep-alive but between requests. OK to recycle
+ // processor. Continue to poll for the next request.
processor.recycle(false);
recycledProcessors.offer(processor);
} else {
* Different types of socket states to react upon.
*/
public enum SocketState {
+ // TODO Add a new state to the AsyncStateMachine and remove
+ // ASYNC_END (if possible)
OPEN, CLOSED, LONG, ASYNC_END
}