responseHeaderMessage = new AjpMessage(packetSize);
bodyMessage = new AjpMessage(packetSize);
- readTimeout = endpoint.getFirstReadTimeout() * 1000;
- if (readTimeout == 0) {
- readTimeout = 100 * 1000;
- } else if (readTimeout < 0) {
- readTimeout = -1;
- }
-
// Allocate input and output buffers
inputBuffer = ByteBuffer.allocateDirect(packetSize * 2);
inputBuffer.limit(0);
/**
- * The socket timeout used when reading the first block of the request
- * header.
- */
- protected long readTimeout;
-
-
- /**
* Temp message bytes used for processing.
*/
protected MessageBytes tmpMB = MessageBytes.newInstance();
// Error flag
error = false;
- int limit = 0;
- if (endpoint.getFirstReadTimeout() > 0) {
- limit = endpoint.getMaxThreads() / 2;
- }
-
boolean openSocket = true;
boolean keptAlive = false;
// Parsing the request header
try {
// Get first message of the request
- if (!readMessage(requestHeaderMessage, true,
- keptAlive && (endpoint.getCurrentThreadsBusy() >= limit))) {
+ if (!readMessage(requestHeaderMessage, true, keptAlive)) {
// This means that no data is available right now
// (long keepalive), so that the processor should be recycled
// and the method should return true
}
int nRead;
while (inputBuffer.remaining() < n) {
- if (readTimeout > 0) {
- nRead = Socket.recvbbt
- (socket, inputBuffer.limit(),
- inputBuffer.capacity() - inputBuffer.limit(), readTimeout);
- } else {
- nRead = Socket.recvbb
- (socket, inputBuffer.limit(),
- inputBuffer.capacity() - inputBuffer.limit());
- }
+ nRead = Socket.recvbb
+ (socket, inputBuffer.limit(),
+ inputBuffer.capacity() - inputBuffer.limit());
if (nRead > 0) {
inputBuffer.limit(inputBuffer.limit() + nRead);
} else {
}
- public int getFirstReadTimeout() {
- return ep.getFirstReadTimeout();
- }
-
-
- public void setFirstReadTimeout(int i) {
- ep.setFirstReadTimeout(i);
- setAttribute("firstReadTimeout", "" + i);
- }
-
-
public int getPollTime() {
return ep.getPollTime();
}
this.endpoint = endpoint;
request = new Request();
- int readTimeout = endpoint.getFirstReadTimeout();
- if (readTimeout == 0) {
- readTimeout = 100;
- } else if (readTimeout < 0) {
- readTimeout = -1;
- }
- inputBuffer = new InternalAprInputBuffer(request, headerBufferSize,
- readTimeout);
+ inputBuffer = new InternalAprInputBuffer(request, headerBufferSize);
request.setInputBuffer(inputBuffer);
response = new Response();
int keepAliveLeft = maxKeepAliveRequests;
long soTimeout = endpoint.getSoTimeout();
- int limit = 0;
- if (endpoint.getFirstReadTimeout() > 0 || endpoint.getFirstReadTimeout() < -1) {
- limit = endpoint.getMaxThreads() / 2;
- }
-
boolean keptAlive = false;
boolean openSocket = false;
if( !disableUploadTimeout && keptAlive && soTimeout > 0 ) {
Socket.timeoutSet(socket, soTimeout * 1000);
}
- if (!inputBuffer.parseRequestLine
- (keptAlive && (endpoint.getCurrentThreadsBusy() >= limit))) {
+ if (!inputBuffer.parseRequestLine(keptAlive)) {
// This means that no data is available right now
// (long keepalive), so that the processor should be recycled
// and the method should return true
setAttribute("port", "" + port);
}
- public int getFirstReadTimeout() {
- return ep.getFirstReadTimeout();
- }
-
- public void setFirstReadTimeout( int i ) {
- ep.setFirstReadTimeout(i);
- setAttribute("firstReadTimeout", "" + i);
- }
-
public int getPollTime() {
return ep.getPollTime();
}
/**
* Alternate constructor.
*/
- public InternalAprInputBuffer(Request request, int headerBufferSize,
- long readTimeout) {
+ public InternalAprInputBuffer(Request request, int headerBufferSize) {
this.request = request;
headers = request.getMimeHeaders();
parsingHeader = true;
swallowInput = true;
- if (readTimeout < 0) {
- this.readTimeout = -1;
- } else {
- this.readTimeout = readTimeout * 1000;
- }
-
}
protected int lastActiveFilter;
- /**
- * The socket timeout used when reading the first block of the request
- * header.
- */
- protected long readTimeout;
-
-
// ------------------------------------------------------------- Properties
if (useAvailableData) {
return false;
}
- if (readTimeout == -1) {
- if (!fill())
- throw new EOFException(sm.getString("iib.eof.error"));
- } else {
- // Do a simple read with a short timeout
- bbuf.clear();
- int nRead = Socket.recvbbt
- (socket, 0, buf.length - lastValid, readTimeout);
- if (nRead > 0) {
- bbuf.limit(nRead);
- bbuf.get(buf, pos, nRead);
- lastValid = pos + nRead;
- } else {
- if ((-nRead) == Status.ETIMEDOUT || (-nRead) == Status.TIMEUP) {
- return false;
- } else {
- throw new IOException(sm.getString("iib.failedread"));
- }
- }
- }
+ if (!fill())
+ throw new EOFException(sm.getString("iib.eof.error"));
}
chr = buf[pos++];
if (useAvailableData) {
return false;
}
- if (readTimeout == -1) {
- if (!fill())
- throw new EOFException(sm.getString("iib.eof.error"));
- } else {
- // Do a simple read with a short timeout
- bbuf.clear();
- int nRead = Socket.recvbbt
- (socket, 0, buf.length - lastValid, readTimeout);
- if (nRead > 0) {
- bbuf.limit(nRead);
- bbuf.get(buf, pos, nRead);
- lastValid = pos + nRead;
- } else {
- if ((-nRead) == Status.ETIMEDOUT || (-nRead) == Status.TIMEUP) {
- return false;
- } else {
- throw new IOException(sm.getString("iib.failedread"));
- }
- }
- }
+ if (!fill())
+ throw new EOFException(sm.getString("iib.eof.error"));
}
//
/**
- * Timeout on first request read before going to the poller, in ms.
- */
- protected int firstReadTimeout = -1;
- public int getFirstReadTimeout() { return firstReadTimeout; }
- public void setFirstReadTimeout(int firstReadTimeout) { this.firstReadTimeout = firstReadTimeout; }
-
-
- /**
* Poll interval, in microseconds. The smaller the value, the more CPU the poller
* will use, but the more responsive to activity it will be.
*/