return SocketState.CLOSED;
}
+ // FIXME: Support for this could be added in AJP as well
+ public SocketState asyncDispatch(long socket, SocketStatus status) {
+ return SocketState.CLOSED;
+ }
+
protected AjpAprProcessor createProcessor() {
AjpAprProcessor processor = new AjpAprProcessor(proto.packetSize, proto.endpoint);
processor.setAdapter(proto.adapter);
}
/* Copied from the AjpProcessor.java */
- public SocketState asyncDispatch(SocketStatus status) throws IOException {
+ public SocketState asyncDispatch(long socket, SocketStatus status) throws IOException {
+
+ // Setting up the socket
+ this.socket = socket;
+ inputBuffer.setSocket(socket);
+ outputBuffer.setSocket(socket);
RequestInfo rp = request.getRequestProcessor();
try {
RequestInfo rp = request.getRequestProcessor();
if ( rp.getStage() != org.apache.coyote.Constants.STAGE_SERVICE ) { //async handling
dispatch.set(true);
- try {
- asyncDispatch(SocketStatus.STOP); // What to do with return code ?
- } catch (IOException ex) {
- error = true;
- }
+ endpoint.getHandler().asyncDispatch(this.socket, SocketStatus.STOP);
} else {
dispatch.set(false);
}
return SocketState.CLOSED;
}
+ public SocketState asyncDispatch(long socket, SocketStatus status) {
+ Http11AprProcessor result = connections.get(Long.valueOf(socket));
+
+ SocketState state = SocketState.CLOSED;
+ if (result != null) {
+ // Call the appropriate event
+ try {
+ state = result.asyncDispatch(socket, status);
+ } catch (java.net.SocketException e) {
+ // SocketExceptions are normal
+ Http11AprProtocol.log.debug
+ (sm.getString
+ ("http11protocol.proto.socketexception.debug"), e);
+ } catch (java.io.IOException e) {
+ // IOExceptions are normal
+ Http11AprProtocol.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
+ // above.
+ catch (Throwable e) {
+ // 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.
+ Http11AprProtocol.log.error
+ (sm.getString("http11protocol.proto.error"), e);
+ } finally {
+ if (state != SocketState.LONG) {
+ connections.remove(Long.valueOf(socket));
+ recycledProcessors.offer(result);
+ if (state == SocketState.OPEN) {
+ proto.endpoint.getPoller().add(socket);
+ }
+ }
+ }
+ }
+ return state;
+ }
+
protected Http11AprProcessor createProcessor() {
Http11AprProcessor processor =
new Http11AprProcessor(proto.maxHttpHeaderSize, proto.endpoint);
import org.apache.tomcat.jni.SSLSocket;
import org.apache.tomcat.jni.Socket;
import org.apache.tomcat.jni.Status;
+import org.apache.catalina.core.AprLifecycleListener;
/**
if (initialized)
return;
+ if (!AprLifecycleListener.isAprAvailable()) {
+ throw new Exception(sm.getString("endpoint.init.notavail");
+ }
// Create the root APR memory pool
rootPool = Pool.create(0);
public interface Handler extends AbstractEndpoint.Handler {
public SocketState process(long socket);
public SocketState event(long socket, SocketStatus status);
+ public SocketState asyncDispatch(long socket, SocketStatus status);
}
protected class SocketProcessor implements Runnable {
protected long socket = 0;
+ protected boolean async = false;
+ protected SocketStatus status = SocketStatus.ERROR;
public SocketProcessor(long socket) {
this.socket = socket;
+ this.async = false;
+ }
+ public SocketProcessor(long socket, boolean asyn, SocketStatus status) {
+ this.socket = socket;
+ this.async = asyn;
+ this.status = status;
}
public void run() {
// Process the request from this socket
- if (handler.process(socket) == Handler.SocketState.CLOSED) {
+ Handler.SocketState state = async?handler.asyncDispatch(socket, status):handler.process(socket);
+ if (state == Handler.SocketState.CLOSED) {
// Close socket and pool
Socket.destroy(socket);
socket = 0;
endpoint.init.bind=Socket bind failed: [{0}] {1}
endpoint.init.listen=Socket listen failed: [{0}] {1}
+endpoint.init.notavail=APR not available
endpoint.accept.fail=Socket accept failed
endpoint.poll.limitedpollsize=Failed to create poller with specified size of {0}
endpoint.poll.initfail=Poller creation failed
endpoint.poll.error=Unexpected poller error
endpoint.process.fail=Error allocating socket processor
endpoint.sendfile.error=Unexpected sendfile error
-endpoint.sendfile.addfail=Sednfile failure: [{0}] {1}
+endpoint.sendfile.addfail=Sendfile failure: [{0}] {1}
endpoint.sendfile.nosupport=Disabling sendfile, since either the APR version or the system doesn't support it
endpoint.warn.noInsecureReneg=Secure renegotation is not supported by the SSL library {0}
endpoint.noProcessor = No hay procesadores - \u00A1hilo de trabajadir muerto\!
endpoint.init.bind = Ligado de conector fall\u00F3\: [{0}] {1}
endpoint.init.listen = Escucha de conector fall\u00F3\: [{0}] {1}
+endpoint.init.notavail = APR no disponible
endpoint.accept.fail = Aceptaci\u00F3n de conector fall\u00F3
endpoint.poll.limitedpollsize = No pude crear encuestador de medida espec\u00EDfica de {0}
endpoint.poll.initfail = Fall\u00F3 la creaci\u00F3n del encuestador