@Override
public SocketState process(NioChannel socket) {
- Http11NioProcessor processor = null;
+ Http11NioProcessor processor = connections.remove(socket);
try {
- processor = connections.remove(socket);
-
if (processor == null) {
processor = recycledProcessors.poll();
}
processor = createProcessor();
}
- if (proto.endpoint.isSSLEnabled() && (proto.sslImplementation != null)) {
- if (socket instanceof SecureNioChannel) {
- SecureNioChannel ch = (SecureNioChannel)socket;
- processor.setSslSupport(proto.sslImplementation.getSSLSupport(ch.getSslEngine().getSession()));
- }else processor.setSslSupport(null);
+ if (proto.isSSLEnabled() &&
+ (proto.sslImplementation != null)
+ && (socket instanceof SecureNioChannel)) {
+ SecureNioChannel ch = (SecureNioChannel)socket;
+ processor.setSslSupport(
+ proto.sslImplementation.getSSLSupport(
+ ch.getSslEngine().getSession()));
} else {
processor.setSslSupport(null);
}
-
SocketState state = processor.process(socket);
if (state == SocketState.LONG) {
// In the middle of processing a request/response. Keep the
} catch (java.net.SocketException e) {
// SocketExceptions are normal
- Http11NioProtocol.log.debug
- (sm.getString
- ("http11protocol.proto.socketexception.debug"), e);
+ log.debug(sm.getString(
+ "http11protocol.proto.socketexception.debug"), e);
} catch (java.io.IOException e) {
// IOExceptions are normal
- Http11NioProtocol.log.debug
- (sm.getString
- ("http11protocol.proto.ioexception.debug"), e);
+ log.debug(sm.getString(
+ "http11protocol.proto.ioexception.debug"), e);
}
// Future developers: if you discover any other
// rare-but-nonfatal exceptions, catch them here, and log as
// any other exception or error is odd. Here we log it
// with "ERROR" level, so it will show up even on
// less-than-verbose logs.
- Http11NioProtocol.log.error
- (sm.getString("http11protocol.proto.error"), e);
+ log.error(sm.getString("http11protocol.proto.error"), e);
}
recycledProcessors.offer(processor);
return SocketState.CLOSED;
@Override
public SocketState process(SocketWrapper<Socket> socket, SocketStatus status) {
Http11Processor processor = connections.remove(socket);
- boolean recycle = true;
try {
if (processor == null) {
processor = recycledProcessors.poll();
}
if (proto.isSSLEnabled() && (proto.sslImplementation != null)) {
- processor.setSSLSupport
- (proto.sslImplementation.getSSLSupport(socket.getSocket()));
+ processor.setSSLSupport(
+ proto.sslImplementation.getSSLSupport(
+ socket.getSocket()));
} else {
processor.setSSLSupport(null);
}
if (state == SocketState.LONG) {
connections.put(socket, processor);
socket.setAsync(true);
- recycle = false;
} else {
connections.remove(socket);
socket.setAsync(false);
+ recycledProcessors.offer(processor);
}
return state;
} catch(java.net.SocketException e) {
// SocketExceptions are normal
- Http11Protocol.log.debug
- (sm.getString
- ("http11protocol.proto.socketexception.debug"), e);
+ log.debug(sm.getString(
+ "http11protocol.proto.socketexception.debug"), e);
} catch (java.io.IOException e) {
// IOExceptions are normal
- Http11Protocol.log.debug
- (sm.getString
- ("http11protocol.proto.ioexception.debug"), e);
+ log.debug(sm.getString(
+ "http11protocol.proto.ioexception.debug"), e);
}
// Future developers: if you discover any other
// rare-but-nonfatal exceptions, catch them here, and log as
// any other exception or error is odd. Here we log it
// with "ERROR" level, so it will show up even on
// less-than-verbose logs.
- Http11Protocol.log.error
- (sm.getString("http11protocol.proto.error"), e);
- } finally {
- // if(proto.adapter != null) proto.adapter.recycle();
- // processor.recycle();
-
- if (recycle) {
- recycledProcessors.offer(processor);
- }
+ log.error(sm.getString("http11protocol.proto.error"), e);
}
+ recycledProcessors.offer(processor);
return SocketState.CLOSED;
}