}
try {
- flush();
+ flush(false);
} catch (IOException e) {
// Set error flag
error = true;
}
try {
- flush();
+ flush(true);
} catch (IOException e) {
// Set error flag
error = true;
// Methods called by action()
protected abstract void actionInternal(ActionCode actionCode, Object param);
- protected abstract void flush() throws IOException;
+ protected abstract void flush(boolean tbd) throws IOException;
protected abstract void finish() throws IOException;
}
+ // Add the socket to the poller
+ if (!error && !endpoint.isPaused()) {
+ if (!isAsync()) {
+ ((AprEndpoint)endpoint).getPoller().add(socketRef);
+ }
+ }
+
rp.setStage(org.apache.coyote.Constants.STAGE_ENDED);
if (error || endpoint.isPaused()) {
// Add the end message
if (outputBuffer.position() + endMessageArray.length > outputBuffer.capacity()) {
- flush();
+ flush(false);
}
outputBuffer.put(endMessageArray);
- flush();
+ flush(false);
}
* Callback to write data from the buffer.
*/
@Override
- protected void flush() throws IOException {
+ protected void flush(boolean explicit) throws IOException {
long socketRef = socket.getSocket().longValue();
outputBuffer.clear();
}
// Send explicit flush message
- if (Socket.sendb(socketRef, flushMessageBuffer, 0,
- flushMessageBuffer.position()) < 0) {
- throw new IOException(sm.getString("ajpprocessor.failedflush"));
+ if (explicit) {
+ if (Socket.sendb(socketRef, flushMessageBuffer, 0,
+ flushMessageBuffer.position()) < 0) {
+ throw new IOException(sm.getString("ajpprocessor.failedflush"));
+ }
}
-
}
len -= thisTime;
if (outputBuffer.position() + thisTime +
Constants.H_SIZE + 4 > outputBuffer.capacity()) {
- flush();
+ flush(false);
}
outputBuffer.put((byte) 0x41);
outputBuffer.put((byte) 0x42);
if (state != SocketState.LONG && state != SocketState.ASYNC_END) {
connections.remove(socket);
recycledProcessors.offer(result);
- //if (state == SocketState.OPEN) {
- // proto.endpoint.getPoller().add(socket.getSocket().longValue());
- //}
+ if (state == SocketState.OPEN) {
+ proto.endpoint.getPoller().add(socket.getSocket().longValue());
+ }
}
}
}
* Callback to write data from the buffer.
*/
@Override
- protected void flush() throws IOException {
+ protected void flush(boolean explicit) throws IOException {
// Send the flush message
output.write(flushMessageArray);
}