*/
protected long sslContext = 0;
-
+
// ------------------------------------------------------------- Properties
protected boolean deferAccept = true;
public void setDeferAccept(boolean deferAccept) { this.deferAccept = deferAccept; }
public boolean getDeferAccept() { return deferAccept; }
-
+
/**
* Size of the socket poller.
if (sendfiles == null) {
return 0;
}
-
+
int sendfileCount = 0;
for (int i = 0; i < sendfiles.length; i++) {
sendfileCount += sendfiles[i].getSendfileCount();
sendfileThreadCount = 1;
}
}
-
+
// Delay accepting of new connections until data is available
// Only Linux kernels 2.4 + have that implemented
// on other platforms this call is noop and will return APR_ENOTIMPL.
// Initialize SSL if needed
if (isSSLEnabled()) {
-
+
// SSL protocol
int value = SSL.SSL_PROTOCOL_ALL;
if ("SSLv2".equalsIgnoreCase(SSLProtocol)) {
}
}
}
- }
+ }
/**
* Pause the endpoint, which will make it stop accepting new sockets.
if (running) {
stop();
}
-
+
// Destroy pool if it was initialised
if (serverSockPool != 0) {
Pool.destroy(serverSockPool);
serverSockPool = 0;
}
-
+
// Close server socket if it was initialised
if (serverSock != 0) {
Socket.close(serverSock);
serverSock = 0;
}
-
+
sslContext = 0;
-
+
// Close all APR memory pools and resources if initialised
if (rootPool != 0) {
Pool.destroy(rootPool);
rootPool = 0;
}
-
+
initialized = false;
}
}
-
+
/**
* Allocate a new poller of the specified size.
*/
}
}
-
+
/**
* Process given socket.
*/
}
return true;
}
-
+
/**
* Process given socket.
}
return true;
}
-
+
/**
* Process given socket for an event.
} else {
Thread.currentThread().setContextClassLoader(
getClass().getClassLoader());
- }
+ }
getExecutor().execute(proc);
} finally {
if (IS_SECURITY_ENABLED) {
}
return true;
}
-
+
// --------------------------------------------------- Acceptor Inner Class
protected long[] addS;
protected volatile int addCount = 0;
-
+
protected boolean comet = true;
protected volatile int keepAliveCount = 0;
public Poller(boolean comet) {
this.comet = comet;
}
-
+
/**
* Create the poller. With some versions of APR, the maximum poller size will
* be 62 (recompiling APR is necessary to remove this limitation).
// Check for failed sockets and hand this socket off to a worker
if (((desc[n*2] & Poll.APR_POLLHUP) == Poll.APR_POLLHUP)
|| ((desc[n*2] & Poll.APR_POLLERR) == Poll.APR_POLLERR)
- || (comet && (!processSocket(desc[n*2+1], SocketStatus.OPEN)))
+ || (comet && (!processSocket(desc[n*2+1], SocketStatus.OPEN)))
|| (!comet && (!processSocket(desc[n*2+1])))) {
// Close socket and clear pool
if (comet) {
}
}
-
+
}
protected long pool = 0;
protected long[] desc;
protected HashMap<Long, SendfileData> sendfileData;
-
+
protected volatile int sendfileCount;
public int getSendfileCount() { return sendfileCount; }
* and do the handshake.
*/
protected class SocketWithOptionsProcessor implements Runnable {
-
+
protected long socket = 0;
-
+
public SocketWithOptionsProcessor(long socket) {
this.socket = socket;
}
}
} else {
// Process the request from this socket
- if (!setSocketOptions(socket)
+ if (!setSocketOptions(socket)
|| handler.process(socket) == Handler.SocketState.CLOSED) {
// Close socket and pool
Socket.destroy(socket);
}
}
-
+
}
-
-
+
+
// ---------------------------------------------- SocketProcessor Inner Class
* external Executor thread pool.
*/
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;
}
}
-
+
}
-
-
+
+
// --------------------------------------- SocketEventProcessor Inner Class
* external Executor thread pool.
*/
protected class SocketEventProcessor implements Runnable {
-
+
protected long socket = 0;
- protected SocketStatus status = null;
-
+ protected SocketStatus status = null;
+
public SocketEventProcessor(long socket, SocketStatus status) {
this.socket = socket;
this.status = status;
}
}
-
+
}
-
+
private static class PrivilegedSetTccl implements PrivilegedAction<Void> {
private ClassLoader cl;
Thread.currentThread().setContextClassLoader(cl);
return null;
}
- }
+ }
}