public void access() { access(System.currentTimeMillis()); } public void access(long access) { lastAccess = access; }
public void access() { access(System.currentTimeMillis()); } public void access(long access) { lastAccess = access; }
public void access() { access(System.currentTimeMillis()); } public void access(long access) { lastAccess = access; }
public void access() { access(System.currentTimeMillis()); } public void access(long access) { lastAccess = access; }
@Override public void run() { synchronized (socket) { // Process the request from this socket Handler.SocketState state = (status==null)?handler.process(socket):handler.asyncDispatch(socket, status); if (state == Handler.SocketState.CLOSED) { // Close socket and pool destroySocket(socket.getSocket().longValue()); socket = null; } else if (state == Handler.SocketState.LONG) { socket.access(); if (socket.async) { waitingRequests.add(socket); } } else if (state == Handler.SocketState.ASYNC_END) { socket.access(); SocketProcessor proc = new SocketProcessor(socket, SocketStatus.OPEN); getExecutor().execute(proc); } } } }
@Override public void run() { synchronized (socket) { // Process the request from this socket SocketState state = SocketState.OPEN; if (status == null) { state = handler.process(socket,SocketStatus.OPEN); } else { state = handler.process(socket, status); } if (state == Handler.SocketState.CLOSED) { // Close socket and pool destroySocket(socket.getSocket().longValue()); socket = null; } else if (state == Handler.SocketState.LONG) { socket.access(); if (socket.async) { waitingRequests.add(socket); } } else if (state == Handler.SocketState.ASYNC_END) { socket.access(); SocketProcessor proc = new SocketProcessor(socket, SocketStatus.OPEN); getExecutor().execute(proc); } } } }
@Override public void run() { synchronized (socket) { // Process the request from this socket SocketState state = SocketState.OPEN; if (status == null) { state = handler.process(socket,SocketStatus.OPEN); } else { state = handler.process(socket, status); } if (state == Handler.SocketState.CLOSED) { // Close socket and pool destroySocket(socket.getSocket().longValue()); socket = null; } else if (state == Handler.SocketState.LONG) { socket.access(); if (socket.async) { waitingRequests.add(socket); } } else if (state == Handler.SocketState.ASYNC_END) { socket.access(); SocketProcessor proc = new SocketProcessor(socket, SocketStatus.OPEN); getExecutor().execute(proc); } } } }
wrapper.access();
private void doRun() { // Process the request from this socket if (socket.getSocket() == null) { // Closed in another thread return; } SocketState state = handler.process(socket, status); if (state == Handler.SocketState.CLOSED) { // Close socket and pool closeSocket(socket.getSocket().longValue()); socket.reset(null, 1); } else if (state == Handler.SocketState.LONG) { socket.access(); if (socket.isAsync()) { waitingRequests.add(socket); } } else if (state == Handler.SocketState.ASYNC_END) { socket.access(); SocketProcessor proc = new SocketProcessor(socket, SocketStatus.OPEN_READ); getExecutor().execute(proc); } } }
socket = null; } else if (state == Handler.SocketState.LONG) { socket.access(); if (socket.async) { waitingRequests.add(socket);
socket = null; } else if (state == Handler.SocketState.LONG) { socket.access(); if (socket.async) { waitingRequests.add(socket);
socket = null; } else if (state == Handler.SocketState.LONG) { socket.access(); if (socket.isAsync()) { waitingRequests.add(socket);
@Override protected synchronized boolean flushBuffer(boolean block) throws IOException { wrapper.access(); if (hasMoreDataToFlush()) { writeToSocket(block); } if (bufferedWrites.size() > 0) { Iterator<ByteBufferHolder> bufIter = bufferedWrites.iterator(); while (!hasMoreDataToFlush() && bufIter.hasNext()) { ByteBufferHolder buffer = bufIter.next(); buffer.flip(); while (!hasMoreDataToFlush() && buffer.getBuf().remaining()>0) { transfer(buffer.getBuf(), bbuf); if (buffer.getBuf().remaining() == 0) { bufIter.remove(); } writeToSocket(block); //here we must break if we didn't finish the write } } } return hasMoreDataToFlush(); }
private void writeData(ByteChunk chunk) throws IOException { // Prevent timeout socketWrapper.access(); boolean blocking = (response.getWriteListener() == null); if (!blocking) { flushBufferedData(); } int len = chunk.getLength(); int off = 0; // Write this chunk while (responseMsgPos == -1 && len > 0) { int thisTime = len; if (thisTime > outputMaxChunkSize) { thisTime = outputMaxChunkSize; } responseMessage.reset(); responseMessage.appendByte(Constants.JK_AJP13_SEND_BODY_CHUNK); responseMessage.appendBytes(chunk.getBytes(), chunk.getOffset() + off, thisTime); responseMessage.end(); writeResponseMessage(blocking); len -= thisTime; off += thisTime; } bytesWritten += off; if (len > 0) { // Add this chunk to the buffer addToBuffers(chunk.getBuffer(), off, len); } }