}
} else {
if ( recycle ) recycle();
- return (openSocket) ? SocketState.OPEN : SocketState.CLOSED;
+ //return (openSocket) ? (SocketState.OPEN) : SocketState.CLOSED;
+ return (openSocket) ? (recycle?SocketState.OPEN:SocketState.LONG) : SocketState.CLOSED;
}
}
public void releaseCaches() {
recycledProcessors.clear();
}
+
+ public void release(NioChannel socket) {
+ Http11NioProcessor result = connections.remove(socket);
+ if ( result != null ) {
+ result.recycle();
+ recycledProcessors.offer(result);
+ }
+ }
public SocketState event(NioChannel socket, SocketStatus status) {
Http11NioProcessor result = connections.get(socket);
public SocketState process(NioChannel socket) {
Http11NioProcessor processor = null;
try {
+ processor = connections.remove(socket);
+
if (processor == null) {
processor = recycledProcessors.poll();
}
socket.getPoller().addEvent(
new Runnable() {
public void run() {
- key.cancel();
+ socket.getPoller().cancelledKey(key,SocketStatus.ERROR,false);
}
});
}
processSocket(ka.getChannel(), status, false);//don't dispatch if the lines below are cancelling the key
if (status == SocketStatus.TIMEOUT ) return; // don't close on comet timeout
}
+ handler.release(ka.getChannel());
if (key.isValid()) key.cancel();
if (key.channel().isOpen()) try {key.channel().close();}catch (Exception ignore){}
try {ka.channel.close(true);}catch (Exception ignore){}
public SocketState process(NioChannel socket);
public SocketState event(NioChannel socket, SocketStatus status);
public void releaseCaches();
+ public void release(NioChannel socket);
}