/**
+ * Flag used to indicate that the socket should treat the next request
+ * processed like a keep-alive connection - i.e. one where there may not be
+ * any data to process. The initial value of this flag on entering the
+ * process method is different for connectors that use polling (NIO / APR -
+ * data is always expected) compared to those that use blocking (BIO - data
+ * is only expected if the connection isn't in the keep-alive state).
+ */
+ protected boolean keptAlive;
+
+ /**
* Flag that indicates that send file processing is in progress and that the
* socket should not be returned to the poller (where a poller is used).
*/
openSocket = false;
sendfileInProgress = false;
readComplete = true;
+ if (endpoint.getUsePolling()) {
+ keptAlive = false;
+ } else {
+ keptAlive = socketWrapper.isKeptAlive();
+ }
int soTimeout = endpoint.getSoTimeout();
socketWrapper.setKeepAliveLeft(0);
}
- boolean keptAlive = false;
-
long socketRef = socketWrapper.getSocket().longValue();
while (!error && keepAlive && !comet && !isAsync() &&
openSocket = false;
sendfileInProgress = false;
readComplete = true;
+ if (endpoint.getUsePolling()) {
+ keptAlive = false;
+ } else {
+ keptAlive = socketWrapper.isKeptAlive();
+ }
int soTimeout = endpoint.getSoTimeout();
socketWrapper.setKeepAliveLeft(0);
}
- boolean keptAlive = false;
-
while (!error && keepAlive && !comet && !isAsync() &&
!endpoint.isPaused()) {
openSocket = false;
sendfileInProgress = false;
readComplete = true;
+ if (endpoint.getUsePolling()) {
+ keptAlive = false;
+ } else {
+ keptAlive = socketWrapper.isKeptAlive();
+ }
int soTimeout = endpoint.getSoTimeout();
socketWrapper.setKeepAliveLeft(0);
}
- boolean keptAlive = socketWrapper.isKeptAlive();
-
while (!error && keepAlive && !comet && !isAsync() &&
!endpoint.isPaused()) {
protected abstract Log getLog();
// Flags to indicate optional feature support
+ // Some of these are always hard-coded, some are hard-coded to false (i.e.
+ // the endpoint does not support them) and some are configurable.
public abstract boolean getUseSendfile();
public abstract boolean getUseComet();
public abstract boolean getUseCometTimeout();
+ public abstract boolean getUsePolling();
protected LimitLatch initializeConnectionLatch() {
if (connectionLimitLatch==null) {
public boolean getUseComet() { return useComet; }
@Override
public boolean getUseCometTimeout() { return false; } // Not supported
+ @Override
+ public boolean getUsePolling() { return true; } // Always supported
/**
public boolean getUseCometTimeout() { return false; } // Not supported
@Override
public boolean getDeferAccept() { return false; } // Not supported
+ @Override
+ public boolean getUsePolling() { return false; } // Not supported
// ------------------------------------------------ Handler Inner Interface
public boolean getUseComet() { return useComet; }
@Override
public boolean getUseCometTimeout() { return getUseComet(); }
+ @Override
+ public boolean getUsePolling() { return true; } // Always supported
/**